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 -std=gnu99 10 CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(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 bsd c89 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 lutf8lib.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 bsd: 95 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" 96 97 c89: 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 104 freebsd: 105 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" 106 107 generic: $(ALL) 108 109 linux: 110 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" 111 112 macosx: 113 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" 114 115 mingw: 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 121 posix: 122 $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" 123 124 solaris: 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 132 lapi.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 135 lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h 136 lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 137 lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 138 lcode.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 141 lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 142 lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h 143 ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 144 ldebug.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 147 ldo.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 150 ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ 151 ltm.h lzio.h lmem.h lundump.h 152 lfunc.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 154 lgc.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 156 linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h 157 liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 158 llex.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 161 lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 162 lmem.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 164 loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 165 lobject.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 168 lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h 169 loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 170 lparser.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 173 lstate.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 176 lstring.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 178 lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 179 ltable.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 181 ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 182 ltm.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 184 lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 185 luac.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 187 lundump.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 190 lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h 191 lvm.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 194 lzio.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