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 -std=gnu99 10CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(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 bsd c89 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 lutf8lib.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 94bsd: 95 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" 96 97c89: 98 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" 99 @echo '' 100 @echo '*** C89 does not guarantee 64-bit integers for Lua.' 101 @echo '' 102 103 104freebsd: 105 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" 106 107generic: $(ALL) 108 109linux: 110 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" 111 112macosx: 113 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" 114 115mingw: 116 $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ 117 "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ 118 "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe 119 $(MAKE) "LUAC_T=luac.exe" luac.exe 120 121posix: 122 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" 123 124solaris: 125 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" 126 127# list targets that do not create files (but not all makes understand .PHONY) 128.PHONY: all $(PLATS) default o a clean depend echo none 129 130# DO NOT DELETE 131 132lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ 133 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ 134 ltable.h lundump.h lvm.h 135lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h 136lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 137lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 138lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ 139 llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ 140 ldo.h lgc.h lstring.h ltable.h lvm.h 141lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 142lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h 143ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 144ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ 145 lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ 146 ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h 147ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ 148 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ 149 lparser.h lstring.h ltable.h lundump.h lvm.h 150ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ 151 ltm.h lzio.h lmem.h lundump.h 152lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ 153 lgc.h lstate.h ltm.h lzio.h lmem.h 154lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ 155 llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h 156linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h 157liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 158llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ 159 lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ 160 lstring.h ltable.h 161lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 162lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ 163 llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h 164loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 165lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ 166 ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ 167 lvm.h 168lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h 169loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 170lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ 171 llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ 172 ldo.h lfunc.h lstring.h lgc.h ltable.h 173lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ 174 lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ 175 lstring.h ltable.h 176lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ 177 lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h 178lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 179ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ 180 llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h 181ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 182ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ 183 llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h 184lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 185luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ 186 lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h 187lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ 188 lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ 189 lundump.h 190lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 191lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ 192 llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ 193 ltable.h lvm.h 194lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ 195 lobject.h ltm.h lzio.h 196 197# (end of Makefile) 198