makefile 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. # Developer's makefile for building Lua
  2. # see luaconf.h for further customization
  3. # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
  4. # Warnings valid for both C and C++
  5. CWARNSCPP= \
  6. -Wfatal-errors \
  7. -Wextra \
  8. -Wshadow \
  9. -Wundef \
  10. -Wwrite-strings \
  11. -Wredundant-decls \
  12. -Wdisabled-optimization \
  13. -Wdouble-promotion \
  14. -Wmissing-declarations \
  15. -Wconversion \
  16. -Wstrict-overflow=2 \
  17. # the next warnings might be useful sometimes,
  18. # but usually they generate too much noise
  19. # -Werror \
  20. # -pedantic # warns if we use jump tables \
  21. # -Wformat=2 \
  22. # -Wcast-qual \
  23. # Warnings for gcc, not valid for clang
  24. CWARNGCC= \
  25. -Wlogical-op \
  26. -Wno-aggressive-loop-optimizations \
  27. # The next warnings are neither valid nor needed for C++
  28. CWARNSC= -Wdeclaration-after-statement \
  29. -Wmissing-prototypes \
  30. -Wnested-externs \
  31. -Wstrict-prototypes \
  32. -Wc++-compat \
  33. -Wold-style-definition \
  34. CWARNS= $(CWARNSCPP) $(CWARNSC) $(CWARNGCC)
  35. # Some useful compiler options for internal tests:
  36. # -DLUAI_ASSERT turns on all assertions inside Lua.
  37. # -DHARDSTACKTESTS forces a reallocation of the stack at every point where
  38. # the stack can be reallocated.
  39. # -DHARDMEMTESTS forces a full collection at all points where the collector
  40. # can run.
  41. # -DEMERGENCYGCTESTS forces an emergency collection at every single allocation.
  42. # -DEXTERNMEMCHECK removes internal consistency checking of blocks being
  43. # deallocated (useful when an external tool like valgrind does the check).
  44. # -DMAXINDEXRK=k limits range of constants in RK instruction operands.
  45. # -DLUA_COMPAT_5_3
  46. # -pg -malign-double
  47. # -DLUA_USE_CTYPE -DLUA_USE_APICHECK
  48. # The following options help detect "undefined behavior"s that seldom
  49. # create problems; some are only available in newer gcc versions. To
  50. # use some of them, we also have to define an environment variable
  51. # ASAN_OPTIONS="detect_invalid_pointer_pairs=2".
  52. # -fsanitize=undefined
  53. # -fsanitize=pointer-subtract -fsanitize=address -fsanitize=pointer-compare
  54. # TESTS= -DLUA_USER_H='"ltests.h"' -Og -g
  55. LOCAL = $(TESTS) $(CWARNS)
  56. # To enable Linux goodies, -DLUA_USE_LINUX
  57. # For C89, "-std=c89 -DLUA_USE_C89"
  58. # Note that Linux/Posix options are not compatible with C89
  59. MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX
  60. MYLDFLAGS= $(LOCAL) -Wl,-E
  61. MYLIBS= -ldl
  62. CC= gcc
  63. CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common -march=native
  64. AR= ar rc
  65. RANLIB= ranlib
  66. RM= rm -f
  67. # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
  68. LIBS = -lm
  69. CORE_T= liblua.a
  70. CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
  71. lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
  72. ltm.o lundump.o lvm.o lzio.o ltests.o
  73. AUX_O= lauxlib.o
  74. LIB_O= lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o \
  75. lutf8lib.o loadlib.o lcorolib.o linit.o
  76. LUA_T= lua
  77. LUA_O= lua.o
  78. ALL_T= $(CORE_T) $(LUA_T)
  79. ALL_O= $(CORE_O) $(LUA_O) $(AUX_O) $(LIB_O)
  80. ALL_A= $(CORE_T)
  81. all: $(ALL_T)
  82. touch all
  83. o: $(ALL_O)
  84. a: $(ALL_A)
  85. $(CORE_T): $(CORE_O) $(AUX_O) $(LIB_O)
  86. $(AR) $@ $?
  87. $(RANLIB) $@
  88. $(LUA_T): $(LUA_O) $(CORE_T)
  89. $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(CORE_T) $(LIBS) $(MYLIBS) $(DL)
  90. clean:
  91. $(RM) $(ALL_T) $(ALL_O)
  92. depend:
  93. @$(CC) $(CFLAGS) -MM *.c
  94. echo:
  95. @echo "CC = $(CC)"
  96. @echo "CFLAGS = $(CFLAGS)"
  97. @echo "AR = $(AR)"
  98. @echo "RANLIB = $(RANLIB)"
  99. @echo "RM = $(RM)"
  100. @echo "MYCFLAGS = $(MYCFLAGS)"
  101. @echo "MYLDFLAGS = $(MYLDFLAGS)"
  102. @echo "MYLIBS = $(MYLIBS)"
  103. @echo "DL = $(DL)"
  104. $(ALL_O): makefile ltests.h
  105. # DO NOT EDIT
  106. # automatically made with 'gcc -MM l*.c'
  107. lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  108. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
  109. ltable.h lundump.h lvm.h
  110. lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h llimits.h
  111. lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  112. llimits.h
  113. lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  114. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  115. ldo.h lgc.h lstring.h ltable.h lvm.h lopnames.h
  116. lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  117. llimits.h
  118. lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
  119. ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
  120. ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  121. lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
  122. ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
  123. ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  124. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
  125. lparser.h lstring.h ltable.h lundump.h lvm.h
  126. ldump.o: ldump.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  127. lobject.h ltm.h lzio.h lmem.h lgc.h ltable.h lundump.h
  128. lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  129. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
  130. lgc.o: lgc.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 llex.h lstring.h \
  132. ltable.h
  133. linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h llimits.h
  134. liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
  135. llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
  136. lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
  137. lstring.h ltable.h
  138. lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  139. llimits.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. llimits.h
  144. lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
  145. ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
  146. lvm.h
  147. lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h \
  148. lobject.h
  149. loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
  150. lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  151. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  152. ldo.h lfunc.h lstring.h lgc.h ltable.h
  153. lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  154. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
  155. lstring.h ltable.h
  156. lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  157. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
  158. lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  159. llimits.h
  160. ltable.o: ltable.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. ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  163. llimits.h
  164. ltests.o: ltests.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  165. lobject.h ltm.h lzio.h lmem.h lauxlib.h lcode.h llex.h lopcodes.h \
  166. lparser.h lctype.h ldebug.h ldo.h lfunc.h lopnames.h lstring.h lgc.h \
  167. ltable.h lualib.h
  168. ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  169. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  170. lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
  171. lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  172. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
  173. ltable.h lundump.h
  174. lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
  175. llimits.h
  176. lvm.o: lvm.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  177. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
  178. lstring.h ltable.h lvm.h ljumptab.h
  179. lzio.o: lzio.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  180. lobject.h ltm.h lzio.h lmem.h
  181. # (end of Makefile)