9
3

Makefile 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. # Makefile for building Lua
  2. # See ../doc/readme.html for installation and customization instructions.
  3. # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
  4. # Your platform. See PLATS for possible values.
  5. PLAT= guess
  6. CC= gcc -std=gnu99
  7. CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
  8. LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
  9. LIBS= -lm $(SYSLIBS) $(MYLIBS)
  10. AR= ar rcu
  11. RANLIB= ranlib
  12. RM= rm -f
  13. UNAME= uname
  14. SYSCFLAGS=
  15. SYSLDFLAGS=
  16. SYSLIBS=
  17. MYCFLAGS=
  18. MYLDFLAGS=
  19. MYLIBS=
  20. MYOBJS=
  21. # Special flags for compiler modules; -Os reduces code size.
  22. CMCFLAGS=
  23. # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
  24. PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
  25. LUA_A= liblua.a
  26. 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
  27. 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
  28. BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
  29. LUA_T= lua
  30. LUA_O= lua.o
  31. LUAC_T= luac
  32. LUAC_O= luac.o
  33. ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
  34. ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
  35. ALL_A= $(LUA_A)
  36. # Targets start here.
  37. default: $(PLAT)
  38. all: $(ALL_T)
  39. o: $(ALL_O)
  40. a: $(ALL_A)
  41. $(LUA_A): $(BASE_O)
  42. $(AR) $@ $(BASE_O)
  43. $(RANLIB) $@
  44. $(LUA_T): $(LUA_O) $(LUA_A)
  45. $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
  46. $(LUAC_T): $(LUAC_O) $(LUA_A)
  47. $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
  48. test:
  49. ./lua -v
  50. clean:
  51. $(RM) $(ALL_T) $(ALL_O)
  52. depend:
  53. @$(CC) $(CFLAGS) -MM l*.c
  54. echo:
  55. @echo "PLAT= $(PLAT)"
  56. @echo "CC= $(CC)"
  57. @echo "CFLAGS= $(CFLAGS)"
  58. @echo "LDFLAGS= $(SYSLDFLAGS)"
  59. @echo "LIBS= $(LIBS)"
  60. @echo "AR= $(AR)"
  61. @echo "RANLIB= $(RANLIB)"
  62. @echo "RM= $(RM)"
  63. @echo "UNAME= $(UNAME)"
  64. # Convenience targets for popular platforms.
  65. ALL= all
  66. help:
  67. @echo "Do 'make PLATFORM' where PLATFORM is one of these:"
  68. @echo " $(PLATS)"
  69. @echo "See doc/readme.html for complete instructions."
  70. guess:
  71. @echo Guessing `$(UNAME)`
  72. @$(MAKE) `$(UNAME)`
  73. AIX aix:
  74. $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall"
  75. bsd:
  76. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E"
  77. c89:
  78. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89"
  79. @echo ''
  80. @echo '*** C89 does not guarantee 64-bit integers for Lua.'
  81. @echo ''
  82. FreeBSD NetBSD OpenBSD freebsd:
  83. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
  84. generic: $(ALL)
  85. Linux linux: linux-noreadline
  86. linux-noreadline:
  87. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
  88. linux-readline:
  89. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
  90. Darwin macos macosx:
  91. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
  92. mingw:
  93. $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
  94. "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
  95. "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
  96. $(MAKE) "LUAC_T=luac.exe" luac.exe
  97. posix:
  98. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"
  99. SunOS solaris:
  100. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl"
  101. # Targets that do not create files (not all makes understand .PHONY).
  102. .PHONY: all $(PLATS) help test clean default o a depend echo
  103. # Compiler modules may use special flags.
  104. llex.o:
  105. $(CC) $(CFLAGS) $(CMCFLAGS) -c llex.c
  106. lparser.o:
  107. $(CC) $(CFLAGS) $(CMCFLAGS) -c lparser.c
  108. lcode.o:
  109. $(CC) $(CFLAGS) $(CMCFLAGS) -c lcode.c
  110. # DO NOT DELETE
  111. lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  112. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
  113. ltable.h lundump.h lvm.h
  114. lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h
  115. lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  116. lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  117. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  118. ldo.h lgc.h lstring.h ltable.h lvm.h
  119. lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  120. lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
  121. ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  122. ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  123. lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
  124. ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
  125. ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  126. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
  127. lparser.h lstring.h ltable.h lundump.h lvm.h
  128. ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \
  129. ltm.h lzio.h lmem.h lundump.h
  130. lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  131. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
  132. lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  133. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
  134. linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h
  135. liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  136. llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
  137. lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
  138. lstring.h ltable.h
  139. lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  140. lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  141. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h
  142. loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  143. lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
  144. ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
  145. lvm.h
  146. lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h
  147. loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  148. lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  149. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  150. ldo.h lfunc.h lstring.h lgc.h ltable.h
  151. lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  152. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
  153. lstring.h ltable.h
  154. lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  155. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
  156. lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  157. ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  158. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  159. ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  160. ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  161. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  162. lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  163. luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h ldebug.h lstate.h \
  164. lobject.h llimits.h ltm.h lzio.h lmem.h lopcodes.h lopnames.h lundump.h
  165. lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  166. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
  167. lundump.h
  168. lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  169. lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  170. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \
  171. ltable.h lvm.h ljumptab.h
  172. lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \
  173. lobject.h ltm.h lzio.h
  174. # (end of Makefile)