makefile 7.6 KB

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