aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Makefile322
-rw-r--r--src/Makefile.dep4
2 files changed, 218 insertions, 108 deletions
diff --git a/src/Makefile b/src/Makefile
index bb1839d1..c0deb774 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,10 +8,17 @@
8# Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h 8# Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h
9############################################################################## 9##############################################################################
10 10
11MAJVER= 2
12MINVER= 0
13RELVER= 0
14ABIVER= 5.1
15NODOTABIVER= 51
16
11############################################################################## 17##############################################################################
12# Compiler options: change them as needed. This mainly affects the speed of 18# Compiler options: change them as needed. This mainly affects the speed of
13# the JIT compiler itself, not the speed of the JIT compiled code. 19# the JIT compiler itself, not the speed of the JIT compiled code.
14# Turn any of the optional settings on by removing the '#' in front of them. 20# Turn any of the optional settings on by removing the '#' in front of them.
21# You need to 'make clean' and 'make' again, if you change any options.
15# 22#
16# Note: LuaJIT can only be compiled for x86, and not for x64 (yet)! 23# Note: LuaJIT can only be compiled for x86, and not for x64 (yet)!
17# In the meantime, the x86 binary runs fine under a x64 OS. 24# In the meantime, the x86 binary runs fine under a x64 OS.
@@ -81,89 +88,142 @@ XCFLAGS=
81#XCFLAGS+= -DLUA_USE_ASSERT 88#XCFLAGS+= -DLUA_USE_ASSERT
82# 89#
83############################################################################## 90##############################################################################
91
92##############################################################################
93# Build mode: override the mode as needed. Default is mixed mode on POSIX.
94# On Windows this is the same as dynamic mode.
95#
96# Mixed mode creates a static + dynamic library and a statically linked luajit.
97BUILDMODE= mixed
98#
99# Static mode creates a static library and a statically linked luajit.
100#BUILDMODE= static
101#
102# Dynamic mode creates a dynamic library and a dynamically linked luajit.
103# Note: this executable will only run when the library is installed!
104#BUILDMODE= dynamic
105##############################################################################
84# You probably don't need to change anything below this line. 106# You probably don't need to change anything below this line.
85############################################################################## 107##############################################################################
86 108
109##############################################################################
110# Flags and options for host and target.
111##############################################################################
112
87CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(CFLAGS) $(XCFLAGS) 113CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(CFLAGS) $(XCFLAGS)
88LDOPTIONS= $(CCDEBUG) $(LDFLAGS) 114LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
89 115
90HOST_CC= $(CC) 116HOST_CC= $(CC)
91HOST_RM= rm -f 117HOST_RM= rm -f
118# NOTE: The LuaJIT distribution comes with a pre-generated buildvm_*.h.
119# You DO NOT NEED an installed copy of (plain) Lua 5.1 to run DynASM unless
120# you want to MODIFY the corresponding *.dasc file. You can also use LuaJIT
121# itself (bootstrapped from the pre-generated file) to run DynASM of course.
122HOST_LUA= lua
123
92HOST_XCFLAGS= 124HOST_XCFLAGS=
93HOST_XLDFLAGS= 125HOST_XLDFLAGS=
94HOST_XLIBS= 126HOST_XLIBS=
127HOST_CFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH)
128HOST_LDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS)
129HOST_LIBS= $(HOST_XLIBS)
130
131# Cross-compilation example: make CROSS=i586-mingw32msvc- TARGET_SYS=Windows
132CROSS=
133STATIC_CC = $(CROSS)$(CC)
134DYNAMIC_CC = $(CROSS)$(CC) -fPIC
135TARGET_CC= $(STATIC_CC)
136TARGET_STCC= $(STATIC_CC)
137TARGET_DYNCC= $(DYNAMIC_CC)
138TARGET_LD= $(CROSS)$(CC)
139TARGET_AR= $(CROSS)ar rcus
140TARGET_STRIP= $(CROSS)strip
141
142TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
143TARGET_DYLIBNAME= libluajit-$(NODOTABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
144TARGET_DLLNAME= lua$(NODOTABIVER).dll
145TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
146TARGET_DYNXLDOPTS=
95 147
96TARGET_CC= $(CC)
97TARGET_STRIP= strip
98TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64
99TARGET_XLDFLAGS=
100TARGET_XSHLDFLAGS= -shared
101TARGET_XLIBS=
102TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET)) 148TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET))
103TARGET_DISABLE= -U_FORTIFY_SOURCE 149TARGET_DISABLE= -U_FORTIFY_SOURCE
104ifneq (,$(findstring stack-protector,$(shell $(CC) -dumpspecs))) 150ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
105 TARGET_DISABLE+= -fno-stack-protector 151 TARGET_DISABLE+= -fno-stack-protector
106endif 152endif
107 153
154TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64
155TARGET_XLDFLAGS=
156TARGET_XLDOPTS=
157TARGET_XLIBS=
158TARGET_CFLAGS= $(CCOPTIONS) $(TARGET_DISABLE) $(TARGET_XCFLAGS)
159TARGET_LDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_XLDOPTS)
160TARGET_SHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS)
161TARGET_LIBS= -lm $(TARGET_XLIBS)
162
163ifneq (,$(PREFIX))
164ifneq (/usr/local,$(PREFIX))
165 TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
166 ifneq (/usr,$(PREFIX))
167 TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
168 endif
169endif
170endif
171
172##############################################################################
173# System detection.
174##############################################################################
175
108ifneq (,$(findstring Windows,$(OS))) 176ifneq (,$(findstring Windows,$(OS)))
109 TARGET_SYS= Windows 177 HOST_SYS= Windows
110else 178else
111 TARGET_SYS:= $(shell uname -s) 179 HOST_SYS:= $(shell uname -s)
112 ifneq (,$(findstring CYGWIN,$(TARGET_SYS))) 180 ifneq (,$(findstring CYGWIN,$(TARGET_SYS)))
113 TARGET_SYS= Windows 181 HOST_SYS= Windows
114 endif 182 endif
115endif 183endif
184ifeq (Windows,$(HOST_SYS))
185 HOST_RM= del
186endif
116 187
117ifeq (Linux,$(TARGET_SYS)) 188TARGET_SYS= $(HOST_SYS)
118 TARGET_XLIBS= -ldl
119 TARGET_XLDFLAGS= -Wl,-E
120else
121ifeq (Windows,$(TARGET_SYS)) 189ifeq (Windows,$(TARGET_SYS))
122 HOST_RM= del 190 TARGET_STRIP+= --strip-unneeded
123 TARGET_STRIP= strip --strip-unneeded 191 TARGET_XSHLDFLAGS= -shared
192 TARGET_DYNXLDOPTS=
124else 193else
125ifeq (Darwin,$(TARGET_SYS)) 194ifeq (Darwin,$(TARGET_SYS))
126 TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup 195 export MACOSX_DEPLOYMENT_TARGET=10.4
127 TARGET_STRIP= strip -x 196 TARGET_STRIP+= -x
128 export MACOSX_DEPLOYMENT_TARGET=10.3 197 TARGET_AR+= 2>/dev/null
198 TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
199 ifneq (,$(TARGET_DYNXLDOPTS))
200 TARGET_DYNXLDOPTS=
201 TARGET_XSHLDFLAGS+= -install_name $(PREFIX)/lib/$(TARGET_DYLIBNAME)
202 endif
129else 203else
130 TARGET_XLDFLAGS= -Wl,-E 204 TARGET_XLDFLAGS= -Wl,-E
205 ifeq (Linux,$(TARGET_SYS))
206 TARGET_XLIBS= -ldl
207 endif
131endif 208endif
132endif 209endif
133endif
134
135# NOTE: The LuaJIT distribution comes with a pre-generated buildvm_*.h.
136# You DO NOT NEED an installed copy of (plain) Lua 5.1 to run DynASM unless
137# you want to MODIFY the corresponding *.dasc file. You can also use LuaJIT
138# itself (bootstrapped from the pre-generated file) to run DynASM of course.
139DASM_LUA= lua
140
141Q= @
142E= @echo
143#Q=
144#E= @:
145
146##############################################################################
147 210
148TARGET_CFLAGS= $(CCOPTIONS) $(TARGET_DISABLE) $(TARGET_XCFLAGS)
149TARGET_LDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS)
150TARGET_SHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS)
151TARGET_LIBS= -lm $(TARGET_XLIBS)
152ifneq (,$(CCDEBUG)) 211ifneq (,$(CCDEBUG))
153 TARGET_STRIP= @: 212 TARGET_STRIP= @:
154endif 213endif
155 214
156HOST_CFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) 215##############################################################################
157HOST_LDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) 216# Files and pathnames.
158HOST_LIBS= $(HOST_XLIBS) 217##############################################################################
159 218
160DASM_DIR= ../dynasm 219DASM_DIR= ../dynasm
161DASM= $(DASM_LUA) $(DASM_DIR)/dynasm.lua 220DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua
162DASM_FLAGS= 221DASM_FLAGS=
163DASM_DISTFLAGS= -LN 222DASM_DISTFLAGS= -LN
164 223
165BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o 224BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o
166BUILDVM_T= buildvm 225BUILDVM_T= buildvm
226BUILDVM_X= ./$(BUILDVM_T)
167 227
168HOST_O= $(BUILDVM_O) 228HOST_O= $(BUILDVM_O)
169HOST_T= $(BUILDVM_T) 229HOST_T= $(BUILDVM_T)
@@ -188,54 +248,114 @@ LJCORE_O= lj_gc.o lj_err.o lj_ctype.o lj_bc.o lj_obj.o \
188 $(LJLIB_O) lib_init.o 248 $(LJLIB_O) lib_init.o
189 249
190LJVMCORE_O= $(LJVM_O) $(LJCORE_O) 250LJVMCORE_O= $(LJVM_O) $(LJCORE_O)
251LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o)
252
253LIB_VMDEF= ../lib/vmdef.lua
254LIB_VMDEFP= $(LIB_VMDEF)
191 255
192# NYI: Need complete support for building as a shared library on POSIX.
193# This is currently *only* suitable for MinGW and Cygwin, see below.
194LUAJIT_O= luajit.o 256LUAJIT_O= luajit.o
195LUAJIT_SO= luajit.so 257LUAJIT_A= libluajit.a
258LUAJIT_SO= libluajit.so
196LUAJIT_T= luajit 259LUAJIT_T= luajit
197 260
198LIB_VMDEF= ../lib/vmdef.lua 261ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T)
262ALL_GEN= $(LJVM_S) lj_ffdef.h lj_libdef.h lj_recdef.h $(LIB_VMDEFP) lj_folddef.h
263ALL_DYNGEN= buildvm_x86.h
264WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
265ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM)
199 266
200TARGET_DEP= $(LIB_VMDEF) 267##############################################################################
201TARGET_O= $(LJVMCORE_O) $(LUAJIT_O) 268# Build mode handling.
202TARGET_T= $(LUAJIT_T) 269##############################################################################
203 270
204ALL_GEN= $(LJVM_S) lj_ffdef.h lj_libdef.h lj_recdef.h $(LIB_VMDEF) lj_folddef.h 271# Mixed mode defaults.
205ALL_DYNGEN= buildvm_x86.h 272TARGET_O= $(LUAJIT_A)
206WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest 273TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)
207ALL_RM= $(LUAJIT_T) $(LUAJIT_SO) $(HOST_T) $(ALL_GEN) *.o $(WIN_RM) 274TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)
208 275
276ifeq (Windows,$(HOST_SYS))
277 BUILDVM_T= buildvm.exe
278 LIB_VMDEFP= $(subst /,\\,$(LIB_VMDEF))
279endif
209ifeq (Windows,$(TARGET_SYS)) 280ifeq (Windows,$(TARGET_SYS))
281 DYNAMIC_CC= $(STATIC_CC)
210 LJVM_BOUT= $(LJVM_O) 282 LJVM_BOUT= $(LJVM_O)
211 LJVM_MODE= peobj 283 LJVM_MODE= peobj
212 LIB_VMDEF= ..\lib\vmdef.lua 284 LUAJIT_SO= $(TARGET_DLLNAME)
213 # Imported symbols are bound to a specific DLL name under Windows.
214 LUAJIT_SO= lua51.dll
215 LUAJIT_T= luajit.exe 285 LUAJIT_T= luajit.exe
216 BUILDVM_T= buildvm.exe 286 ifneq ($(HOST_SYS),$(TARGET_SYS))
217 # 287 HOST_XCFLAGS+= -malign-double
218 # You can comment out the following two lines to build a static executable. 288 endif
219 # But then you won't be able to dynamically load any C modules, because 289 # Mixed mode is not supported on Windows. And static mode doesn't work well.
220 # they bind to lua51.dll. 290 # C modules cannot be loaded, because they bind to lua51.dll.
221 # 291 ifneq (static,$(BUILDMODE))
222 TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL 292 BUILDMODE= dynamic
223 TARGET_O= $(LUAJIT_SO) $(LUAJIT_O) 293 TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL
294 endif
224endif 295endif
225 296
226############################################################################## 297ifeq (static,$(BUILDMODE))
298 TARGET_DYNCC= @:
299 TARGET_T= $(LUAJIT_T)
300 TARGET_DEP= $(LIB_VMDEF)
301else
302ifeq (dynamic,$(BUILDMODE))
303 TARGET_CC= $(DYNAMIC_CC)
304 TARGET_DYNCC= @:
305 LJVMCORE_DYNO= $(LJVMCORE_O)
306 TARGET_O= $(LUAJIT_SO)
307 TARGET_XLDOPTS= $(TARGET_DYNXLDOPTS)
308else
309ifeq (Darwin,$(TARGET_SYS))
310 TARGET_DYNCC= @:
311 LJVMCORE_DYNO= $(LJVMCORE_O)
312endif
313endif
314endif
227 315
228default: $(TARGET_T) 316Q= @
317E= @echo
318#Q=
319#E= @:
229 320
230all: $(TARGET_T) 321##############################################################################
322# Make targets.
323##############################################################################
324
325default all: $(TARGET_T)
231 326
232amalg: 327amalg:
233 @grep "^[+|]" ljamalg.c 328 @grep "^[+|]" ljamalg.c
234 $(MAKE) all "LJCORE_O=ljamalg.o" 329 $(MAKE) all "LJCORE_O=ljamalg.o"
235 330
236MAKE_TARGETS= amalg 331clean:
332 $(HOST_RM) $(ALL_RM)
333
334cleaner:
335 $(HOST_RM) $(ALL_RM) $(ALL_DYNGEN)
336
337distclean: clean
338 $(E) "DYNASM $@"
339 $(Q)$(DASM) $(DASM_DISTFLAGS) -o buildvm_x86.h buildvm_x86.dasc
340
341depend:
342 @test -f lj_ffdef.h || touch lj_ffdef.h
343 @test -f lj_libdef.h || touch lj_libdef.h
344 @test -f lj_recdef.h || touch lj_recdef.h
345 @test -f lj_folddef.h || touch lj_folddef.h
346 @test -f buildvm_x86.h || touch buildvm_x86.h
347 @$(HOST_CC) $(HOST_CFLAGS) -MM *.c | sed "s|$(DASM_DIR)|\$$(DASM_DIR)|g" >Makefile.dep
348 @test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h
349 @test -s lj_libdef.h || $(HOST_RM) lj_libdef.h
350 @test -s lj_recdef.h || $(HOST_RM) lj_recdef.h
351 @test -s lj_folddef.h || $(HOST_RM) lj_folddef.h
352 @test -s buildvm_x86.h || $(HOST_RM) buildvm_x86.h
353
354.PHONY: default all amalg clean cleaner distclean depend
237 355
238############################################################################## 356##############################################################################
357# Rules for generated files.
358##############################################################################
239 359
240buildvm_x86.h: buildvm_x86.dasc 360buildvm_x86.h: buildvm_x86.dasc
241 $(E) "DYNASM $@" 361 $(E) "DYNASM $@"
@@ -247,49 +367,46 @@ $(BUILDVM_T): $(BUILDVM_O)
247 367
248$(LJVM_BOUT): $(BUILDVM_T) 368$(LJVM_BOUT): $(BUILDVM_T)
249 $(E) "BUILDVM $@" 369 $(E) "BUILDVM $@"
250 $(Q)./$(BUILDVM_T) -m $(LJVM_MODE) -o $@ 370 $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@
251 371
252lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) 372lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C)
253 $(E) "BUILDVM $@" 373 $(E) "BUILDVM $@"
254 $(Q)./$(BUILDVM_T) -m ffdef -o $@ $(LJLIB_C) 374 $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C)
255 375
256lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) 376lj_libdef.h: $(BUILDVM_T) $(LJLIB_C)
257 $(E) "BUILDVM $@" 377 $(E) "BUILDVM $@"
258 $(Q)./$(BUILDVM_T) -m libdef -o $@ $(LJLIB_C) 378 $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C)
259 379
260lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) 380lj_recdef.h: $(BUILDVM_T) $(LJLIB_C)
261 $(E) "BUILDVM $@" 381 $(E) "BUILDVM $@"
262 $(Q)./$(BUILDVM_T) -m recdef -o $@ $(LJLIB_C) 382 $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C)
263 383
264$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C) 384$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C)
265 $(E) "BUILDVM $@" 385 $(E) "BUILDVM $@"
266 $(Q)./$(BUILDVM_T) -m vmdef -o $@ $(LJLIB_C) 386 $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C)
267 387
268lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c 388lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c
269 $(E) "BUILDVM $@" 389 $(E) "BUILDVM $@"
270 $(Q)./$(BUILDVM_T) -m folddef -o $@ lj_opt_fold.c 390 $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c
271
272$(LUAJIT_SO): $(LJVMCORE_O)
273 $(E) "LINK $@"
274 $(Q)$(TARGET_CC) $(TARGET_SHLDFLAGS) -o $@ $(LJVMCORE_O) $(TARGET_LIBS)
275 $(Q)$(TARGET_STRIP) $@
276
277$(LUAJIT_T): $(TARGET_O) $(TARGET_DEP)
278 $(E) "LINK $@"
279 $(Q)$(TARGET_CC) $(TARGET_LDFLAGS) -o $@ $(TARGET_O) $(TARGET_LIBS)
280 $(Q)$(TARGET_STRIP) $@
281 $(E) "OK Successfully built LuaJIT"
282 391
283############################################################################## 392##############################################################################
393# Object file rules.
394##############################################################################
284 395
285%.o: %.c 396%.o: %.c
286 $(E) "CC $@" 397 $(E) "CC $@"
398 $(Q)$(TARGET_DYNCC) $(TARGET_CFLAGS) -c -o $(@:.o=_dyn.o) $<
287 $(Q)$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $< 399 $(Q)$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $<
288 400
289%.o: %.s 401%.o: %.s
290 $(E) "ASM $@" 402 $(E) "ASM $@"
403 $(Q)$(TARGET_DYNCC) $(TARGET_CFLAGS) -c -o $(@:.o=_dyn.o) $<
291 $(Q)$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $< 404 $(Q)$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ $<
292 405
406$(LUAJIT_O):
407 $(E) "CC $@"
408 $(Q)$(TARGET_STCC) $(TARGET_CFLAGS) -c -o $@ $<
409
293$(HOST_O): %.o: %.c 410$(HOST_O): %.o: %.c
294 $(E) "HOSTCC $@" 411 $(E) "HOSTCC $@"
295 $(Q)$(HOST_CC) $(HOST_CFLAGS) -c -o $@ $< 412 $(Q)$(HOST_CC) $(HOST_CFLAGS) -c -o $@ $<
@@ -297,30 +414,23 @@ $(HOST_O): %.o: %.c
297include Makefile.dep 414include Makefile.dep
298 415
299############################################################################## 416##############################################################################
417# Target file rules.
418##############################################################################
300 419
301clean: 420$(LUAJIT_A): $(LJVMCORE_O)
302 $(HOST_RM) $(ALL_RM) 421 $(E) "AR $@"
303 422 $(Q)$(TARGET_AR) $@ $(LJVMCORE_O)
304cleaner: clean
305 $(HOST_RM) $(ALL_DYNGEN)
306 423
307distclean: clean 424# The dependency on _O, but linking with _DYNO is intentional.
308 $(E) "DYNASM $@" 425$(LUAJIT_SO): $(LJVMCORE_O)
309 $(Q)$(DASM) $(DASM_DISTFLAGS) -o buildvm_x86.h buildvm_x86.dasc 426 $(E) "DYNLINK $@"
310 427 $(Q)$(TARGET_LD) $(TARGET_SHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_LIBS)
311depend: 428 $(Q)$(TARGET_STRIP) $@
312 @test -f lj_ffdef.h || touch lj_ffdef.h
313 @test -f lj_libdef.h || touch lj_libdef.h
314 @test -f lj_recdef.h || touch lj_recdef.h
315 @test -f lj_folddef.h || touch lj_folddef.h
316 @test -f buildvm_x86.h || touch buildvm_x86.h
317 @$(HOST_CC) $(HOST_CFLAGS) -MM *.c | sed "s|$(DASM_DIR)|\$$(DASM_DIR)|g" >Makefile.dep
318 @test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h
319 @test -s lj_libdef.h || $(HOST_RM) lj_libdef.h
320 @test -s lj_recdef.h || $(HOST_RM) lj_recdef.h
321 @test -s lj_folddef.h || $(HOST_RM) lj_folddef.h
322 @test -s buildvm_x86.h || $(HOST_RM) buildvm_x86.h
323 429
324.PHONY: default all $(MAKE_TARGETS) clean cleaner distclean depend 430$(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP)
431 $(E) "LINK $@"
432 $(Q)$(TARGET_LD) $(TARGET_LDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_LIBS)
433 $(Q)$(TARGET_STRIP) $@
434 $(E) "OK Successfully built LuaJIT"
325 435
326############################################################################## 436##############################################################################
diff --git a/src/Makefile.dep b/src/Makefile.dep
index b1cdd93b..1fb81e27 100644
--- a/src/Makefile.dep
+++ b/src/Makefile.dep
@@ -34,8 +34,8 @@ lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
34lib_package.o: lib_package.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ 34lib_package.o: lib_package.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
35 lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_lib.h 35 lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_lib.h
36lib_string.o: lib_string.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ 36lib_string.o: lib_string.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
37 lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_state.h \ 37 lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h \
38 lj_ff.h lj_ffdef.h lj_ctype.h lj_lib.h lj_libdef.h 38 lj_state.h lj_ff.h lj_ffdef.h lj_ctype.h lj_lib.h lj_libdef.h
39lib_table.o: lib_table.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ 39lib_table.o: lib_table.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
40 lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_tab.h lj_lib.h \ 40 lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_tab.h lj_lib.h \
41 lj_libdef.h 41 lj_libdef.h