diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/src/Makefile b/src/Makefile index 01b75211..5a2277cc 100644 --- a/src/Makefile +++ b/src/Makefile | |||
@@ -11,8 +11,8 @@ | |||
11 | ############################################################################## | 11 | ############################################################################## |
12 | 12 | ||
13 | MAJVER= 2 | 13 | MAJVER= 2 |
14 | MINVER= 0 | 14 | MINVER= 1 |
15 | RELVER= 4 | 15 | RELVER= 0 |
16 | ABIVER= 5.1 | 16 | ABIVER= 5.1 |
17 | NODOTABIVER= 51 | 17 | NODOTABIVER= 51 |
18 | 18 | ||
@@ -44,17 +44,14 @@ CCOPT= -O2 -fomit-frame-pointer | |||
44 | # | 44 | # |
45 | # Target-specific compiler options: | 45 | # Target-specific compiler options: |
46 | # | 46 | # |
47 | # x86 only: it's recommended to compile at least for i686. Better yet, | ||
48 | # compile for an architecture that has SSE2, too (-msse -msse2). | ||
49 | # | ||
50 | # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute | 47 | # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute |
51 | # the binaries to a different machine you could also use: -march=native | 48 | # the binaries to a different machine you could also use: -march=native |
52 | # | 49 | # |
53 | CCOPT_x86= -march=i686 | 50 | CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse |
54 | CCOPT_x64= | 51 | CCOPT_x64= |
55 | CCOPT_arm= | 52 | CCOPT_arm= |
53 | CCOPT_arm64= | ||
56 | CCOPT_ppc= | 54 | CCOPT_ppc= |
57 | CCOPT_ppcspe= | ||
58 | CCOPT_mips= | 55 | CCOPT_mips= |
59 | # | 56 | # |
60 | CCDEBUG= | 57 | CCDEBUG= |
@@ -113,6 +110,9 @@ XCFLAGS= | |||
113 | #XCFLAGS+= -DLUAJIT_NUMMODE=1 | 110 | #XCFLAGS+= -DLUAJIT_NUMMODE=1 |
114 | #XCFLAGS+= -DLUAJIT_NUMMODE=2 | 111 | #XCFLAGS+= -DLUAJIT_NUMMODE=2 |
115 | # | 112 | # |
113 | # Enable GC64 mode for x64. | ||
114 | #XCFLAGS+= -DLUAJIT_ENABLE_GC64 | ||
115 | # | ||
116 | ############################################################################## | 116 | ############################################################################## |
117 | 117 | ||
118 | ############################################################################## | 118 | ############################################################################## |
@@ -124,8 +124,8 @@ XCFLAGS= | |||
124 | # | 124 | # |
125 | # Use the system provided memory allocator (realloc) instead of the | 125 | # Use the system provided memory allocator (realloc) instead of the |
126 | # bundled memory allocator. This is slower, but sometimes helpful for | 126 | # bundled memory allocator. This is slower, but sometimes helpful for |
127 | # debugging. This option cannot be enabled on x64, since realloc usually | 127 | # debugging. This option cannot be enabled on x64 without GC64, since |
128 | # doesn't return addresses in the right address range. | 128 | # realloc usually doesn't return addresses in the right address range. |
129 | # OTOH this option is mandatory for Valgrind's memcheck tool on x64 and | 129 | # OTOH this option is mandatory for Valgrind's memcheck tool on x64 and |
130 | # the only way to get useful results from it for all other architectures. | 130 | # the only way to get useful results from it for all other architectures. |
131 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 131 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
@@ -186,7 +186,8 @@ endif | |||
186 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 186 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
187 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- | 187 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- |
188 | 188 | ||
189 | CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) | 189 | ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) |
190 | CCOPTIONS= $(CCDEBUG) $(ASOPTIONS) | ||
190 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) | 191 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) |
191 | 192 | ||
192 | HOST_CC= $(CC) | 193 | HOST_CC= $(CC) |
@@ -225,6 +226,7 @@ TARGET_XLDFLAGS= | |||
225 | TARGET_XLIBS= -lm | 226 | TARGET_XLIBS= -lm |
226 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 227 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
227 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 228 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
229 | TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | ||
228 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) | 230 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) |
229 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) | 231 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) |
230 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) | 232 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) |
@@ -239,17 +241,26 @@ else | |||
239 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) | 241 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) |
240 | TARGET_LJARCH= arm | 242 | TARGET_LJARCH= arm |
241 | else | 243 | else |
244 | ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH))) | ||
245 | TARGET_LJARCH= arm64 | ||
246 | else | ||
242 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) | 247 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) |
248 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
249 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE | ||
250 | else | ||
251 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE | ||
252 | endif | ||
243 | TARGET_LJARCH= ppc | 253 | TARGET_LJARCH= ppc |
244 | else | 254 | else |
245 | ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH))) | ||
246 | TARGET_LJARCH= ppcspe | ||
247 | else | ||
248 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) | 255 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) |
249 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) | 256 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) |
250 | TARGET_ARCH= -D__MIPSEL__=1 | 257 | TARGET_ARCH= -D__MIPSEL__=1 |
251 | endif | 258 | endif |
252 | TARGET_LJARCH= mips | 259 | ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) |
260 | TARGET_LJARCH= mips64 | ||
261 | else | ||
262 | TARGET_LJARCH= mips | ||
263 | endif | ||
253 | else | 264 | else |
254 | $(error Unsupported target architecture) | 265 | $(error Unsupported target architecture) |
255 | endif | 266 | endif |
@@ -263,6 +274,7 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) | |||
263 | TARGET_SYS= PS3 | 274 | TARGET_SYS= PS3 |
264 | TARGET_ARCH+= -D__CELLOS_LV2__ | 275 | TARGET_ARCH+= -D__CELLOS_LV2__ |
265 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 276 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
277 | TARGET_XLIBS+= -lpthread | ||
266 | endif | 278 | endif |
267 | 279 | ||
268 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) | 280 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) |
@@ -316,6 +328,9 @@ ifeq (iOS,$(TARGET_SYS)) | |||
316 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 328 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC |
317 | TARGET_DYNXLDOPTS= | 329 | TARGET_DYNXLDOPTS= |
318 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) | 330 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) |
331 | ifeq (arm64,$(TARGET_LJARCH)) | ||
332 | TARGET_XCFLAGS+= -fno-omit-frame-pointer | ||
333 | endif | ||
319 | else | 334 | else |
320 | ifneq (SunOS,$(TARGET_SYS)) | 335 | ifneq (SunOS,$(TARGET_SYS)) |
321 | ifneq (PS3,$(TARGET_SYS)) | 336 | ifneq (PS3,$(TARGET_SYS)) |
@@ -376,6 +391,11 @@ DASM_XFLAGS= | |||
376 | DASM_AFLAGS= | 391 | DASM_AFLAGS= |
377 | DASM_ARCH= $(TARGET_LJARCH) | 392 | DASM_ARCH= $(TARGET_LJARCH) |
378 | 393 | ||
394 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
395 | DASM_AFLAGS+= -D ENDIAN_LE | ||
396 | else | ||
397 | DASM_AFLAGS+= -D ENDIAN_BE | ||
398 | endif | ||
379 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) | 399 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) |
380 | DASM_AFLAGS+= -D P64 | 400 | DASM_AFLAGS+= -D P64 |
381 | endif | 401 | endif |
@@ -408,13 +428,10 @@ DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subs | |||
408 | ifeq (Windows,$(TARGET_SYS)) | 428 | ifeq (Windows,$(TARGET_SYS)) |
409 | DASM_AFLAGS+= -D WIN | 429 | DASM_AFLAGS+= -D WIN |
410 | endif | 430 | endif |
411 | ifeq (x86,$(TARGET_LJARCH)) | ||
412 | ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH))) | ||
413 | DASM_AFLAGS+= -D SSE | ||
414 | endif | ||
415 | else | ||
416 | ifeq (x64,$(TARGET_LJARCH)) | 431 | ifeq (x64,$(TARGET_LJARCH)) |
417 | DASM_ARCH= x86 | 432 | ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) |
433 | DASM_ARCH= x86 | ||
434 | endif | ||
418 | else | 435 | else |
419 | ifeq (arm,$(TARGET_LJARCH)) | 436 | ifeq (arm,$(TARGET_LJARCH)) |
420 | ifeq (iOS,$(TARGET_SYS)) | 437 | ifeq (iOS,$(TARGET_SYS)) |
@@ -428,13 +445,15 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
428 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) | 445 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) |
429 | DASM_AFLAGS+= -D ROUND | 446 | DASM_AFLAGS+= -D ROUND |
430 | endif | 447 | endif |
431 | ifneq (,$(findstring LJ_ARCH_PPC64 1,$(TARGET_TESTARCH))) | 448 | ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) |
432 | DASM_AFLAGS+= -D GPR64 | 449 | DASM_AFLAGS+= -D GPR64 |
433 | endif | 450 | endif |
434 | ifeq (PS3,$(TARGET_SYS)) | 451 | ifeq (PS3,$(TARGET_SYS)) |
435 | DASM_AFLAGS+= -D PPE -D TOC | 452 | DASM_AFLAGS+= -D PPE -D TOC |
436 | endif | 453 | endif |
437 | endif | 454 | ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) |
455 | DASM_ARCH= ppc64 | ||
456 | endif | ||
438 | endif | 457 | endif |
439 | endif | 458 | endif |
440 | endif | 459 | endif |
@@ -450,7 +469,7 @@ BUILDVM_X= $(BUILDVM_T) | |||
450 | HOST_O= $(MINILUA_O) $(BUILDVM_O) | 469 | HOST_O= $(MINILUA_O) $(BUILDVM_O) |
451 | HOST_T= $(MINILUA_T) $(BUILDVM_T) | 470 | HOST_T= $(MINILUA_T) $(BUILDVM_T) |
452 | 471 | ||
453 | LJVM_S= lj_vm.s | 472 | LJVM_S= lj_vm.S |
454 | LJVM_O= lj_vm.o | 473 | LJVM_O= lj_vm.o |
455 | LJVM_BOUT= $(LJVM_S) | 474 | LJVM_BOUT= $(LJVM_S) |
456 | LJVM_MODE= elfasm | 475 | LJVM_MODE= elfasm |
@@ -459,10 +478,11 @@ LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ | |||
459 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o | 478 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o |
460 | LJLIB_C= $(LJLIB_O:.o=.c) | 479 | LJLIB_C= $(LJLIB_O:.o=.c) |
461 | 480 | ||
462 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \ | 481 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ |
463 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ | 482 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ |
464 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ | 483 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ |
465 | lj_api.o lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | 484 | lj_strfmt.o lj_strfmt_num.o lj_api.o lj_profile.o \ |
485 | lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | ||
466 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ | 486 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ |
467 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ | 487 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ |
468 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ | 488 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ |
@@ -582,6 +602,10 @@ amalg: | |||
582 | clean: | 602 | clean: |
583 | $(HOST_RM) $(ALL_RM) | 603 | $(HOST_RM) $(ALL_RM) |
584 | 604 | ||
605 | libbc: | ||
606 | ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) | ||
607 | $(MAKE) all | ||
608 | |||
585 | depend: | 609 | depend: |
586 | @for file in $(ALL_HDRGEN); do \ | 610 | @for file in $(ALL_HDRGEN); do \ |
587 | test -f $$file || touch $$file; \ | 611 | test -f $$file || touch $$file; \ |
@@ -596,7 +620,7 @@ depend: | |||
596 | test -s $$file || $(HOST_RM) $$file; \ | 620 | test -s $$file || $(HOST_RM) $$file; \ |
597 | done | 621 | done |
598 | 622 | ||
599 | .PHONY: default all amalg clean depend | 623 | .PHONY: default all amalg clean libbc depend |
600 | 624 | ||
601 | ############################################################################## | 625 | ############################################################################## |
602 | # Rules for generated files. | 626 | # Rules for generated files. |
@@ -606,7 +630,7 @@ $(MINILUA_T): $(MINILUA_O) | |||
606 | $(E) "HOSTLINK $@" | 630 | $(E) "HOSTLINK $@" |
607 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) | 631 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) |
608 | 632 | ||
609 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) | 633 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua |
610 | $(E) "DYNASM $@" | 634 | $(E) "DYNASM $@" |
611 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) | 635 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) |
612 | 636 | ||
@@ -653,10 +677,10 @@ lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c | |||
653 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 677 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< |
654 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 678 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< |
655 | 679 | ||
656 | %.o: %.s | 680 | %.o: %.S |
657 | $(E) "ASM $@" | 681 | $(E) "ASM $@" |
658 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 682 | $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< |
659 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 683 | $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< |
660 | 684 | ||
661 | $(LUAJIT_O): | 685 | $(LUAJIT_O): |
662 | $(E) "CC $@" | 686 | $(E) "CC $@" |