Makefile revision 1d9a26b35628ec99e6b03380bdedec2a0135d5f9
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. 7PLAT= none 8 9CC= gcc 10CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) 11LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) 12LIBS= -lm $(SYSLIBS) $(MYLIBS) 13 14AR= ar rcu 15RANLIB= ranlib 16RM= rm -f 17 18SYSCFLAGS= 19SYSLDFLAGS= 20SYSLIBS= 21 22MYCFLAGS= 23MYLDFLAGS= 24MYLIBS= 25MYOBJS= 26 27# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= 28 29PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris 30 31LUA_A= liblua.a 32CORE_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 35LIB_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 37BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) 38 39LUA_T= lua 40LUA_O= lua.o 41 42LUAC_T= luac 43LUAC_O= luac.o 44 45ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) 46ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) 47ALL_A= $(LUA_A) 48 49# Targets start here. 50default: $(PLAT) 51 52all: $(ALL_T) 53 54o: $(ALL_O) 55 56a: $(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 68clean: 69 $(RM) $(ALL_T) $(ALL_O) 70 71depend: 72 @$(CC) $(CFLAGS) -MM l*.c 73 74echo: 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 85ALL= all 86 87none: 88 @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" 89 @echo " $(PLATS)" 90 91aix: 92 $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" 93 94ansi: 95 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_ANSI" 96 97bsd: 98 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" 99 100freebsd: 101 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" 102 103generic: $(ALL) 104 105linux: 106 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" 107 108macosx: 109 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" 110 111mingw: 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 117posix: 118 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" 119 120solaris: 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 128lapi.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 131lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h 132lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h 133lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h 134lcode.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 137lcorolib.o: lcorolib.c lua.h luaconf.h lauxlib.h lualib.h 138lctype.o: lctype.c lctype.h lua.h luaconf.h llimits.h 139ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h 140ldebug.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 143ldo.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 146ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ 147 lzio.h lmem.h lundump.h 148lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h \ 149 lstate.h ltm.h lzio.h lmem.h 150lgc.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 152linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h 153liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h 154llex.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 156lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h 157lmem.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 159loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h 160lobject.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 162lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h 163loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h 164lparser.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 167lstate.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 170lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ 171 ltm.h lzio.h lstring.h lgc.h 172lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h 173ltable.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 175ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h 176ltm.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 178lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h 179luac.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 181lundump.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 183lvm.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 185lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ 186 lzio.h 187 188