diff options
author | Li Jin <dragon-fly@qq.com> | 2020-06-22 17:10:43 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-06-22 17:10:43 +0800 |
commit | f335d19cdf76d6ce515600b51ef8e620a57f2d52 (patch) | |
tree | b6221c00c140f61a43df1828b2d714e0c8810113 | |
parent | cd2b60b101a398cb9356d746364e70eaed1860f1 (diff) | |
download | yuescript-f335d19cdf76d6ce515600b51ef8e620a57f2d52.tar.gz yuescript-f335d19cdf76d6ce515600b51ef8e620a57f2d52.tar.bz2 yuescript-f335d19cdf76d6ce515600b51ef8e620a57f2d52.zip |
clean up.
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | src/lua/makefile | 60 |
2 files changed, 42 insertions, 22 deletions
@@ -7,5 +7,5 @@ moonplus-*.rock* | |||
7 | !moonplus-dev-1.rockspec | 7 | !moonplus-dev-1.rockspec |
8 | .vs | 8 | .vs |
9 | bin | 9 | bin |
10 | src/lua-5.3/*.o | 10 | src/lua/*.o |
11 | src/lua-5.3/*.a | 11 | src/lua/*.a |
diff --git a/src/lua/makefile b/src/lua/makefile index 397c817..f21773e 100644 --- a/src/lua/makefile +++ b/src/lua/makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | # Warnings valid for both C and C++ | 7 | # Warnings valid for both C and C++ |
8 | CWARNSCPP= \ | 8 | CWARNSCPP= \ |
9 | -pedantic \ | 9 | -fmax-errors=5 \ |
10 | -Wextra \ | 10 | -Wextra \ |
11 | -Wshadow \ | 11 | -Wshadow \ |
12 | -Wsign-compare \ | 12 | -Wsign-compare \ |
@@ -14,14 +14,15 @@ CWARNSCPP= \ | |||
14 | -Wwrite-strings \ | 14 | -Wwrite-strings \ |
15 | -Wredundant-decls \ | 15 | -Wredundant-decls \ |
16 | -Wdisabled-optimization \ | 16 | -Wdisabled-optimization \ |
17 | -Waggregate-return \ | ||
18 | -Wdouble-promotion \ | 17 | -Wdouble-promotion \ |
19 | #-Wno-aggressive-loop-optimizations # not accepted by clang \ | 18 | -Wlogical-op \ |
20 | #-Wlogical-op # not accepted by clang \ | 19 | -Wno-aggressive-loop-optimizations \ |
21 | # the next warnings generate too much noise, so they are disabled | 20 | # the next warnings might be useful sometimes, |
22 | # -Wconversion -Wno-sign-conversion \ | 21 | # but usually they generate too much noise |
22 | # -Werror \ | ||
23 | # -pedantic # warns if we use jump tables \ | ||
24 | # -Wconversion \ | ||
23 | # -Wsign-conversion \ | 25 | # -Wsign-conversion \ |
24 | # -Wconversion \ | ||
25 | # -Wstrict-overflow=2 \ | 26 | # -Wstrict-overflow=2 \ |
26 | # -Wformat=2 \ | 27 | # -Wformat=2 \ |
27 | # -Wcast-qual \ | 28 | # -Wcast-qual \ |
@@ -35,12 +36,20 @@ CWARNSC= -Wdeclaration-after-statement \ | |||
35 | -Wold-style-definition \ | 36 | -Wold-style-definition \ |
36 | 37 | ||
37 | 38 | ||
38 | CWARNS= $(CWARNSCPP) $(CWARNSC) | 39 | CWARNS= $(CWARNSCPP) $(CWARNSC) |
39 | 40 | ||
40 | # -mtune=native -fomit-frame-pointer | ||
41 | # -fno-stack-protector | ||
42 | LOCAL = $(TESTS) $(CWARNS) -g | ||
43 | 41 | ||
42 | # -DEXTERNMEMCHECK -DHARDSTACKTESTS -DHARDMEMTESTS -DTRACEMEM='"tempmem"' | ||
43 | # -DMAXINDEXRK=1 -DLUA_COMPAT_5_3 | ||
44 | # -g -DLUA_USER_H='"ltests.h"' | ||
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 | |||
51 | |||
52 | LOCAL = $(CWARNS) | ||
44 | 53 | ||
45 | 54 | ||
46 | # enable Linux goodies | 55 | # enable Linux goodies |
@@ -48,9 +57,15 @@ MYCFLAGS= $(LOCAL) -std=c99 | |||
48 | MYLDFLAGS= $(LOCAL) -Wl | 57 | MYLDFLAGS= $(LOCAL) -Wl |
49 | MYLIBS= -ldl -lreadline | 58 | MYLIBS= -ldl -lreadline |
50 | 59 | ||
60 | UNAME_S:=$(shell uname -s) | ||
61 | ifeq ($(UNAME_S),Darwin) | ||
62 | MYCFLAGS += -DLUA_USE_MACOS | ||
63 | else | ||
64 | MYCFLAGS += -DLUA_USE_LINUX | ||
65 | endif | ||
51 | 66 | ||
52 | CC= gcc | 67 | CC= gcc |
53 | CFLAGS= -Wall -O2 $(MYCFLAGS) | 68 | CFLAGS= -Wall -O2 $(MYCFLAGS) -fno-stack-protector -fno-common -march=native |
54 | AR= ar rc | 69 | AR= ar rc |
55 | RANLIB= ranlib | 70 | RANLIB= ranlib |
56 | RM= rm -f | 71 | RM= rm -f |
@@ -75,6 +90,7 @@ ALL_O= $(CORE_O) $(AUX_O) $(LIB_O) | |||
75 | ALL_A= $(CORE_T) | 90 | ALL_A= $(CORE_T) |
76 | 91 | ||
77 | all: $(ALL_T) | 92 | all: $(ALL_T) |
93 | touch all | ||
78 | 94 | ||
79 | o: $(ALL_O) | 95 | o: $(ALL_O) |
80 | 96 | ||
@@ -84,11 +100,15 @@ $(CORE_T): $(CORE_O) $(AUX_O) $(LIB_O) | |||
84 | $(AR) $@ $? | 100 | $(AR) $@ $? |
85 | $(RANLIB) $@ | 101 | $(RANLIB) $@ |
86 | 102 | ||
87 | $(LUA_T): $(LUA_O) $(CORE_T) | 103 | llex.o: |
88 | $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(CORE_T) $(LIBS) $(MYLIBS) $(DL) | 104 | $(CC) $(CFLAGS) -Os -c llex.c |
105 | |||
106 | lparser.o: | ||
107 | $(CC) $(CFLAGS) -Os -c lparser.c | ||
108 | |||
109 | lcode.o: | ||
110 | $(CC) $(CFLAGS) -Os -c lcode.c | ||
89 | 111 | ||
90 | $(LUAC_T): $(LUAC_O) $(CORE_T) | ||
91 | $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(CORE_T) $(LIBS) $(MYLIBS) | ||
92 | 112 | ||
93 | clean: | 113 | clean: |
94 | $(RM) $(ALL_T) $(ALL_O) | 114 | $(RM) $(ALL_T) $(ALL_O) |
@@ -131,8 +151,8 @@ ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ | |||
131 | lparser.h lstring.h ltable.h lundump.h lvm.h | 151 | 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 \ | 152 | 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 | 153 | ltm.h lzio.h lmem.h lundump.h |
134 | lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ | 154 | lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ |
135 | lgc.h lstate.h ltm.h lzio.h lmem.h | 155 | 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 \ | 156 | 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 | 157 | 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 | 158 | linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h |
@@ -162,14 +182,14 @@ 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 | 182 | 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 | 183 | 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 \ | 184 | 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 lstring.h lgc.h ltable.h lvm.h | 185 | llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h |
166 | lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ | 186 | lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ |
167 | lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ | 187 | lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ |
168 | lundump.h | 188 | lundump.h |
169 | lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h | 189 | lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h |
170 | lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ | 190 | lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ |
171 | llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ | 191 | llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ |
172 | ltable.h lvm.h | 192 | ltable.h lvm.h ljumptab.h |
173 | lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ | 193 | lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ |
174 | lobject.h ltm.h lzio.h | 194 | lobject.h ltm.h lzio.h |
175 | 195 | ||