2009-12-08 18:46:35 +00:00
|
|
|
##############################################################################
|
|
|
|
# LuaJIT Makefile. Requires GNU Make.
|
|
|
|
#
|
|
|
|
# Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
|
|
|
|
# Also works with MinGW and Cygwin on Windows.
|
|
|
|
# Please check msvcbuild.bat for building with MSVC on Windows.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h
|
|
|
|
##############################################################################
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
MAJVER= 2
|
|
|
|
MINVER= 0
|
|
|
|
RELVER= 0
|
|
|
|
ABIVER= 5.1
|
|
|
|
NODOTABIVER= 51
|
|
|
|
|
2009-12-08 18:46:35 +00:00
|
|
|
##############################################################################
|
|
|
|
# Compiler options: change them as needed. This mainly affects the speed of
|
|
|
|
# the JIT compiler itself, not the speed of the JIT compiled code.
|
|
|
|
# Turn any of the optional settings on by removing the '#' in front of them.
|
2009-12-08 18:49:20 +00:00
|
|
|
# You need to 'make clean' and 'make' again, if you change any options.
|
2009-12-08 18:46:35 +00:00
|
|
|
#
|
|
|
|
# Note: LuaJIT can only be compiled for x86, and not for x64 (yet)!
|
|
|
|
# In the meantime, the x86 binary runs fine under a x64 OS.
|
|
|
|
#
|
|
|
|
# It's recommended to compile at least for i686. By default the assembler part
|
|
|
|
# of the interpreter makes use of CMOV/FCOMI*/FUCOMI* instructions, anyway.
|
|
|
|
CC= gcc -m32 -march=i686
|
|
|
|
# Use this for GCC 4.2 or higher if you don't intend to distribute the
|
|
|
|
# binaries to a different machine:
|
|
|
|
#CC= gcc -m32 -march=native
|
|
|
|
#
|
|
|
|
# Since the assembler part does NOT maintain a frame pointer, it's pointless
|
|
|
|
# to slow down the C part by not omitting it. Debugging and tracebacks are
|
|
|
|
# not affected -- the assembler part has frame unwind information and GCC
|
|
|
|
# emits it with -g (see CCDEBUG below).
|
|
|
|
CCOPT= -O2 -fomit-frame-pointer
|
|
|
|
# Use this if you want to generate a smaller binary (but it's slower):
|
|
|
|
#CCOPT= -Os -fomit-frame-pointer
|
|
|
|
# Note: it's no longer recommended to use -O3 with GCC 4.x.
|
|
|
|
# The I-Cache bloat usually outweighs the benefits from aggressive inlining.
|
|
|
|
#
|
|
|
|
CCDEBUG=
|
|
|
|
# Uncomment the next line to generate debug information:
|
|
|
|
#CCDEBUG= -g
|
|
|
|
#
|
|
|
|
CCWARN= -Wall
|
|
|
|
# Uncomment the next line to enable more warnings:
|
|
|
|
#CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Compile time definitions: change them as needed, but make sure you force
|
|
|
|
# a full recompile with "make clean", followed by "make".
|
|
|
|
# Note that most of these are NOT suitable for benchmarking or release mode!
|
|
|
|
XCFLAGS=
|
|
|
|
#
|
|
|
|
# Disable the use of CMOV and FCOMI*/FUCOMI* instructions in the interpreter.
|
|
|
|
# This is only necessary if you intend to run the code on REALLY ANCIENT CPUs
|
|
|
|
# (before Pentium Pro, or on the VIA C3). This generally slows down the
|
|
|
|
# interpreter. Don't bother if your OS wouldn't run on them, anyway.
|
|
|
|
#XCFLAGS+= -DLUAJIT_CPU_NOCMOV
|
|
|
|
#
|
|
|
|
# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter:
|
|
|
|
#XCFLAGS+= -DLUAJIT_DISABLE_JIT
|
|
|
|
#
|
|
|
|
# Use the system provided memory allocator (realloc) instead of the
|
|
|
|
# bundled memory allocator. This is slower, but sometimes helpful for
|
|
|
|
# debugging. It's mandatory for Valgrind's memcheck tool, too.
|
|
|
|
#XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
|
|
|
|
#
|
|
|
|
# This define is required to run LuaJIT under Valgrind. The Valgrind
|
|
|
|
# header files must be installed. You should enable debug information, too.
|
|
|
|
#XCFLAGS+= -DLUAJIT_USE_VALGRIND
|
|
|
|
#
|
|
|
|
# This is the client for the GDB JIT API. GDB 7.0 or higher is required
|
|
|
|
# to make use of it. See lj_gdbjit.c for details. Enabling this causes
|
|
|
|
# a non-negligible overhead, even when not running under GDB.
|
|
|
|
#XCFLAGS+= -DLUAJIT_USE_GDBJIT
|
|
|
|
#
|
|
|
|
# Turn on assertions for the Lua/C API to debug problems with lua_* calls.
|
|
|
|
# This is rather slow -- use only while developing C libraries/embeddings.
|
|
|
|
#XCFLAGS+= -DLUA_USE_APICHECK
|
|
|
|
#
|
|
|
|
# Turn on assertions for the whole LuaJIT VM. This significantly slows down
|
|
|
|
# everything. Use only if you suspect a problem with LuaJIT itself.
|
|
|
|
#XCFLAGS+= -DLUA_USE_ASSERT
|
|
|
|
#
|
|
|
|
##############################################################################
|
2009-12-08 18:49:20 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Build mode: override the mode as needed. Default is mixed mode on POSIX.
|
|
|
|
# On Windows this is the same as dynamic mode.
|
|
|
|
#
|
|
|
|
# Mixed mode creates a static + dynamic library and a statically linked luajit.
|
|
|
|
BUILDMODE= mixed
|
|
|
|
#
|
|
|
|
# Static mode creates a static library and a statically linked luajit.
|
|
|
|
#BUILDMODE= static
|
|
|
|
#
|
|
|
|
# Dynamic mode creates a dynamic library and a dynamically linked luajit.
|
|
|
|
# Note: this executable will only run when the library is installed!
|
|
|
|
#BUILDMODE= dynamic
|
|
|
|
##############################################################################
|
2009-12-08 18:46:35 +00:00
|
|
|
# You probably don't need to change anything below this line.
|
|
|
|
##############################################################################
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Flags and options for host and target.
|
|
|
|
##############################################################################
|
|
|
|
|
2009-12-08 21:27:14 +00:00
|
|
|
# You may also override the following variables at the make command line:
|
|
|
|
# CC HOST_CC STATIC_CC DYNAMIC_CC
|
|
|
|
# CFLAGS HOST_CFLAGS TARGET_CFLAGS
|
|
|
|
# LDFLAGS HOST_LDFLAGS TARGET_LDFLAGS TARGET_SHLDFLAGS
|
|
|
|
# LIBS HOST_LIBS TARGET_LIBS
|
|
|
|
# CROSS HOST_SYS TARGET_SYS
|
|
|
|
#
|
|
|
|
# Cross-compilation example: make CROSS=i586-mingw32msvc- TARGET_SYS=Windows
|
|
|
|
|
|
|
|
CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS)
|
2009-12-08 18:46:35 +00:00
|
|
|
LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
|
|
|
|
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET))
|
|
|
|
|
2009-12-08 18:46:35 +00:00
|
|
|
HOST_CC= $(CC)
|
|
|
|
HOST_RM= rm -f
|
2009-12-08 18:49:20 +00:00
|
|
|
# NOTE: The LuaJIT distribution comes with a pre-generated buildvm_*.h.
|
|
|
|
# You DO NOT NEED an installed copy of (plain) Lua 5.1 to run DynASM unless
|
|
|
|
# you want to MODIFY the corresponding *.dasc file. You can also use LuaJIT
|
|
|
|
# itself (bootstrapped from the pre-generated file) to run DynASM of course.
|
|
|
|
HOST_LUA= lua
|
|
|
|
|
2009-12-08 18:46:35 +00:00
|
|
|
HOST_XCFLAGS=
|
|
|
|
HOST_XLDFLAGS=
|
|
|
|
HOST_XLIBS=
|
2009-12-08 21:27:14 +00:00
|
|
|
HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS)
|
|
|
|
HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS)
|
|
|
|
HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS)
|
2009-12-08 18:49:20 +00:00
|
|
|
|
|
|
|
STATIC_CC = $(CROSS)$(CC)
|
|
|
|
DYNAMIC_CC = $(CROSS)$(CC) -fPIC
|
|
|
|
TARGET_CC= $(STATIC_CC)
|
|
|
|
TARGET_STCC= $(STATIC_CC)
|
|
|
|
TARGET_DYNCC= $(DYNAMIC_CC)
|
|
|
|
TARGET_LD= $(CROSS)$(CC)
|
|
|
|
TARGET_AR= $(CROSS)ar rcus
|
|
|
|
TARGET_STRIP= $(CROSS)strip
|
|
|
|
|
|
|
|
TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
|
|
|
|
TARGET_DYLIBNAME= libluajit-$(NODOTABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
|
|
|
|
TARGET_DLLNAME= lua$(NODOTABIVER).dll
|
|
|
|
TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
|
|
|
|
TARGET_DYNXLDOPTS=
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE
|
|
|
|
TARGET_XLDFLAGS=
|
|
|
|
TARGET_XLIBS= -lm
|
|
|
|
TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_ARCH) $(TARGET_CFLAGS)
|
|
|
|
TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_LDFLAGS)
|
|
|
|
TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_SHLDFLAGS)
|
|
|
|
TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_XCFLAGS+= -fno-stack-protector
|
2009-12-08 18:46:35 +00:00
|
|
|
endif
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
ifneq (,$(PREFIX))
|
|
|
|
ifneq (/usr/local,$(PREFIX))
|
|
|
|
TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
|
|
|
|
ifneq (/usr,$(PREFIX))
|
|
|
|
TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# System detection.
|
|
|
|
##############################################################################
|
|
|
|
|
2009-12-08 18:46:35 +00:00
|
|
|
ifneq (,$(findstring Windows,$(OS)))
|
2009-12-08 18:49:20 +00:00
|
|
|
HOST_SYS= Windows
|
2009-12-08 18:46:35 +00:00
|
|
|
else
|
2009-12-08 18:49:20 +00:00
|
|
|
HOST_SYS:= $(shell uname -s)
|
2009-12-08 18:46:35 +00:00
|
|
|
ifneq (,$(findstring CYGWIN,$(TARGET_SYS)))
|
2009-12-08 18:49:20 +00:00
|
|
|
HOST_SYS= Windows
|
2009-12-08 18:46:35 +00:00
|
|
|
endif
|
|
|
|
endif
|
2009-12-08 18:49:20 +00:00
|
|
|
ifeq (Windows,$(HOST_SYS))
|
|
|
|
HOST_RM= del
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
TARGET_SYS= $(HOST_SYS)
|
2009-12-08 18:46:35 +00:00
|
|
|
ifeq (Windows,$(TARGET_SYS))
|
2009-12-08 18:49:20 +00:00
|
|
|
TARGET_STRIP+= --strip-unneeded
|
|
|
|
TARGET_XSHLDFLAGS= -shared
|
|
|
|
TARGET_DYNXLDOPTS=
|
2009-12-08 18:46:35 +00:00
|
|
|
else
|
|
|
|
ifeq (Darwin,$(TARGET_SYS))
|
2009-12-08 18:49:20 +00:00
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.4
|
|
|
|
TARGET_STRIP+= -x
|
|
|
|
TARGET_AR+= 2>/dev/null
|
|
|
|
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
|
|
|
ifneq (,$(TARGET_DYNXLDOPTS))
|
|
|
|
TARGET_DYNXLDOPTS=
|
|
|
|
TARGET_XSHLDFLAGS+= -install_name $(PREFIX)/lib/$(TARGET_DYLIBNAME)
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
else
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_XLDFLAGS+= -Wl,-E
|
2009-12-08 18:49:20 +00:00
|
|
|
ifeq (Linux,$(TARGET_SYS))
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_XLIBS+= -ldl
|
2009-12-08 18:49:20 +00:00
|
|
|
endif
|
2009-12-20 17:41:55 +00:00
|
|
|
ifeq (GNU/kFreeBSD,$(TARGET_SYS))
|
|
|
|
TARGET_XLIBS+= -ldl
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(CCDEBUG))
|
|
|
|
TARGET_STRIP= @:
|
|
|
|
endif
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Files and pathnames.
|
|
|
|
##############################################################################
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
DASM_DIR= ../dynasm
|
2009-12-08 18:49:20 +00:00
|
|
|
DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua
|
2009-12-08 18:46:35 +00:00
|
|
|
DASM_FLAGS=
|
|
|
|
DASM_DISTFLAGS= -LN
|
|
|
|
|
|
|
|
BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o
|
|
|
|
BUILDVM_T= buildvm
|
2009-12-08 18:49:20 +00:00
|
|
|
BUILDVM_X= ./$(BUILDVM_T)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
HOST_O= $(BUILDVM_O)
|
|
|
|
HOST_T= $(BUILDVM_T)
|
|
|
|
|
|
|
|
LJVM_S= lj_vm.s
|
|
|
|
LJVM_O= lj_vm.o
|
|
|
|
LJVM_BOUT= $(LJVM_S)
|
2009-12-08 20:28:49 +00:00
|
|
|
LJVM_MODE= elfasm
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \
|
|
|
|
lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o
|
|
|
|
LJLIB_C= $(LJLIB_O:.o=.c)
|
|
|
|
|
|
|
|
LJCORE_O= lj_gc.o lj_err.o lj_ctype.o lj_bc.o lj_obj.o \
|
|
|
|
lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o \
|
|
|
|
lj_state.o lj_dispatch.o lj_vmevent.o lj_api.o \
|
|
|
|
lj_lex.o lj_parse.o \
|
|
|
|
lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \
|
|
|
|
lj_opt_dce.o lj_opt_loop.o \
|
|
|
|
lj_mcode.o lj_snap.o lj_record.o lj_asm.o lj_trace.o lj_gdbjit.o \
|
|
|
|
lj_lib.o lj_alloc.o lib_aux.o \
|
|
|
|
$(LJLIB_O) lib_init.o
|
|
|
|
|
|
|
|
LJVMCORE_O= $(LJVM_O) $(LJCORE_O)
|
2009-12-08 18:49:20 +00:00
|
|
|
LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o)
|
|
|
|
|
|
|
|
LIB_VMDEF= ../lib/vmdef.lua
|
|
|
|
LIB_VMDEFP= $(LIB_VMDEF)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
LUAJIT_O= luajit.o
|
2009-12-08 18:49:20 +00:00
|
|
|
LUAJIT_A= libluajit.a
|
|
|
|
LUAJIT_SO= libluajit.so
|
2009-12-08 18:46:35 +00:00
|
|
|
LUAJIT_T= luajit
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T)
|
|
|
|
ALL_GEN= $(LJVM_S) lj_ffdef.h lj_libdef.h lj_recdef.h $(LIB_VMDEFP) lj_folddef.h
|
|
|
|
ALL_DYNGEN= buildvm_x86.h
|
|
|
|
WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
|
|
|
|
ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Build mode handling.
|
|
|
|
##############################################################################
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
# Mixed mode defaults.
|
|
|
|
TARGET_O= $(LUAJIT_A)
|
|
|
|
TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)
|
|
|
|
TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
ifeq (Windows,$(HOST_SYS))
|
|
|
|
BUILDVM_T= buildvm.exe
|
|
|
|
LIB_VMDEFP= $(subst /,\\,$(LIB_VMDEF))
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
ifeq (Windows,$(TARGET_SYS))
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_DYNCC= $(STATIC_CC)
|
2009-12-08 18:46:35 +00:00
|
|
|
LJVM_BOUT= $(LJVM_O)
|
|
|
|
LJVM_MODE= peobj
|
2009-12-08 18:49:20 +00:00
|
|
|
LUAJIT_SO= $(TARGET_DLLNAME)
|
2009-12-08 18:46:35 +00:00
|
|
|
LUAJIT_T= luajit.exe
|
2009-12-08 18:49:20 +00:00
|
|
|
ifneq ($(HOST_SYS),$(TARGET_SYS))
|
|
|
|
HOST_XCFLAGS+= -malign-double
|
|
|
|
endif
|
|
|
|
# Mixed mode is not supported on Windows. And static mode doesn't work well.
|
|
|
|
# C modules cannot be loaded, because they bind to lua51.dll.
|
|
|
|
ifneq (static,$(BUILDMODE))
|
|
|
|
BUILDMODE= dynamic
|
|
|
|
TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
endif
|
2009-12-08 20:28:49 +00:00
|
|
|
ifeq (Darwin,$(TARGET_SYS))
|
|
|
|
LJVM_MODE= machasm
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
ifeq (static,$(BUILDMODE))
|
|
|
|
TARGET_DYNCC= @:
|
|
|
|
TARGET_T= $(LUAJIT_T)
|
|
|
|
TARGET_DEP= $(LIB_VMDEF)
|
|
|
|
else
|
|
|
|
ifeq (dynamic,$(BUILDMODE))
|
2009-12-08 21:27:14 +00:00
|
|
|
ifneq (Windows,$(TARGET_SYS))
|
|
|
|
TARGET_CC= $(DYNAMIC_CC)
|
|
|
|
endif
|
2009-12-08 18:49:20 +00:00
|
|
|
TARGET_DYNCC= @:
|
|
|
|
LJVMCORE_DYNO= $(LJVMCORE_O)
|
|
|
|
TARGET_O= $(LUAJIT_SO)
|
2009-12-08 21:27:14 +00:00
|
|
|
TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS)
|
2009-12-08 18:49:20 +00:00
|
|
|
else
|
|
|
|
ifeq (Darwin,$(TARGET_SYS))
|
|
|
|
TARGET_DYNCC= @:
|
|
|
|
LJVMCORE_DYNO= $(LJVMCORE_O)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
Q= @
|
|
|
|
E= @echo
|
|
|
|
#Q=
|
|
|
|
#E= @:
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Make targets.
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
default all: $(TARGET_T)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
amalg:
|
|
|
|
@grep "^[+|]" ljamalg.c
|
|
|
|
$(MAKE) all "LJCORE_O=ljamalg.o"
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
clean:
|
|
|
|
$(HOST_RM) $(ALL_RM)
|
|
|
|
|
|
|
|
cleaner:
|
|
|
|
$(HOST_RM) $(ALL_RM) $(ALL_DYNGEN)
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
$(E) "DYNASM $@"
|
|
|
|
$(Q)$(DASM) $(DASM_DISTFLAGS) -o buildvm_x86.h buildvm_x86.dasc
|
|
|
|
|
|
|
|
depend:
|
|
|
|
@test -f lj_ffdef.h || touch lj_ffdef.h
|
|
|
|
@test -f lj_libdef.h || touch lj_libdef.h
|
|
|
|
@test -f lj_recdef.h || touch lj_recdef.h
|
|
|
|
@test -f lj_folddef.h || touch lj_folddef.h
|
|
|
|
@test -f buildvm_x86.h || touch buildvm_x86.h
|
2009-12-08 21:27:14 +00:00
|
|
|
@$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | sed "s|$(DASM_DIR)|\$$(DASM_DIR)|g" >Makefile.dep
|
2009-12-08 18:49:20 +00:00
|
|
|
@test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h
|
|
|
|
@test -s lj_libdef.h || $(HOST_RM) lj_libdef.h
|
|
|
|
@test -s lj_recdef.h || $(HOST_RM) lj_recdef.h
|
|
|
|
@test -s lj_folddef.h || $(HOST_RM) lj_folddef.h
|
|
|
|
@test -s buildvm_x86.h || $(HOST_RM) buildvm_x86.h
|
|
|
|
|
|
|
|
.PHONY: default all amalg clean cleaner distclean depend
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Rules for generated files.
|
2009-12-08 18:46:35 +00:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
buildvm_x86.h: buildvm_x86.dasc
|
|
|
|
$(E) "DYNASM $@"
|
|
|
|
$(Q)$(DASM) $(DASM_FLAGS) -o $@ buildvm_x86.dasc
|
|
|
|
|
|
|
|
$(BUILDVM_T): $(BUILDVM_O)
|
|
|
|
$(E) "HOSTLINK $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
$(LJVM_BOUT): $(BUILDVM_T)
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C)
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
lj_libdef.h: $(BUILDVM_T) $(LJLIB_C)
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
lj_recdef.h: $(BUILDVM_T) $(LJLIB_C)
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C)
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c
|
|
|
|
$(E) "BUILDVM $@"
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
##############################################################################
|
2009-12-08 18:49:20 +00:00
|
|
|
# Object file rules.
|
|
|
|
##############################################################################
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(E) "CC $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $<
|
|
|
|
$(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $<
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
%.o: %.s
|
|
|
|
$(E) "ASM $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $<
|
|
|
|
$(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $<
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
$(LUAJIT_O):
|
|
|
|
$(E) "CC $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $<
|
2009-12-08 18:49:20 +00:00
|
|
|
|
2009-12-08 18:46:35 +00:00
|
|
|
$(HOST_O): %.o: %.c
|
|
|
|
$(E) "HOSTCC $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $<
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
include Makefile.dep
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
##############################################################################
|
|
|
|
# Target file rules.
|
2009-12-08 18:46:35 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
$(LUAJIT_A): $(LJVMCORE_O)
|
|
|
|
$(E) "AR $@"
|
|
|
|
$(Q)$(TARGET_AR) $@ $(LJVMCORE_O)
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
# The dependency on _O, but linking with _DYNO is intentional.
|
|
|
|
$(LUAJIT_SO): $(LJVMCORE_O)
|
|
|
|
$(E) "DYNLINK $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS)
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(TARGET_STRIP) $@
|
2009-12-08 18:46:35 +00:00
|
|
|
|
2009-12-08 18:49:20 +00:00
|
|
|
$(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP)
|
|
|
|
$(E) "LINK $@"
|
2009-12-08 21:27:14 +00:00
|
|
|
$(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS)
|
2009-12-08 18:49:20 +00:00
|
|
|
$(Q)$(TARGET_STRIP) $@
|
|
|
|
$(E) "OK Successfully built LuaJIT"
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
##############################################################################
|