]>
Commit | Line | Data |
---|---|---|
1 | # Makefile for building Lua | |
2 | # See ../doc/readme.html for installation and customization instructions. | |
3 | ||
4 | # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= | |
5 | ||
6 | # Your platform. See PLATS for possible values. | |
7 | PLAT= none | |
8 | ||
9 | CC= gcc | |
10 | CFLAGS= -O3 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) | |
11 | LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) | |
12 | LIBS= -lm $(SYSLIBS) $(MYLIBS) | |
13 | ||
14 | AR= ar rcu | |
15 | RANLIB= ranlib | |
16 | RM= rm -f | |
17 | ||
18 | SYSCFLAGS= | |
19 | SYSLDFLAGS= | |
20 | SYSLIBS= | |
21 | ||
22 | MYCFLAGS= | |
23 | MYLDFLAGS= | |
24 | MYLIBS= | |
25 | MYOBJS= | |
26 | ||
27 | # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= | |
28 | ||
29 | PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris | |
30 | ||
31 | LUA_A= liblua.a | |
32 | CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ | |
33 | lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ | |
34 | ltm.o lundump.o lvm.o lzio.o | |
35 | LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ | |
36 | lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o | |
37 | BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) | |
38 | ||
39 | LUA_T= lua | |
40 | LUA_O= lua.o | |
41 | ||
42 | LUAC_T= luac | |
43 | LUAC_O= luac.o | |
44 | ||
45 | ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) | |
46 | ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) | |
47 | ALL_A= $(LUA_A) | |
48 | ||
49 | # Targets start here. | |
50 | default: $(PLAT) | |
51 | ||
52 | all: $(ALL_T) | |
53 | ||
54 | o: $(ALL_O) | |
55 | ||
56 | a: $(ALL_A) | |
57 | ||
58 | $(LUA_A): $(BASE_O) | |
59 | $(AR) $@ $(BASE_O) | |
60 | $(RANLIB) $@ | |
61 | ||
62 | $(LUA_T): $(LUA_O) $(LUA_A) | |
63 | $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) | |
64 | ||
65 | $(LUAC_T): $(LUAC_O) $(LUA_A) | |
66 | $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) | |
67 | ||
68 | clean: | |
69 | $(RM) $(ALL_T) $(ALL_O) | |
70 | ||
71 | depend: | |
72 | @$(CC) $(CFLAGS) -MM l*.c | |
73 | ||
74 | echo: | |
75 | @echo "PLAT= $(PLAT)" | |
76 | @echo "CC= $(CC)" | |
77 | @echo "CFLAGS= $(CFLAGS)" | |
78 | @echo "LDFLAGS= $(SYSLDFLAGS)" | |
79 | @echo "LIBS= $(LIBS)" | |
80 | @echo "AR= $(AR)" | |
81 | @echo "RANLIB= $(RANLIB)" | |
82 | @echo "RM= $(RM)" | |
83 | ||
84 | # Convenience targets for popular platforms | |
85 | ALL= all | |
86 | ||
87 | none: | |
88 | @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" | |
89 | @echo " $(PLATS)" | |
90 | ||
91 | aix: | |
92 | $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" | |
93 | ||
94 | ansi: | |
95 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_ANSI" | |
96 | ||
97 | bsd: | |
98 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" | |
99 | ||
100 | freebsd: | |
101 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" | |
102 | ||
103 | generic: $(ALL) | |
104 | ||
105 | linux: | |
106 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -ltermcap -lncurses" | |
107 | ||
108 | macosx: | |
109 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" | |
110 | ||
111 | mingw: | |
112 | $(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \ | |
113 | "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ | |
114 | "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe | |
115 | $(MAKE) "LUAC_T=luac.exe" luac.exe | |
116 | ||
117 | posix: | |
118 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" | |
119 | ||
120 | solaris: | |
121 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" | |
122 | ||
123 | # list targets that do not create files (but not all makes understand .PHONY) | |
124 | .PHONY: all $(PLATS) default o a clean depend echo none | |
125 | ||
126 | # DO NOT DELETE | |
127 | ||
128 | lapi.o: lapi.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \ | |
129 | lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h ltable.h lundump.h \ | |
130 | lvm.h | |
131 | lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h | |
132 | lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h | |
133 | lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h | |
134 | lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ | |
135 | lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ | |
136 | lstring.h ltable.h lvm.h | |
137 | lcorolib.o: lcorolib.c lua.h luaconf.h lauxlib.h lualib.h | |
138 | lctype.o: lctype.c lctype.h lua.h luaconf.h llimits.h | |
139 | ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h | |
140 | ldebug.o: ldebug.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \ | |
141 | ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h ldebug.h ldo.h \ | |
142 | lfunc.h lstring.h lgc.h ltable.h lvm.h | |
143 | ldo.o: ldo.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \ | |
144 | lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h \ | |
145 | lstring.h ltable.h lundump.h lvm.h | |
146 | ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ | |
147 | lzio.h lmem.h lundump.h | |
148 | lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h \ | |
149 | lstate.h ltm.h lzio.h lmem.h | |
150 | lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ | |
151 | lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h | |
152 | linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h | |
153 | liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h | |
154 | llex.o: llex.c lua.h luaconf.h lctype.h llimits.h ldo.h lobject.h \ | |
155 | lstate.h ltm.h lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h | |
156 | lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h | |
157 | lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ | |
158 | ltm.h lzio.h lmem.h ldo.h lgc.h | |
159 | loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h | |
160 | lobject.o: lobject.c lua.h luaconf.h lctype.h llimits.h ldebug.h lstate.h \ | |
161 | lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h lvm.h | |
162 | lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h | |
163 | loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h | |
164 | lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ | |
165 | lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lfunc.h \ | |
166 | lstring.h lgc.h ltable.h | |
167 | lstate.o: lstate.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \ | |
168 | ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h lstring.h \ | |
169 | ltable.h | |
170 | lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ | |
171 | ltm.h lzio.h lstring.h lgc.h | |
172 | lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h | |
173 | ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ | |
174 | ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h | |
175 | ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h | |
176 | ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ | |
177 | lmem.h lstring.h lgc.h ltable.h | |
178 | lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h | |
179 | luac.o: luac.c lua.h luaconf.h lauxlib.h lobject.h llimits.h lstate.h \ | |
180 | ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h | |
181 | lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ | |
182 | llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h | |
183 | lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ | |
184 | lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h | |
185 | lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ | |
186 | lzio.h | |
187 |