FFI: Print NULL pointers as "cdata<... *>: NULL".
[luajit-2.0.git] / src / Makefile
blobc99d8577b4d9af01cd5195fb84f8770303cdf41f
1 ##############################################################################
2 # LuaJIT Makefile. Requires GNU Make.
4 # Please read doc/install.html before changing any variables!
6 # Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
7 # Also works with MinGW and Cygwin on Windows.
8 # Please check msvcbuild.bat for building with MSVC on Windows.
10 # Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
11 ##############################################################################
13 MAJVER= 2
14 MINVER= 0
15 RELVER= 0
16 ABIVER= 5.1
17 NODOTABIVER= 51
19 ##############################################################################
20 ############################# COMPILER OPTIONS #############################
21 ##############################################################################
22 # These options mainly affect the speed of the JIT compiler itself, not the
23 # speed of the JIT-compiled code. Turn any of the optional settings on by
24 # removing the '#' in front of them. Make sure you force a full recompile
25 # with "make clean", followed by "make" if you change any options.
27 # LuaJIT builds as a native 32 or 64 bit binary by default.
28 CC= gcc
30 # Use this if you want to force a 32 bit build on a 64 bit multilib OS.
31 #CC= gcc -m32
33 # Since the assembler part does NOT maintain a frame pointer, it's pointless
34 # to slow down the C part by not omitting it. Debugging, tracebacks and
35 # unwinding are not affected -- the assembler part has frame unwind
36 # information and GCC emits it where needed (x64) or with -g (see CCDEBUG).
37 CCOPT= -O2 -fomit-frame-pointer
38 # Use this if you want to generate a smaller binary (but it's slower):
39 #CCOPT= -Os -fomit-frame-pointer
40 # Note: it's no longer recommended to use -O3 with GCC 4.x.
41 # The I-Cache bloat usually outweighs the benefits from aggressive inlining.
43 # Target-specific compiler options:
45 # x86 only: it's recommended to compile at least for i686. By default the
46 # assembler part of the interpreter makes use of CMOV/FCOMI*/FUCOMI*
47 # instructions, anyway.
49 # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
50 # the binaries to a different machine you could also use: -march=native
52 CCOPT_X86= -march=i686
53 CCOPT_X64=
54 CCOPT_ARM=
55 CCOPT_PPCSPE=
57 CCDEBUG=
58 # Uncomment the next line to generate debug information:
59 #CCDEBUG= -g
61 CCWARN= -Wall
62 # Uncomment the next line to enable more warnings:
63 #CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith
65 ##############################################################################
67 ##############################################################################
68 ################################ BUILD MODE ################################
69 ##############################################################################
70 # The default build mode is mixed mode on POSIX. On Windows this is the same
71 # as dynamic mode.
73 # Mixed mode creates a static + dynamic library and a statically linked luajit.
74 BUILDMODE= mixed
76 # Static mode creates a static library and a statically linked luajit.
77 #BUILDMODE= static
79 # Dynamic mode creates a dynamic library and a dynamically linked luajit.
80 # Note: this executable will only run when the library is installed!
81 #BUILDMODE= dynamic
83 ##############################################################################
85 ##############################################################################
86 ################################# FEATURES #################################
87 ##############################################################################
88 # Enable/disable these features as needed, but make sure you force a full
89 # recompile with "make clean", followed by "make".
90 XCFLAGS=
92 # Permanently disable the FFI extension to reduce the size of the LuaJIT
93 # executable. But please consider that the FFI library is compiled-in,
94 # but NOT loaded by default. It only allocates any memory, if you actually
95 # make use of it.
96 #XCFLAGS+= -DLUAJIT_DISABLE_FFI
98 # Enable some upwards-compatible features from Lua 5.2 that are unlikely
99 # to break existing code (e.g. __pairs). Note that this does not provide
100 # full compatibility with Lua 5.2 at this time.
101 #XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
103 # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter.
104 #XCFLAGS+= -DLUAJIT_DISABLE_JIT
106 # x86 only: use SSE2 instead of x87 instructions in the interpreter
107 # (always enabled for x64). A pure interpreter built with this flag won't
108 # run on older CPUs (before P4 or K8). There isn't much of a speed
109 # difference, so this is not enabled by default.
110 # The JIT compiler is not affected by this flag. It always uses runtime
111 # CPU feature detection before emitting code for SSE2 up to SSE4.1.
112 #XCFLAGS+= -DLUAJIT_CPU_SSE2
114 # x86 only: Disable the use of CMOV and FCOMI*/FUCOMI* instructions in the
115 # interpreter. Do this only if you intend to use REALLY ANCIENT CPUs
116 # (before Pentium Pro, or on the VIA C3). This generally slows down the
117 # interpreter. Don't bother if your OS wouldn't run on them, anyway.
118 #XCFLAGS+= -DLUAJIT_CPU_NOCMOV
120 ##############################################################################
122 ##############################################################################
123 ############################ DEBUGGING SUPPORT #############################
124 ##############################################################################
125 # Enable these options as needed, but make sure you force a full recompile
126 # with "make clean", followed by "make".
127 # Note that most of these are NOT suitable for benchmarking or release mode!
129 # Use the system provided memory allocator (realloc) instead of the
130 # bundled memory allocator. This is slower, but sometimes helpful for
131 # debugging. It's helpful for Valgrind's memcheck tool, too. This option
132 # cannot be enabled on x64, since the built-in allocator is mandatory.
133 #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
135 # This define is required to run LuaJIT under Valgrind. The Valgrind
136 # header files must be installed. You should enable debug information, too.
137 #XCFLAGS+= -DLUAJIT_USE_VALGRIND
139 # This is the client for the GDB JIT API. GDB 7.0 or higher is required
140 # to make use of it. See lj_gdbjit.c for details. Enabling this causes
141 # a non-negligible overhead, even when not running under GDB.
142 #XCFLAGS+= -DLUAJIT_USE_GDBJIT
144 # Turn on assertions for the Lua/C API to debug problems with lua_* calls.
145 # This is rather slow -- use only while developing C libraries/embeddings.
146 #XCFLAGS+= -DLUA_USE_APICHECK
148 # Turn on assertions for the whole LuaJIT VM. This significantly slows down
149 # everything. Use only if you suspect a problem with LuaJIT itself.
150 #XCFLAGS+= -DLUA_USE_ASSERT
152 ##############################################################################
153 # You probably don't need to change anything below this line!
154 ##############################################################################
156 ##############################################################################
157 # Flags and options for host and target.
158 ##############################################################################
160 # You can override the following variables at the make command line:
161 # CC HOST_CC STATIC_CC DYNAMIC_CC
162 # CFLAGS HOST_CFLAGS TARGET_CFLAGS
163 # LDFLAGS HOST_LDFLAGS TARGET_LDFLAGS TARGET_SHLDFLAGS
164 # LIBS HOST_LIBS TARGET_LIBS
165 # CROSS HOST_SYS TARGET_SYS TARGET_FLAGS
167 # Cross-compilation examples:
168 # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows
169 # make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe
171 CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS)
172 LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
174 TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET))
176 HOST_CC= $(CC)
177 HOST_RM= rm -f
178 # NOTE: The LuaJIT distribution comes with pre-generated buildvm_*.h files.
179 # You DO NOT NEED an installed copy of (plain) Lua 5.1 to run DynASM unless
180 # you want to MODIFY the corresponding *.dasc file. You can also use LuaJIT
181 # itself (bootstrapped from a pre-generated file) to run DynASM of course.
182 HOST_LUA= lua
184 HOST_XCFLAGS=
185 HOST_XLDFLAGS=
186 HOST_XLIBS=
187 HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS)
188 HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS)
189 HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS)
191 STATIC_CC = $(CROSS)$(CC)
192 DYNAMIC_CC = $(CROSS)$(CC) -fPIC
193 TARGET_CC= $(STATIC_CC)
194 TARGET_STCC= $(STATIC_CC)
195 TARGET_DYNCC= $(DYNAMIC_CC)
196 TARGET_LD= $(CROSS)$(CC)
197 TARGET_AR= $(CROSS)ar rcus
198 TARGET_STRIP= $(CROSS)strip
200 TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
201 TARGET_DYLIBNAME= libluajit-$(NODOTABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
202 TARGET_DLLNAME= lua$(NODOTABIVER).dll
203 TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
204 TARGET_DYNXLDOPTS=
206 TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE
207 TARGET_XLDFLAGS=
208 TARGET_XLIBS= -lm
209 TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_ARCH) $(TARGET_FLAGS) $(TARGET_CFLAGS)
210 TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS)
211 TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS)
212 TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
214 ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
215 TARGET_XCFLAGS+= -fno-stack-protector
216 endif
218 TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_ACFLAGS) -E lj_arch.h -dM)
219 ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH)))
220 TARGET_CCARCH= x64
221 TARGET_XCFLAGS+= $(CCOPT_X64)
222 else
223 ifneq (,$(findstring LJ_TARGET_X86 ,$(TARGET_TESTARCH)))
224 TARGET_CCARCH= x86
225 TARGET_XCFLAGS+= $(CCOPT_X86)
226 else
227 ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH)))
228 TARGET_CCARCH= arm
229 TARGET_XCFLAGS+= $(CCOPT_ARM)
230 else
231 ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH)))
232 TARGET_CCARCH= ppcspe
233 TARGET_XCFLAGS+= $(CCOPT_PPCSPE)
234 else
235 $(error Unsupported target architecture)
236 endif
237 endif
238 endif
239 endif
241 ifneq (,$(PREFIX))
242 ifneq (/usr/local,$(PREFIX))
243 TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
244 ifneq (/usr,$(PREFIX))
245 TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
246 endif
247 endif
248 endif
250 ##############################################################################
251 # System detection.
252 ##############################################################################
254 ifneq (,$(findstring Windows,$(OS)))
255 HOST_SYS= Windows
256 else
257 HOST_SYS:= $(shell uname -s)
258 ifneq (,$(findstring CYGWIN,$(TARGET_SYS)))
259 HOST_SYS= Windows
260 endif
261 endif
262 ifeq (Windows,$(HOST_SYS))
263 HOST_RM= del
264 endif
266 TARGET_SYS= $(HOST_SYS)
267 ifeq (Windows,$(TARGET_SYS))
268 TARGET_STRIP+= --strip-unneeded
269 TARGET_XSHLDFLAGS= -shared
270 TARGET_DYNXLDOPTS=
271 else
272 ifeq (Darwin,$(TARGET_SYS))
273 export MACOSX_DEPLOYMENT_TARGET=10.4
274 TARGET_STRIP+= -x
275 TARGET_AR+= 2>/dev/null
276 TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
277 ifneq (,$(TARGET_DYNXLDOPTS))
278 TARGET_DYNXLDOPTS=
279 TARGET_XSHLDFLAGS+= -install_name $(PREFIX)/lib/$(TARGET_DYLIBNAME)
280 endif
281 ifeq (x64,$(TARGET_CCARCH))
282 TARGET_XLDFLAGS+= -pagezero_size 10000 -image_base 100000000
283 TARGET_XSHLDFLAGS+= -image_base 7fff04c4a000
284 endif
285 else
286 ifeq (iOS,$(TARGET_SYS))
287 TARGET_STRIP+= -x
288 TARGET_AR+= 2>/dev/null
289 TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
290 ifneq (,$(TARGET_DYNXLDOPTS))
291 TARGET_DYNXLDOPTS=
292 TARGET_XSHLDFLAGS+= -install_name $(PREFIX)/lib/$(TARGET_DYLIBNAME)
293 endif
294 else
295 TARGET_XLDFLAGS+= -Wl,-E
296 ifeq (Linux,$(TARGET_SYS))
297 TARGET_XLIBS+= -ldl
298 endif
299 ifeq (GNU/kFreeBSD,$(TARGET_SYS))
300 TARGET_XLIBS+= -ldl
301 endif
302 endif
303 endif
304 endif
306 ifneq ($(HOST_SYS),$(TARGET_SYS))
307 ifeq (Windows,$(TARGET_SYS))
308 HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS
309 else
310 ifeq (Linux,$(TARGET_SYS))
311 HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX
312 else
313 ifeq (Darwin,$(TARGET_SYS))
314 HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX
315 else
316 ifeq (iOS,$(TARGET_SYS))
317 HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX
318 else
319 HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER
320 endif
321 endif
322 endif
323 endif
324 endif
326 ifneq (,$(CCDEBUG))
327 TARGET_STRIP= @:
328 endif
330 ##############################################################################
331 # Files and pathnames.
332 ##############################################################################
334 DASM_DIR= ../dynasm
335 DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua
336 DASM_FLAGS=
337 DASM_DISTFLAGS= -LN
338 DASM_FLAGS_X86=
339 DASM_FLAGS_X64= -D X64
340 DASM_FLAGS_X64WIN= -D X64 -D X64WIN
341 DASM_FLAGS_ARM=
342 DASM_FLAGS_PPCSPE= -D SPE
344 BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o
345 BUILDVM_T= buildvm
346 BUILDVM_X= ./$(BUILDVM_T)
348 HOST_O= $(BUILDVM_O)
349 HOST_T= $(BUILDVM_T)
351 LJVM_S= lj_vm.s
352 LJVM_O= lj_vm.o
353 LJVM_BOUT= $(LJVM_S)
354 LJVM_MODE= elfasm
356 LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \
357 lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o
358 LJLIB_C= $(LJLIB_O:.o=.c)
360 LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \
361 lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o \
362 lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_api.o \
363 lj_lex.o lj_parse.o \
364 lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \
365 lj_opt_dce.o lj_opt_loop.o lj_opt_split.o \
366 lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \
367 lj_asm.o lj_trace.o lj_gdbjit.o \
368 lj_ctype.o lj_cdata.o lj_cconv.o lj_ccall.o lj_carith.o lj_clib.o \
369 lj_cparse.o \
370 lj_lib.o lj_alloc.o lib_aux.o \
371 $(LJLIB_O) lib_init.o
373 LJVMCORE_O= $(LJVM_O) $(LJCORE_O)
374 LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o)
376 LIB_VMDEF= ../lib/vmdef.lua
377 LIB_VMDEFP= $(LIB_VMDEF)
379 LUAJIT_O= luajit.o
380 LUAJIT_A= libluajit.a
381 LUAJIT_SO= libluajit.so
382 LUAJIT_T= luajit
384 ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T)
385 ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h
386 ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP)
387 ALL_DYNGEN= buildvm_x86.h buildvm_x64.h buildvm_x64win.h buildvm_arm.h \
388 buildvm_ppcspe.h
389 WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
390 ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM)
392 ##############################################################################
393 # Build mode handling.
394 ##############################################################################
396 # Mixed mode defaults.
397 TARGET_O= $(LUAJIT_A)
398 TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)
399 TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)
401 ifeq (Windows,$(HOST_SYS))
402 BUILDVM_T= buildvm.exe
403 LIB_VMDEFP= $(subst /,\\,$(LIB_VMDEF))
404 endif
405 ifeq (Windows,$(TARGET_SYS))
406 TARGET_DYNCC= $(STATIC_CC)
407 LJVM_MODE= coffasm
408 LUAJIT_SO= $(TARGET_DLLNAME)
409 LUAJIT_T= luajit.exe
410 # Mixed mode is not supported on Windows. And static mode doesn't work well.
411 # C modules cannot be loaded, because they bind to lua51.dll.
412 ifneq (static,$(BUILDMODE))
413 BUILDMODE= dynamic
414 TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL
415 endif
416 endif
417 ifeq (Darwin,$(TARGET_SYS))
418 LJVM_MODE= machasm
419 endif
420 ifeq (iOS,$(TARGET_SYS))
421 LJVM_MODE= machasm
422 endif
424 ifeq (static,$(BUILDMODE))
425 TARGET_DYNCC= @:
426 TARGET_T= $(LUAJIT_T)
427 TARGET_DEP= $(LIB_VMDEF)
428 else
429 ifeq (dynamic,$(BUILDMODE))
430 ifneq (Windows,$(TARGET_SYS))
431 TARGET_CC= $(DYNAMIC_CC)
432 endif
433 TARGET_DYNCC= @:
434 LJVMCORE_DYNO= $(LJVMCORE_O)
435 TARGET_O= $(LUAJIT_SO)
436 TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS)
437 else
438 ifeq (Darwin,$(TARGET_SYS))
439 TARGET_DYNCC= @:
440 LJVMCORE_DYNO= $(LJVMCORE_O)
441 endif
442 ifeq (iOS,$(TARGET_SYS))
443 TARGET_DYNCC= @:
444 LJVMCORE_DYNO= $(LJVMCORE_O)
445 endif
446 endif
447 endif
449 Q= @
450 E= @echo
452 #E= @:
454 ##############################################################################
455 # Make targets.
456 ##############################################################################
458 default all: $(TARGET_T)
460 amalg:
461 @grep "^[+|]" ljamalg.c
462 $(MAKE) all "LJCORE_O=ljamalg.o"
464 clean:
465 $(HOST_RM) $(ALL_RM)
467 cleaner:
468 $(HOST_RM) $(ALL_RM) $(ALL_DYNGEN)
470 distclean: clean
471 $(E) "DYNASM $@"
472 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X86) -o buildvm_x86.h buildvm_x86.dasc
473 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64) -o buildvm_x64.h buildvm_x86.dasc
474 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64WIN) -o buildvm_x64win.h buildvm_x86.dasc
475 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_ARM) -o buildvm_arm.h buildvm_arm.dasc
476 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPCSPE) -o buildvm_ppcspe.h buildvm_ppc.dasc
478 depend:
479 @for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \
480 test -f $$file || touch $$file; \
481 done
482 @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | \
483 sed -e "s| [^ ]*/dasm_\S*\.h||g" \
484 -e "s| buildvm_\S*\.h||g" \
485 -e "s| lj_target_\S*\.h| lj_target_*.h|g" \
486 -e "s| lj_emit_\S*\.h| lj_emit_*.h|g" \
487 -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep
488 @for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \
489 test -s $$file || $(HOST_RM) $$file; \
490 done
492 .PHONY: default all amalg clean cleaner distclean depend
494 ##############################################################################
495 # Rules for generated files.
496 ##############################################################################
498 buildvm_x86.h: buildvm_x86.dasc
499 $(E) "DYNASM $@"
500 $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_X86) -o $@ buildvm_x86.dasc
502 buildvm_x64.h: buildvm_x86.dasc
503 $(E) "DYNASM $@"
504 $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_X64) -o $@ buildvm_x86.dasc
506 buildvm_x64win.h: buildvm_x86.dasc
507 $(E) "DYNASM $@"
508 $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_X64WIN) -o $@ buildvm_x86.dasc
510 buildvm_arm.h: buildvm_arm.dasc
511 $(E) "DYNASM $@"
512 $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_ARM) -o $@ buildvm_arm.dasc
514 buildvm_ppcspe.h: buildvm_ppc.dasc
515 $(E) "DYNASM $@"
516 $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_PPCSPE) -o $@ buildvm_ppc.dasc
518 buildvm.o: $(ALL_DYNGEN) $(DASM_DIR)/dasm_*.h
520 $(BUILDVM_T): $(BUILDVM_O)
521 $(E) "HOSTLINK $@"
522 $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS)
524 $(LJVM_BOUT): $(BUILDVM_T)
525 $(E) "BUILDVM $@"
526 $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@
528 lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C)
529 $(E) "BUILDVM $@"
530 $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C)
532 lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C)
533 $(E) "BUILDVM $@"
534 $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C)
536 lj_libdef.h: $(BUILDVM_T) $(LJLIB_C)
537 $(E) "BUILDVM $@"
538 $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C)
540 lj_recdef.h: $(BUILDVM_T) $(LJLIB_C)
541 $(E) "BUILDVM $@"
542 $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C)
544 $(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C)
545 $(E) "BUILDVM $@"
546 $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C)
548 lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c
549 $(E) "BUILDVM $@"
550 $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c
552 ##############################################################################
553 # Object file rules.
554 ##############################################################################
556 %.o: %.c
557 $(E) "CC $@"
558 $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $<
559 $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $<
561 %.o: %.s
562 $(E) "ASM $@"
563 $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $<
564 $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $<
566 $(LUAJIT_O):
567 $(E) "CC $@"
568 $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $<
570 $(HOST_O): %.o: %.c
571 $(E) "HOSTCC $@"
572 $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $<
574 include Makefile.dep
576 ##############################################################################
577 # Target file rules.
578 ##############################################################################
580 $(LUAJIT_A): $(LJVMCORE_O)
581 $(E) "AR $@"
582 $(Q)$(TARGET_AR) $@ $(LJVMCORE_O)
584 # The dependency on _O, but linking with _DYNO is intentional.
585 $(LUAJIT_SO): $(LJVMCORE_O)
586 $(E) "DYNLINK $@"
587 $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS)
588 $(Q)$(TARGET_STRIP) $@
590 $(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP)
591 $(E) "LINK $@"
592 $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS)
593 $(Q)$(TARGET_STRIP) $@
594 $(E) "OK Successfully built LuaJIT"
596 ##############################################################################