diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 87 |
1 files changed, 57 insertions, 30 deletions
diff --git a/src/Makefile b/src/Makefile index f7f81a4e..f56465d1 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= 5 | 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,29 @@ 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 | ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH))) | ||
246 | TARGET_ARCH= -D__AARCH64EB__=1 | ||
247 | endif | ||
248 | TARGET_LJARCH= arm64 | ||
249 | else | ||
242 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) | 250 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) |
251 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
252 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE | ||
253 | else | ||
254 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE | ||
255 | endif | ||
243 | TARGET_LJARCH= ppc | 256 | TARGET_LJARCH= ppc |
244 | else | 257 | else |
245 | ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH))) | ||
246 | TARGET_LJARCH= ppcspe | ||
247 | else | ||
248 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) | 258 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) |
249 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) | 259 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) |
250 | TARGET_ARCH= -D__MIPSEL__=1 | 260 | TARGET_ARCH= -D__MIPSEL__=1 |
251 | endif | 261 | endif |
252 | TARGET_LJARCH= mips | 262 | ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) |
263 | TARGET_LJARCH= mips64 | ||
264 | else | ||
265 | TARGET_LJARCH= mips | ||
266 | endif | ||
253 | else | 267 | else |
254 | $(error Unsupported target architecture) | 268 | $(error Unsupported target architecture) |
255 | endif | 269 | endif |
@@ -263,6 +277,7 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) | |||
263 | TARGET_SYS= PS3 | 277 | TARGET_SYS= PS3 |
264 | TARGET_ARCH+= -D__CELLOS_LV2__ | 278 | TARGET_ARCH+= -D__CELLOS_LV2__ |
265 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 279 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
280 | TARGET_XLIBS+= -lpthread | ||
266 | endif | 281 | endif |
267 | 282 | ||
268 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) | 283 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) |
@@ -314,6 +329,9 @@ ifeq (iOS,$(TARGET_SYS)) | |||
314 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 329 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC |
315 | TARGET_DYNXLDOPTS= | 330 | TARGET_DYNXLDOPTS= |
316 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) | 331 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) |
332 | ifeq (arm64,$(TARGET_LJARCH)) | ||
333 | TARGET_XCFLAGS+= -fno-omit-frame-pointer | ||
334 | endif | ||
317 | else | 335 | else |
318 | ifneq (SunOS,$(TARGET_SYS)) | 336 | ifneq (SunOS,$(TARGET_SYS)) |
319 | ifneq (PS3,$(TARGET_SYS)) | 337 | ifneq (PS3,$(TARGET_SYS)) |
@@ -374,6 +392,11 @@ DASM_XFLAGS= | |||
374 | DASM_AFLAGS= | 392 | DASM_AFLAGS= |
375 | DASM_ARCH= $(TARGET_LJARCH) | 393 | DASM_ARCH= $(TARGET_LJARCH) |
376 | 394 | ||
395 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
396 | DASM_AFLAGS+= -D ENDIAN_LE | ||
397 | else | ||
398 | DASM_AFLAGS+= -D ENDIAN_BE | ||
399 | endif | ||
377 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) | 400 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) |
378 | DASM_AFLAGS+= -D P64 | 401 | DASM_AFLAGS+= -D P64 |
379 | endif | 402 | endif |
@@ -406,13 +429,10 @@ DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subs | |||
406 | ifeq (Windows,$(TARGET_SYS)) | 429 | ifeq (Windows,$(TARGET_SYS)) |
407 | DASM_AFLAGS+= -D WIN | 430 | DASM_AFLAGS+= -D WIN |
408 | endif | 431 | endif |
409 | ifeq (x86,$(TARGET_LJARCH)) | ||
410 | ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH))) | ||
411 | DASM_AFLAGS+= -D SSE | ||
412 | endif | ||
413 | else | ||
414 | ifeq (x64,$(TARGET_LJARCH)) | 432 | ifeq (x64,$(TARGET_LJARCH)) |
415 | DASM_ARCH= x86 | 433 | ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) |
434 | DASM_ARCH= x86 | ||
435 | endif | ||
416 | else | 436 | else |
417 | ifeq (arm,$(TARGET_LJARCH)) | 437 | ifeq (arm,$(TARGET_LJARCH)) |
418 | ifeq (iOS,$(TARGET_SYS)) | 438 | ifeq (iOS,$(TARGET_SYS)) |
@@ -426,13 +446,15 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
426 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) | 446 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) |
427 | DASM_AFLAGS+= -D ROUND | 447 | DASM_AFLAGS+= -D ROUND |
428 | endif | 448 | endif |
429 | ifneq (,$(findstring LJ_ARCH_PPC64 1,$(TARGET_TESTARCH))) | 449 | ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) |
430 | DASM_AFLAGS+= -D GPR64 | 450 | DASM_AFLAGS+= -D GPR64 |
431 | endif | 451 | endif |
432 | ifeq (PS3,$(TARGET_SYS)) | 452 | ifeq (PS3,$(TARGET_SYS)) |
433 | DASM_AFLAGS+= -D PPE -D TOC | 453 | DASM_AFLAGS+= -D PPE -D TOC |
434 | endif | 454 | endif |
435 | endif | 455 | ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) |
456 | DASM_ARCH= ppc64 | ||
457 | endif | ||
436 | endif | 458 | endif |
437 | endif | 459 | endif |
438 | endif | 460 | endif |
@@ -448,7 +470,7 @@ BUILDVM_X= $(BUILDVM_T) | |||
448 | HOST_O= $(MINILUA_O) $(BUILDVM_O) | 470 | HOST_O= $(MINILUA_O) $(BUILDVM_O) |
449 | HOST_T= $(MINILUA_T) $(BUILDVM_T) | 471 | HOST_T= $(MINILUA_T) $(BUILDVM_T) |
450 | 472 | ||
451 | LJVM_S= lj_vm.s | 473 | LJVM_S= lj_vm.S |
452 | LJVM_O= lj_vm.o | 474 | LJVM_O= lj_vm.o |
453 | LJVM_BOUT= $(LJVM_S) | 475 | LJVM_BOUT= $(LJVM_S) |
454 | LJVM_MODE= elfasm | 476 | LJVM_MODE= elfasm |
@@ -457,10 +479,11 @@ LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ | |||
457 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o | 479 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o |
458 | LJLIB_C= $(LJLIB_O:.o=.c) | 480 | LJLIB_C= $(LJLIB_O:.o=.c) |
459 | 481 | ||
460 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \ | 482 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ |
461 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ | 483 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ |
462 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ | 484 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ |
463 | lj_api.o lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | 485 | lj_strfmt.o lj_strfmt_num.o lj_api.o lj_profile.o \ |
486 | lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | ||
464 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ | 487 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ |
465 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ | 488 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ |
466 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ | 489 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ |
@@ -580,6 +603,10 @@ amalg: | |||
580 | clean: | 603 | clean: |
581 | $(HOST_RM) $(ALL_RM) | 604 | $(HOST_RM) $(ALL_RM) |
582 | 605 | ||
606 | libbc: | ||
607 | ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) | ||
608 | $(MAKE) all | ||
609 | |||
583 | depend: | 610 | depend: |
584 | @for file in $(ALL_HDRGEN); do \ | 611 | @for file in $(ALL_HDRGEN); do \ |
585 | test -f $$file || touch $$file; \ | 612 | test -f $$file || touch $$file; \ |
@@ -594,7 +621,7 @@ depend: | |||
594 | test -s $$file || $(HOST_RM) $$file; \ | 621 | test -s $$file || $(HOST_RM) $$file; \ |
595 | done | 622 | done |
596 | 623 | ||
597 | .PHONY: default all amalg clean depend | 624 | .PHONY: default all amalg clean libbc depend |
598 | 625 | ||
599 | ############################################################################## | 626 | ############################################################################## |
600 | # Rules for generated files. | 627 | # Rules for generated files. |
@@ -604,7 +631,7 @@ $(MINILUA_T): $(MINILUA_O) | |||
604 | $(E) "HOSTLINK $@" | 631 | $(E) "HOSTLINK $@" |
605 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) | 632 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) |
606 | 633 | ||
607 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) | 634 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua |
608 | $(E) "DYNASM $@" | 635 | $(E) "DYNASM $@" |
609 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) | 636 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) |
610 | 637 | ||
@@ -651,10 +678,10 @@ lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c | |||
651 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 678 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< |
652 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 679 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< |
653 | 680 | ||
654 | %.o: %.s | 681 | %.o: %.S |
655 | $(E) "ASM $@" | 682 | $(E) "ASM $@" |
656 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 683 | $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< |
657 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 684 | $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< |
658 | 685 | ||
659 | $(LUAJIT_O): | 686 | $(LUAJIT_O): |
660 | $(E) "CC $@" | 687 | $(E) "CC $@" |