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 cde4b9f7..71c284e2 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 |
@@ -189,7 +189,8 @@ endif | |||
189 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 189 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
190 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- | 190 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- |
191 | 191 | ||
192 | CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) | 192 | ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) |
193 | CCOPTIONS= $(CCDEBUG) $(ASOPTIONS) | ||
193 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) | 194 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) |
194 | 195 | ||
195 | HOST_CC= $(CC) | 196 | HOST_CC= $(CC) |
@@ -229,6 +230,7 @@ TARGET_XLDFLAGS= | |||
229 | TARGET_XLIBS= -lm | 230 | TARGET_XLIBS= -lm |
230 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 231 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
231 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 232 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
233 | TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | ||
232 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) | 234 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) |
233 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) | 235 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) |
234 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) | 236 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) |
@@ -243,17 +245,29 @@ else | |||
243 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) | 245 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) |
244 | TARGET_LJARCH= arm | 246 | TARGET_LJARCH= arm |
245 | else | 247 | else |
248 | ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH))) | ||
249 | ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH))) | ||
250 | TARGET_ARCH= -D__AARCH64EB__=1 | ||
251 | endif | ||
252 | TARGET_LJARCH= arm64 | ||
253 | else | ||
246 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) | 254 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) |
255 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
256 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE | ||
257 | else | ||
258 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE | ||
259 | endif | ||
247 | TARGET_LJARCH= ppc | 260 | TARGET_LJARCH= ppc |
248 | else | 261 | else |
249 | ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH))) | ||
250 | TARGET_LJARCH= ppcspe | ||
251 | else | ||
252 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) | 262 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) |
253 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) | 263 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) |
254 | TARGET_ARCH= -D__MIPSEL__=1 | 264 | TARGET_ARCH= -D__MIPSEL__=1 |
255 | endif | 265 | endif |
256 | TARGET_LJARCH= mips | 266 | ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) |
267 | TARGET_LJARCH= mips64 | ||
268 | else | ||
269 | TARGET_LJARCH= mips | ||
270 | endif | ||
257 | else | 271 | else |
258 | $(error Unsupported target architecture) | 272 | $(error Unsupported target architecture) |
259 | endif | 273 | endif |
@@ -267,6 +281,7 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) | |||
267 | TARGET_SYS= PS3 | 281 | TARGET_SYS= PS3 |
268 | TARGET_ARCH+= -D__CELLOS_LV2__ | 282 | TARGET_ARCH+= -D__CELLOS_LV2__ |
269 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 283 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
284 | TARGET_XLIBS+= -lpthread | ||
270 | endif | 285 | endif |
271 | 286 | ||
272 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) | 287 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) |
@@ -320,6 +335,9 @@ ifeq (iOS,$(TARGET_SYS)) | |||
320 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 335 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC |
321 | TARGET_DYNXLDOPTS= | 336 | TARGET_DYNXLDOPTS= |
322 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) | 337 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) |
338 | ifeq (arm64,$(TARGET_LJARCH)) | ||
339 | TARGET_XCFLAGS+= -fno-omit-frame-pointer | ||
340 | endif | ||
323 | else | 341 | else |
324 | ifneq (SunOS,$(TARGET_SYS)) | 342 | ifneq (SunOS,$(TARGET_SYS)) |
325 | ifneq (PS3,$(TARGET_SYS)) | 343 | ifneq (PS3,$(TARGET_SYS)) |
@@ -380,6 +398,11 @@ DASM_XFLAGS= | |||
380 | DASM_AFLAGS= | 398 | DASM_AFLAGS= |
381 | DASM_ARCH= $(TARGET_LJARCH) | 399 | DASM_ARCH= $(TARGET_LJARCH) |
382 | 400 | ||
401 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
402 | DASM_AFLAGS+= -D ENDIAN_LE | ||
403 | else | ||
404 | DASM_AFLAGS+= -D ENDIAN_BE | ||
405 | endif | ||
383 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) | 406 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) |
384 | DASM_AFLAGS+= -D P64 | 407 | DASM_AFLAGS+= -D P64 |
385 | endif | 408 | endif |
@@ -412,13 +435,10 @@ DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subs | |||
412 | ifeq (Windows,$(TARGET_SYS)) | 435 | ifeq (Windows,$(TARGET_SYS)) |
413 | DASM_AFLAGS+= -D WIN | 436 | DASM_AFLAGS+= -D WIN |
414 | endif | 437 | endif |
415 | ifeq (x86,$(TARGET_LJARCH)) | ||
416 | ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH))) | ||
417 | DASM_AFLAGS+= -D SSE | ||
418 | endif | ||
419 | else | ||
420 | ifeq (x64,$(TARGET_LJARCH)) | 438 | ifeq (x64,$(TARGET_LJARCH)) |
421 | DASM_ARCH= x86 | 439 | ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) |
440 | DASM_ARCH= x86 | ||
441 | endif | ||
422 | else | 442 | else |
423 | ifeq (arm,$(TARGET_LJARCH)) | 443 | ifeq (arm,$(TARGET_LJARCH)) |
424 | ifeq (iOS,$(TARGET_SYS)) | 444 | ifeq (iOS,$(TARGET_SYS)) |
@@ -432,13 +452,15 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
432 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) | 452 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) |
433 | DASM_AFLAGS+= -D ROUND | 453 | DASM_AFLAGS+= -D ROUND |
434 | endif | 454 | endif |
435 | ifneq (,$(findstring LJ_ARCH_PPC64 1,$(TARGET_TESTARCH))) | 455 | ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) |
436 | DASM_AFLAGS+= -D GPR64 | 456 | DASM_AFLAGS+= -D GPR64 |
437 | endif | 457 | endif |
438 | ifeq (PS3,$(TARGET_SYS)) | 458 | ifeq (PS3,$(TARGET_SYS)) |
439 | DASM_AFLAGS+= -D PPE -D TOC | 459 | DASM_AFLAGS+= -D PPE -D TOC |
440 | endif | 460 | endif |
441 | endif | 461 | ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) |
462 | DASM_ARCH= ppc64 | ||
463 | endif | ||
442 | endif | 464 | endif |
443 | endif | 465 | endif |
444 | endif | 466 | endif |
@@ -454,7 +476,7 @@ BUILDVM_X= $(BUILDVM_T) | |||
454 | HOST_O= $(MINILUA_O) $(BUILDVM_O) | 476 | HOST_O= $(MINILUA_O) $(BUILDVM_O) |
455 | HOST_T= $(MINILUA_T) $(BUILDVM_T) | 477 | HOST_T= $(MINILUA_T) $(BUILDVM_T) |
456 | 478 | ||
457 | LJVM_S= lj_vm.s | 479 | LJVM_S= lj_vm.S |
458 | LJVM_O= lj_vm.o | 480 | LJVM_O= lj_vm.o |
459 | LJVM_BOUT= $(LJVM_S) | 481 | LJVM_BOUT= $(LJVM_S) |
460 | LJVM_MODE= elfasm | 482 | LJVM_MODE= elfasm |
@@ -463,10 +485,11 @@ LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ | |||
463 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o | 485 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o |
464 | LJLIB_C= $(LJLIB_O:.o=.c) | 486 | LJLIB_C= $(LJLIB_O:.o=.c) |
465 | 487 | ||
466 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \ | 488 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ |
467 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ | 489 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ |
468 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ | 490 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ |
469 | lj_api.o lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | 491 | lj_strfmt.o lj_strfmt_num.o lj_api.o lj_profile.o \ |
492 | lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | ||
470 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ | 493 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ |
471 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ | 494 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ |
472 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ | 495 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ |
@@ -586,6 +609,10 @@ amalg: | |||
586 | clean: | 609 | clean: |
587 | $(HOST_RM) $(ALL_RM) | 610 | $(HOST_RM) $(ALL_RM) |
588 | 611 | ||
612 | libbc: | ||
613 | ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) | ||
614 | $(MAKE) all | ||
615 | |||
589 | depend: | 616 | depend: |
590 | @for file in $(ALL_HDRGEN); do \ | 617 | @for file in $(ALL_HDRGEN); do \ |
591 | test -f $$file || touch $$file; \ | 618 | test -f $$file || touch $$file; \ |
@@ -600,7 +627,7 @@ depend: | |||
600 | test -s $$file || $(HOST_RM) $$file; \ | 627 | test -s $$file || $(HOST_RM) $$file; \ |
601 | done | 628 | done |
602 | 629 | ||
603 | .PHONY: default all amalg clean depend | 630 | .PHONY: default all amalg clean libbc depend |
604 | 631 | ||
605 | ############################################################################## | 632 | ############################################################################## |
606 | # Rules for generated files. | 633 | # Rules for generated files. |
@@ -610,7 +637,7 @@ $(MINILUA_T): $(MINILUA_O) | |||
610 | $(E) "HOSTLINK $@" | 637 | $(E) "HOSTLINK $@" |
611 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) | 638 | $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) |
612 | 639 | ||
613 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) | 640 | host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua |
614 | $(E) "DYNASM $@" | 641 | $(E) "DYNASM $@" |
615 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) | 642 | $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) |
616 | 643 | ||
@@ -657,10 +684,10 @@ lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c | |||
657 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 684 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< |
658 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 685 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< |
659 | 686 | ||
660 | %.o: %.s | 687 | %.o: %.S |
661 | $(E) "ASM $@" | 688 | $(E) "ASM $@" |
662 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 689 | $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< |
663 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 690 | $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< |
664 | 691 | ||
665 | $(LUAJIT_O): | 692 | $(LUAJIT_O): |
666 | $(E) "CC $@" | 693 | $(E) "CC $@" |