Debian Codegraph @

src/Makefile

raw ◀ ▶
1 Debian patch touch this file
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= guess
8
9 CC= gcc -std=gnu99
•10 CXX= g++
11 CFLAGS= -Wall -Wextra -DLUA_COMPAT_5_4 $(SYSCFLAGS) $(MYCFLAGS)
12 CXXFLAGS= -Wall -Wextra -DLUA_COMPAT_5_4 $(SYSCFLAGS) $(MYCXXFLAGS)
13 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
14 LIBS= -lm $(SYSLIBS) $(MYLIBS)
15
16 AR= ar rcu
17 RANLIB= ranlib
18 RM= rm -f
19 UNAME= uname
20
21 SYSCFLAGS=
22 SYSLDFLAGS=
23 SYSLIBS=
24
•25 MYCFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
26 MYCXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
27 MYLDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
28 MYLIBS=-ldl
29 MYOBJS=
30
31 # Special flags for compiler modules; -Os reduces code size.
32 CMCFLAGS=
33
•34 %.o : %.c
35 $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@
36 $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -c $< -o $*-c++.o
37
38 # Build the compiler code with -Os to make the binaries as small as possible
39 # (see https://github.com/lua/lua/commit/6a10f03ff81606e567c6891a90d70066a03c686e)
40
41 llex.o: llex.c
42 $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -Os -c $< -o $@
43 $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -Os -c $< -o $*-c++.o
44
45 lparser.o: lparser.c
46 $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -Os -c $< -o $@
47 $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -Os -c $< -o $*-c++.o
48
49 lcode.o: lcode.c
50 $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -Os -c $< -o $@
51 $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -Os -c $< -o $*-c++.o
52
53 # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
54
55 PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris
56
•57 LUA_A= liblua$(V).la liblua$(V)-c++.la
58 CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
59 LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
60 BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
61
•62 LUA_T= lua$(V)
63 LUA_O= lua.o
64
•65 LUAC_T= luac$(V)
66 LUAC_O= luac.o
67
68 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
69 ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
70 ALL_A= $(LUA_A)
71
72 # Targets start here.
73 default: $(PLAT)
74
75 all: $(ALL_T)
76
77 o: $(ALL_O)
78
79 a: $(ALL_A)
80
81 $(LUA_A): $(BASE_O)
•82 $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V).la
83 $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(LDFLAGS) -lm -ldl $(BASE_O:.o=-c++.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V)-c++.la
84
85 $(LUA_T): $(LUA_O) $(LUA_A)
•86 $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -Wl,--version-script,../debian/version-script -static liblua$(V).la -Wl,-E lua.lo -o $@
87
88 $(LUAC_T): $(LUAC_O) $(LUA_A)
•89 $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -Wl,--version-script,../debian/version-script -static liblua$(V).la luac.lo -o $@
90
91 test:
92 ./$(LUA_T) -v
93
94 clean:
95 $(RM) $(ALL_T) $(ALL_O)
96
97 depend:
98 @$(CC) $(CFLAGS) -MM l*.c
99
100 echo:
101 @echo "PLAT= $(PLAT)"
102 @echo "CC= $(CC)"
103 @echo "CFLAGS= $(CFLAGS)"
104 @echo "LDFLAGS= $(LDFLAGS)"
105 @echo "LIBS= $(LIBS)"
106 @echo "AR= $(AR)"
107 @echo "RANLIB= $(RANLIB)"
108 @echo "RM= $(RM)"
109 @echo "UNAME= $(UNAME)"
110
111 # Convenience targets for popular platforms.
112 ALL= all
113
114 help:
115 @echo "Do 'make PLATFORM' where PLATFORM is one of these:"
116 @echo " $(PLATS)"
117 @echo "See doc/readme.html for complete instructions."
118
119 guess:
120 @echo Guessing `$(UNAME)`
121 @$(MAKE) `$(UNAME)`
122
123 AIX aix:
124 $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall"
125
126 bsd:
127 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E"
128
129 c89:
130 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89"
131 @echo ''
132 @echo '*** C89 does not guarantee 64-bit integers for Lua.'
133 @echo '*** Make sure to compile all external Lua libraries'
134 @echo '*** with LUA_USE_C89 to ensure consistency'
135 @echo ''
136
137 FreeBSD NetBSD OpenBSD freebsd:
138 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
139
140 generic: $(ALL)
141
142 ios:
143 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_IOS"
144
145 Linux linux:
146 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
147
148 Darwin macos macosx:
149 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
150
151 mingw:
152 $(MAKE) "LUA_A=lua55.dll" "LUA_T=lua.exe" \
153 "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
154 "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
155 $(MAKE) "LUAC_T=luac.exe" luac.exe
156
157 posix:
158 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"
159
160 SunOS solaris:
161 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl"
162
163 # Targets that do not create files (not all makes understand .PHONY).
164 .PHONY: all $(PLATS) help test clean default o a depend echo
165
166 # Compiler modules may use special flags.
167 # DO NOT DELETE
168
169 lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
170 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
171 ltable.h lundump.h lvm.h
172 lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h llimits.h
173 lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
174 llimits.h
175 lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
176 llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
177 ldo.h lgc.h lstring.h ltable.h lvm.h lopnames.h
178 lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
179 llimits.h
180 lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
181 ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
182 ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
183 lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
184 ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
185 ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
186 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
187 lparser.h lstring.h ltable.h lundump.h lvm.h
188 ldump.o: ldump.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
189 lobject.h ltm.h lzio.h lmem.h lgc.h ltable.h lundump.h
190 lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
191 llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
192 lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
193 llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
194 linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h llimits.h
195 liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
196 llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
197 lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
198 lstring.h ltable.h
199 lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
200 llimits.h
201 lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
202 llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h
203 loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
204 llimits.h
205 lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
206 ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
207 lvm.h
208 lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h \
209 lobject.h
210 loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
211 lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
212 llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
213 ldo.h lfunc.h lstring.h lgc.h ltable.h
214 lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
215 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
216 lstring.h ltable.h
217 lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
218 lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
219 lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
220 llimits.h
221 ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
222 llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
223 ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
224 llimits.h
225 ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
226 llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
227 lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
228 luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lapi.h llimits.h \
229 lstate.h lobject.h ltm.h lzio.h lmem.h ldebug.h lopcodes.h lopnames.h \
230 lundump.h
231 lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
232 lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
233 ltable.h lundump.h
234 lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
235 llimits.h
236 lvm.o: lvm.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
237 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
238 lstring.h ltable.h lvm.h ljumptab.h
239 lzio.o: lzio.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
240 lobject.h ltm.h lzio.h lmem.h
241
242 # (end of Makefile)