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