diff options
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 127 |
1 files changed, 88 insertions, 39 deletions
diff --git a/src/Makefile b/src/Makefile index d841abf8..bac0341e 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | ############################################################################## | 11 | ############################################################################## |
| 12 | 12 | ||
| 13 | MAJVER= 2 | 13 | MAJVER= 2 |
| 14 | MINVER= 0 | 14 | MINVER= 1 |
| 15 | ABIVER= 5.1 | 15 | ABIVER= 5.1 |
| 16 | NODOTABIVER= 51 | 16 | NODOTABIVER= 51 |
| 17 | 17 | ||
| @@ -43,17 +43,14 @@ CCOPT= -O2 -fomit-frame-pointer | |||
| 43 | # | 43 | # |
| 44 | # Target-specific compiler options: | 44 | # Target-specific compiler options: |
| 45 | # | 45 | # |
| 46 | # x86 only: it's recommended to compile at least for i686. Better yet, | ||
| 47 | # compile for an architecture that has SSE2, too (-msse -msse2). | ||
| 48 | # | ||
| 49 | # x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute | 46 | # 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 | 47 | # the binaries to a different machine you could also use: -march=native |
| 51 | # | 48 | # |
| 52 | CCOPT_x86= -march=i686 | 49 | CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse |
| 53 | CCOPT_x64= | 50 | CCOPT_x64= |
| 54 | CCOPT_arm= | 51 | CCOPT_arm= |
| 52 | CCOPT_arm64= | ||
| 55 | CCOPT_ppc= | 53 | CCOPT_ppc= |
| 56 | CCOPT_ppcspe= | ||
| 57 | CCOPT_mips= | 54 | CCOPT_mips= |
| 58 | # | 55 | # |
| 59 | CCDEBUG= | 56 | CCDEBUG= |
| @@ -112,6 +109,9 @@ XCFLAGS= | |||
| 112 | #XCFLAGS+= -DLUAJIT_NUMMODE=1 | 109 | #XCFLAGS+= -DLUAJIT_NUMMODE=1 |
| 113 | #XCFLAGS+= -DLUAJIT_NUMMODE=2 | 110 | #XCFLAGS+= -DLUAJIT_NUMMODE=2 |
| 114 | # | 111 | # |
| 112 | # Disable LJ_GC64 mode for x64. | ||
| 113 | #XCFLAGS+= -DLUAJIT_DISABLE_GC64 | ||
| 114 | # | ||
| 115 | ############################################################################## | 115 | ############################################################################## |
| 116 | 116 | ||
| 117 | ############################################################################## | 117 | ############################################################################## |
| @@ -123,15 +123,14 @@ XCFLAGS= | |||
| 123 | # | 123 | # |
| 124 | # Use the system provided memory allocator (realloc) instead of the | 124 | # Use the system provided memory allocator (realloc) instead of the |
| 125 | # bundled memory allocator. This is slower, but sometimes helpful for | 125 | # bundled memory allocator. This is slower, but sometimes helpful for |
| 126 | # debugging. This option cannot be enabled on x64, since realloc usually | 126 | # debugging. This option cannot be enabled on x64 without GC64, since |
| 127 | # doesn't return addresses in the right address range. | 127 | # realloc usually doesn't return addresses in the right address range. |
| 128 | # OTOH this option is mandatory for Valgrind's memcheck tool on x64 and | 128 | # OTOH this option is mandatory for Valgrind's memcheck tool on x64 and |
| 129 | # the only way to get useful results from it for all other architectures. | 129 | # the only way to get useful results from it for all other architectures. |
| 130 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 130 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
| 131 | # | 131 | # |
| 132 | # This define is required to run LuaJIT under Valgrind. The Valgrind | 132 | # This define is required to run LuaJIT under Valgrind. The Valgrind |
| 133 | # header files must be installed. You should enable debug information, too. | 133 | # header files must be installed. You should enable debug information, too. |
| 134 | # Use --suppressions=lj.supp to avoid some false positives. | ||
| 135 | #XCFLAGS+= -DLUAJIT_USE_VALGRIND | 134 | #XCFLAGS+= -DLUAJIT_USE_VALGRIND |
| 136 | # | 135 | # |
| 137 | # This is the client for the GDB JIT API. GDB 7.0 or higher is required | 136 | # This is the client for the GDB JIT API. GDB 7.0 or higher is required |
| @@ -188,7 +187,8 @@ endif | |||
| 188 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 187 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
| 189 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- | 188 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- |
| 190 | 189 | ||
| 191 | CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) | 190 | ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) |
| 191 | CCOPTIONS= $(CCDEBUG) $(ASOPTIONS) | ||
| 192 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) | 192 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) |
| 193 | 193 | ||
| 194 | HOST_CC= $(CC) | 194 | HOST_CC= $(CC) |
| @@ -228,6 +228,7 @@ TARGET_XLDFLAGS= | |||
| 228 | TARGET_XLIBS= -lm | 228 | TARGET_XLIBS= -lm |
| 229 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 229 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
| 230 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 230 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
| 231 | TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | ||
| 231 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) | 232 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) |
| 232 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) | 233 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) |
| 233 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) | 234 | TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) |
| @@ -242,17 +243,29 @@ else | |||
| 242 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) | 243 | ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) |
| 243 | TARGET_LJARCH= arm | 244 | TARGET_LJARCH= arm |
| 244 | else | 245 | else |
| 246 | ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH))) | ||
| 247 | ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH))) | ||
| 248 | TARGET_ARCH= -D__AARCH64EB__=1 | ||
| 249 | endif | ||
| 250 | TARGET_LJARCH= arm64 | ||
| 251 | else | ||
| 245 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) | 252 | ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) |
| 253 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
| 254 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE | ||
| 255 | else | ||
| 256 | TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE | ||
| 257 | endif | ||
| 246 | TARGET_LJARCH= ppc | 258 | TARGET_LJARCH= ppc |
| 247 | else | 259 | else |
| 248 | ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH))) | ||
| 249 | TARGET_LJARCH= ppcspe | ||
| 250 | else | ||
| 251 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) | 260 | ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) |
| 252 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) | 261 | ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) |
| 253 | TARGET_ARCH= -D__MIPSEL__=1 | 262 | TARGET_ARCH= -D__MIPSEL__=1 |
| 254 | endif | 263 | endif |
| 255 | TARGET_LJARCH= mips | 264 | ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) |
| 265 | TARGET_LJARCH= mips64 | ||
| 266 | else | ||
| 267 | TARGET_LJARCH= mips | ||
| 268 | endif | ||
| 256 | else | 269 | else |
| 257 | $(error Unsupported target architecture) | 270 | $(error Unsupported target architecture) |
| 258 | endif | 271 | endif |
| @@ -266,6 +279,7 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) | |||
| 266 | TARGET_SYS= PS3 | 279 | TARGET_SYS= PS3 |
| 267 | TARGET_ARCH+= -D__CELLOS_LV2__ | 280 | TARGET_ARCH+= -D__CELLOS_LV2__ |
| 268 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 281 | TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
| 282 | TARGET_XLIBS+= -lpthread | ||
| 269 | endif | 283 | endif |
| 270 | 284 | ||
| 271 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) | 285 | TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) |
| @@ -285,6 +299,9 @@ endif | |||
| 285 | ifneq (,$(LMULTILIB)) | 299 | ifneq (,$(LMULTILIB)) |
| 286 | TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\" | 300 | TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\" |
| 287 | endif | 301 | endif |
| 302 | ifneq (,$(INSTALL_LJLIBD)) | ||
| 303 | TARGET_XCFLAGS+= -DLUA_LJDIR=\"$(INSTALL_LJLIBD)\" | ||
| 304 | endif | ||
| 288 | 305 | ||
| 289 | ############################################################################## | 306 | ############################################################################## |
| 290 | # Target system detection. | 307 | # Target system detection. |
| @@ -305,20 +322,27 @@ ifeq (Darwin,$(TARGET_SYS)) | |||
| 305 | $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) | 322 | $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) |
| 306 | endif | 323 | endif |
| 307 | TARGET_STRIP+= -x | 324 | TARGET_STRIP+= -x |
| 308 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 325 | TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL |
| 326 | TARGET_XSHLDFLAGS= -dynamiclib -undefined dynamic_lookup -fPIC | ||
| 309 | TARGET_DYNXLDOPTS= | 327 | TARGET_DYNXLDOPTS= |
| 310 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255 | 328 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255 |
| 311 | ifeq (x64,$(TARGET_LJARCH)) | ||
| 312 | TARGET_XLDFLAGS+= -pagezero_size 10000 -image_base 100000000 | ||
| 313 | TARGET_XSHLDFLAGS+= -image_base 7fff04c4a000 | ||
| 314 | endif | ||
| 315 | else | 329 | else |
| 316 | ifeq (iOS,$(TARGET_SYS)) | 330 | ifeq (iOS,$(TARGET_SYS)) |
| 317 | TARGET_STRIP+= -x | 331 | TARGET_STRIP+= -x |
| 318 | TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC | 332 | TARGET_XSHLDFLAGS= -dynamiclib -undefined dynamic_lookup -fPIC |
| 319 | TARGET_DYNXLDOPTS= | 333 | TARGET_DYNXLDOPTS= |
| 320 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255 | 334 | TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255 |
| 335 | ifeq (arm64,$(TARGET_LJARCH)) | ||
| 336 | TARGET_XCFLAGS+= -fno-omit-frame-pointer | ||
| 337 | endif | ||
| 321 | else | 338 | else |
| 339 | ifeq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) | ||
| 340 | # Find out whether the target toolchain always generates unwind tables. | ||
| 341 | TARGET_TESTUNWIND=$(shell exec 2>/dev/null; echo 'extern void b(void);int a(void){b();return 0;}' | $(TARGET_CC) -c -x c - -o tmpunwind.o && { grep -qa -e eh_frame -e __unwind_info tmpunwind.o || grep -qU -e eh_frame -e __unwind_info tmpunwind.o; } && echo E; rm -f tmpunwind.o) | ||
| 342 | ifneq (,$(findstring E,$(TARGET_TESTUNWIND))) | ||
| 343 | TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL | ||
| 344 | endif | ||
| 345 | endif | ||
| 322 | ifneq (SunOS,$(TARGET_SYS)) | 346 | ifneq (SunOS,$(TARGET_SYS)) |
| 323 | ifneq (PS3,$(TARGET_SYS)) | 347 | ifneq (PS3,$(TARGET_SYS)) |
| 324 | TARGET_XLDFLAGS+= -Wl,-E | 348 | TARGET_XLDFLAGS+= -Wl,-E |
| @@ -330,6 +354,9 @@ else | |||
| 330 | ifeq (GNU/kFreeBSD,$(TARGET_SYS)) | 354 | ifeq (GNU/kFreeBSD,$(TARGET_SYS)) |
| 331 | TARGET_XLIBS+= -ldl | 355 | TARGET_XLIBS+= -ldl |
| 332 | endif | 356 | endif |
| 357 | ifeq (GNU,$(TARGET_SYS)) | ||
| 358 | TARGET_XLIBS+= -ldl | ||
| 359 | endif | ||
| 333 | endif | 360 | endif |
| 334 | endif | 361 | endif |
| 335 | endif | 362 | endif |
| @@ -345,7 +372,7 @@ ifneq ($(HOST_SYS),$(TARGET_SYS)) | |||
| 345 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX | 372 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX |
| 346 | else | 373 | else |
| 347 | ifeq (iOS,$(TARGET_SYS)) | 374 | ifeq (iOS,$(TARGET_SYS)) |
| 348 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX | 375 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX -DTARGET_OS_IPHONE=1 |
| 349 | else | 376 | else |
| 350 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER | 377 | HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER |
| 351 | endif | 378 | endif |
| @@ -379,6 +406,11 @@ DASM_XFLAGS= | |||
| 379 | DASM_AFLAGS= | 406 | DASM_AFLAGS= |
| 380 | DASM_ARCH= $(TARGET_LJARCH) | 407 | DASM_ARCH= $(TARGET_LJARCH) |
| 381 | 408 | ||
| 409 | ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) | ||
| 410 | DASM_AFLAGS+= -D ENDIAN_LE | ||
| 411 | else | ||
| 412 | DASM_AFLAGS+= -D ENDIAN_BE | ||
| 413 | endif | ||
| 382 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) | 414 | ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) |
| 383 | DASM_AFLAGS+= -D P64 | 415 | DASM_AFLAGS+= -D P64 |
| 384 | endif | 416 | endif |
| @@ -407,23 +439,35 @@ ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) | |||
| 407 | DASM_AFLAGS+= -D NO_UNWIND | 439 | DASM_AFLAGS+= -D NO_UNWIND |
| 408 | TARGET_ARCH+= -DLUAJIT_NO_UNWIND | 440 | TARGET_ARCH+= -DLUAJIT_NO_UNWIND |
| 409 | endif | 441 | endif |
| 442 | ifneq (,$(findstring LJ_ABI_PAUTH 1,$(TARGET_TESTARCH))) | ||
| 443 | DASM_AFLAGS+= -D PAUTH | ||
| 444 | TARGET_ARCH+= -DLJ_ABI_PAUTH=1 | ||
| 445 | endif | ||
| 446 | ifneq (,$(findstring LJ_ABI_BRANCH_TRACK 1,$(TARGET_TESTARCH))) | ||
| 447 | DASM_AFLAGS+= -D BRANCH_TRACK | ||
| 448 | TARGET_ARCH+= -DLJ_ABI_BRANCH_TRACK=1 | ||
| 449 | endif | ||
| 450 | ifneq (,$(findstring LJ_ABI_SHADOW_STACK 1,$(TARGET_TESTARCH))) | ||
| 451 | DASM_AFLAGS+= -D SHADOW_STACK | ||
| 452 | TARGET_ARCH+= -DLJ_ABI_SHADOW_STACK=1 | ||
| 453 | endif | ||
| 410 | DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH)))) | 454 | DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH)))) |
| 411 | ifeq (Windows,$(TARGET_SYS)) | 455 | ifeq (Windows,$(TARGET_SYS)) |
| 412 | DASM_AFLAGS+= -D WIN | 456 | DASM_AFLAGS+= -D WIN |
| 413 | endif | 457 | endif |
| 414 | ifeq (x86,$(TARGET_LJARCH)) | ||
| 415 | ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH))) | ||
| 416 | DASM_AFLAGS+= -D SSE | ||
| 417 | endif | ||
| 418 | else | ||
| 419 | ifeq (x64,$(TARGET_LJARCH)) | 458 | ifeq (x64,$(TARGET_LJARCH)) |
| 420 | DASM_ARCH= x86 | 459 | ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) |
| 460 | DASM_ARCH= x86 | ||
| 461 | endif | ||
| 421 | else | 462 | else |
| 422 | ifeq (arm,$(TARGET_LJARCH)) | 463 | ifeq (arm,$(TARGET_LJARCH)) |
| 423 | ifeq (iOS,$(TARGET_SYS)) | 464 | ifeq (iOS,$(TARGET_SYS)) |
| 424 | DASM_AFLAGS+= -D IOS | 465 | DASM_AFLAGS+= -D IOS |
| 425 | endif | 466 | endif |
| 426 | else | 467 | else |
| 468 | ifneq (,$(findstring LJ_TARGET_MIPSR6 ,$(TARGET_TESTARCH))) | ||
| 469 | DASM_AFLAGS+= -D MIPSR6 | ||
| 470 | endif | ||
| 427 | ifeq (ppc,$(TARGET_LJARCH)) | 471 | ifeq (ppc,$(TARGET_LJARCH)) |
| 428 | ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) | 472 | ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) |
| 429 | DASM_AFLAGS+= -D SQRT | 473 | DASM_AFLAGS+= -D SQRT |
| @@ -431,7 +475,7 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
| 431 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) | 475 | ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) |
| 432 | DASM_AFLAGS+= -D ROUND | 476 | DASM_AFLAGS+= -D ROUND |
| 433 | endif | 477 | endif |
| 434 | ifneq (,$(findstring LJ_ARCH_PPC64 1,$(TARGET_TESTARCH))) | 478 | ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) |
| 435 | DASM_AFLAGS+= -D GPR64 | 479 | DASM_AFLAGS+= -D GPR64 |
| 436 | endif | 480 | endif |
| 437 | ifeq (PS3,$(TARGET_SYS)) | 481 | ifeq (PS3,$(TARGET_SYS)) |
| @@ -440,7 +484,6 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
| 440 | endif | 484 | endif |
| 441 | endif | 485 | endif |
| 442 | endif | 486 | endif |
| 443 | endif | ||
| 444 | 487 | ||
| 445 | DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) | 488 | DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) |
| 446 | DASM_DASC= vm_$(DASM_ARCH).dasc | 489 | DASM_DASC= vm_$(DASM_ARCH).dasc |
| @@ -461,19 +504,22 @@ BUILDVM_X= $(BUILDVM_T) | |||
| 461 | HOST_O= $(MINILUA_O) $(BUILDVM_O) | 504 | HOST_O= $(MINILUA_O) $(BUILDVM_O) |
| 462 | HOST_T= $(MINILUA_T) $(BUILDVM_T) | 505 | HOST_T= $(MINILUA_T) $(BUILDVM_T) |
| 463 | 506 | ||
| 464 | LJVM_S= lj_vm.s | 507 | LJVM_S= lj_vm.S |
| 465 | LJVM_O= lj_vm.o | 508 | LJVM_O= lj_vm.o |
| 466 | LJVM_BOUT= $(LJVM_S) | 509 | LJVM_BOUT= $(LJVM_S) |
| 467 | LJVM_MODE= elfasm | 510 | LJVM_MODE= elfasm |
| 468 | 511 | ||
| 469 | LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ | 512 | LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ |
| 470 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o | 513 | lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o \ |
| 514 | lib_buffer.o | ||
| 471 | LJLIB_C= $(LJLIB_O:.o=.c) | 515 | LJLIB_C= $(LJLIB_O:.o=.c) |
| 472 | 516 | ||
| 473 | LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o \ | 517 | LJCORE_O= lj_assert.o lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ |
| 474 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ | 518 | lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ |
| 475 | lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ | 519 | lj_prng.o lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o \ |
| 476 | lj_api.o lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | 520 | lj_strscan.o lj_strfmt.o lj_strfmt_num.o lj_serialize.o \ |
| 521 | lj_api.o lj_profile.o \ | ||
| 522 | lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ | ||
| 477 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ | 523 | lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ |
| 478 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ | 524 | lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ |
| 479 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ | 525 | lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ |
| @@ -588,12 +634,15 @@ E= @echo | |||
| 588 | default all: $(TARGET_T) | 634 | default all: $(TARGET_T) |
| 589 | 635 | ||
| 590 | amalg: | 636 | amalg: |
| 591 | @grep "^[+|]" ljamalg.c | ||
| 592 | $(MAKE) all "LJCORE_O=ljamalg.o" | 637 | $(MAKE) all "LJCORE_O=ljamalg.o" |
| 593 | 638 | ||
| 594 | clean: | 639 | clean: |
| 595 | $(HOST_RM) $(ALL_RM) | 640 | $(HOST_RM) $(ALL_RM) |
| 596 | 641 | ||
| 642 | libbc: | ||
| 643 | ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) | ||
| 644 | $(MAKE) all | ||
| 645 | |||
| 597 | depend: | 646 | depend: |
| 598 | @for file in $(ALL_HDRGEN); do \ | 647 | @for file in $(ALL_HDRGEN); do \ |
| 599 | test -f $$file || touch $$file; \ | 648 | test -f $$file || touch $$file; \ |
| @@ -608,7 +657,7 @@ depend: | |||
| 608 | test -s $$file || $(HOST_RM) $$file; \ | 657 | test -s $$file || $(HOST_RM) $$file; \ |
| 609 | done | 658 | done |
| 610 | 659 | ||
| 611 | .PHONY: default all amalg clean depend | 660 | .PHONY: default all amalg clean libbc depend |
| 612 | 661 | ||
| 613 | ############################################################################## | 662 | ############################################################################## |
| 614 | # Rules for generated files. | 663 | # Rules for generated files. |
| @@ -670,10 +719,10 @@ lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c | |||
| 670 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 719 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< |
| 671 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 720 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< |
| 672 | 721 | ||
| 673 | %.o: %.s | 722 | %.o: %.S |
| 674 | $(E) "ASM $@" | 723 | $(E) "ASM $@" |
| 675 | $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< | 724 | $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< |
| 676 | $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< | 725 | $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< |
| 677 | 726 | ||
| 678 | $(LUAJIT_O): | 727 | $(LUAJIT_O): |
| 679 | $(E) "CC $@" | 728 | $(E) "CC $@" |
