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