makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. -fmax-errors=5 \
  7. -Wextra \
  8. -Wshadow \
  9. -Wsign-compare \
  10. -Wundef \
  11. -Wwrite-strings \
  12. -Wredundant-decls \
  13. -Wdisabled-optimization \
  14. -Wdouble-promotion \
  15. -Wlogical-op \
  16. -Wno-aggressive-loop-optimizations \
  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. # -Wconversion \
  22. # -Wsign-conversion \
  23. # -Wstrict-overflow=2 \
  24. # -Wformat=2 \
  25. # -Wcast-qual \
  26. # The next warnings are neither valid nor needed for C++
  27. CWARNSC= -Wdeclaration-after-statement \
  28. -Wmissing-prototypes \
  29. -Wnested-externs \
  30. -Wstrict-prototypes \
  31. -Wc++-compat \
  32. -Wold-style-definition \
  33. CWARNS= $(CWARNSCPP) $(CWARNSC)
  34. # Some useful compiler options for internal tests:
  35. # -DLUAI_ASSERT turns on all assertions inside Lua.
  36. # -DHARDSTACKTESTS forces a reallocation of the stack at every point where
  37. # the stack can be reallocated.
  38. # -DHARDMEMTESTS forces a full collection at all points where the collector
  39. # can run.
  40. # -DEMERGENCYGCTESTS forces an emergency collection at every single allocation.
  41. # -DEXTERNMEMCHECK removes internal consistency checking of blocks being
  42. # deallocated (useful when an external tool like valgrind does the check).
  43. # -DMAXINDEXRK=k limits range of constants in RK instruction operands.
  44. # -DLUA_COMPAT_5_3
  45. # -pg -malign-double
  46. # -DLUA_USE_CTYPE -DLUA_USE_APICHECK
  47. # ('-ftrapv' for runtime checks of integer overflows)
  48. # -fsanitize=undefined -ftrapv -fno-inline
  49. # TESTS= -DLUA_USER_H='"ltests.h"' -O0 -g
  50. LOCAL = $(TESTS) $(CWARNS)
  51. # enable Linux goodies
  52. MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE
  53. MYLDFLAGS= $(LOCAL) -Wl,-E
  54. MYLIBS= -ldl -lreadline
  55. CC= gcc
  56. CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common -march=native
  57. AR= ar rc
  58. RANLIB= ranlib
  59. RM= rm -f
  60. # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
  61. LIBS = -lm
  62. CORE_T= liblua.a
  63. CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
  64. lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
  65. ltm.o lundump.o lvm.o lzio.o ltests.o
  66. AUX_O= lauxlib.o
  67. LIB_O= lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o \
  68. lutf8lib.o loadlib.o lcorolib.o linit.o
  69. LUA_T= lua
  70. LUA_O= lua.o
  71. ALL_T= $(CORE_T) $(LUA_T)
  72. ALL_O= $(CORE_O) $(LUA_O) $(AUX_O) $(LIB_O)
  73. ALL_A= $(CORE_T)
  74. all: $(ALL_T)
  75. touch all
  76. o: $(ALL_O)
  77. a: $(ALL_A)
  78. $(CORE_T): $(CORE_O) $(AUX_O) $(LIB_O)
  79. $(AR) $@ $?
  80. $(RANLIB) $@
  81. $(LUA_T): $(LUA_O) $(CORE_T)
  82. $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(CORE_T) $(LIBS) $(MYLIBS) $(DL)
  83. llex.o:
  84. $(CC) $(CFLAGS) -Os -c llex.c
  85. lparser.o:
  86. $(CC) $(CFLAGS) -Os -c lparser.c
  87. lcode.o:
  88. $(CC) $(CFLAGS) -Os -c lcode.c
  89. clean:
  90. $(RM) $(ALL_T) $(ALL_O)
  91. depend:
  92. @$(CC) $(CFLAGS) -MM *.c
  93. echo:
  94. @echo "CC = $(CC)"
  95. @echo "CFLAGS = $(CFLAGS)"
  96. @echo "AR = $(AR)"
  97. @echo "RANLIB = $(RANLIB)"
  98. @echo "RM = $(RM)"
  99. @echo "MYCFLAGS = $(MYCFLAGS)"
  100. @echo "MYLDFLAGS = $(MYLDFLAGS)"
  101. @echo "MYLIBS = $(MYLIBS)"
  102. @echo "DL = $(DL)"
  103. $(ALL_O): makefile ltests.h
  104. # DO NOT EDIT
  105. # automatically made with 'gcc -MM l*.c'
  106. lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  107. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \
  108. ltable.h lundump.h lvm.h
  109. lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h
  110. lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  111. lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  112. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  113. ldo.h lgc.h lstring.h ltable.h lvm.h
  114. lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  115. lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h
  116. ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  117. ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  118. lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \
  119. ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h
  120. ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  121. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \
  122. lparser.h lstring.h ltable.h lundump.h lvm.h
  123. ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \
  124. ltm.h lzio.h lmem.h lundump.h
  125. lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  126. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
  127. lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  128. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
  129. linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h
  130. liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  131. llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
  132. lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
  133. lstring.h ltable.h
  134. lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  135. lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  136. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h
  137. loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  138. lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \
  139. ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \
  140. lvm.h
  141. lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h
  142. loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  143. lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
  144. llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
  145. ldo.h lfunc.h lstring.h lgc.h ltable.h
  146. lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  147. lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \
  148. lstring.h ltable.h
  149. lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  150. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h
  151. lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  152. ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  153. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  154. ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  155. ltests.o: ltests.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
  156. lobject.h ltm.h lzio.h lmem.h lauxlib.h lcode.h llex.h lopcodes.h \
  157. lparser.h lctype.h ldebug.h ldo.h lfunc.h lopnames.h lstring.h lgc.h \
  158. ltable.h lualib.h
  159. ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  160. llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
  161. lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  162. lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \
  163. lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \
  164. lundump.h
  165. lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h
  166. lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
  167. llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \
  168. ltable.h lvm.h ljumptab.h
  169. lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \
  170. lobject.h ltm.h lzio.h
  171. # (end of Makefile)