makefile 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 $(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= -I../../skynet-src -g
  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 ios 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_T) -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= $(LDFLAGS)"
  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 '*** Make sure to compile all external Lua libraries'
  82. @echo '*** with LUA_USE_C89 to ensure consistency'
  83. @echo ''
  84. FreeBSD NetBSD OpenBSD freebsd:
  85. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
  86. generic: $(ALL)
  87. ios:
  88. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_IOS"
  89. Linux linux: linux-noreadline
  90. linux-noreadline:
  91. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
  92. linux-readline:
  93. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
  94. Darwin macos macosx:
  95. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
  96. mingw:
  97. $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
  98. "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
  99. "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
  100. $(MAKE) "LUAC_T=luac.exe" luac.exe
  101. posix:
  102. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"
  103. SunOS solaris:
  104. $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl"
  105. # Targets that do not create files (not all makes understand .PHONY).
  106. .PHONY: all $(PLATS) help test clean default o a depend echo
  107. # Compiler modules may use special flags.
  108. llex.o:
  109. $(CC) $(CFLAGS) $(CMCFLAGS) -c llex.c
  110. lparser.o:
  111. $(CC) $(CFLAGS) $(CMCFLAGS) -c lparser.c
  112. lcode.o:
  113. $(CC) $(CFLAGS) $(CMCFLAGS) -c lcode.c
  114. # DO NOT DELETE
  115. lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  116. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
  117. ltable.h lundump.h lvm.h
  118. lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h
  119. lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  120. lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  121. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  122. ldo.h lgc.h lstring.h ltable.h lvm.h
  123. lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  124. lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
  125. ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  126. ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  127. lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
  128. ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
  129. ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  130. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
  131. lparser.h lstring.h ltable.h lundump.h lvm.h
  132. ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \
  133. ltm.h lzio.h lmem.h lundump.h
  134. lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  135. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
  136. lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  137. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
  138. linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h
  139. liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  140. llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
  141. lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
  142. lstring.h ltable.h
  143. lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  144. lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  145. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h
  146. loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  147. lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
  148. ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
  149. lvm.h
  150. lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h
  151. loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  152. lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  153. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  154. ldo.h lfunc.h lstring.h lgc.h ltable.h
  155. lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  156. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
  157. lstring.h ltable.h
  158. lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  159. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
  160. lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  161. ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  162. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  163. ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  164. ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  165. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  166. lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  167. luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h ldebug.h lstate.h \
  168. lobject.h llimits.h ltm.h lzio.h lmem.h lopcodes.h lopnames.h lundump.h
  169. lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  170. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
  171. lundump.h
  172. lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  173. lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  174. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \
  175. ltable.h lvm.h ljumptab.h
  176. lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \
  177. lobject.h ltm.h lzio.h
  178. # (end of Makefile)