1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
--- Makefile.orig 2019-12-22 07:58:45.850503487 -0800
+++ Makefile 2019-12-22 08:17:35.475369649 -0800
@@ -112,8 +112,8 @@
# compiler settings
PRE ?=
-CC = $(PRE)gcc
-CPP = $(PRE)g++
+CC ?= $(PRE)gcc
+CXX ?= $(PRE)g++
STRIP = $(PRE)strip
#-------------------------------------------------------------------------------
@@ -243,7 +243,8 @@
DCLIB_DIR := ./dclib
DIR_LIST += $(DCLIB_DIR)
VPATH += $(DCLIB_DIR)
-CFLAGS += -I$(DCLIB_DIR)
+CFLAGS ?= -O3 -funroll-loops
+DEF_FLAGS := -I$(DCLIB_DIR)
# other objects
WIT_O := lib-std.o lib-file.o lib-sf.o \
@@ -297,17 +298,17 @@
DEFINES1 += -D_LZMA_PROB32=1 # LZMA option
DEFINES = $(strip $(DEFINES1) $(MODE) $(XDEF))
-CFLAGS += -fomit-frame-pointer -fno-strict-aliasing -funroll-loops
-CFLAGS += -Wall -Wno-parentheses -Wno-unused-function
-#CFLAGS += -O3 -Isrc/libwbfs -Isrc/lzma -Isrc -I$(UI) -I. -Iwork
-CFLAGS += -O3 -Isrc/libwbfs -Isrc -I$(UI) -I. -Iwork
+DEF_FLAGS += -fomit-frame-pointer -fno-strict-aliasing
+DEF_FLAGS += -Wall -Wno-parentheses -Wno-unused-function
+#DEF_FLAGS += -Isrc/libwbfs -Isrc/lzma -Isrc -I$(UI) -I. -Iwork
+DEF_FLAGS += -Isrc/libwbfs -Isrc -I$(UI) -I. -Iwork
ifeq ($(SYSTEM),cygwin)
- CFLAGS += -Wno-format-truncation
+ DEF_FLAGS += -Wno-format-truncation
else ifeq ($(SYSTEM),mac)
- CFLAGS += -I/usr/local/include
+ DEF_FLAGS += -I/usr/local/include
endif
-CFLAGS += $(XFLAGS)
-CFLAGS := $(strip $(CFLAGS))
+DEF_FLAGS += $(XFLAGS)
+DEF_FLAGS := $(strip $(DEF_FLAGS))
DEPFLAGS += -MMD
@@ -371,7 +372,7 @@
$(ALL_TOOLS_X): %: %.o $(ALL_OBJECTS) $(TOBJ_ALL) Makefile | $(HELPER_TOOLS)
@printf "$(LOGFORMAT_TOOL)" tool "$@" "$(MODE) $(TOPT_$@) $(TOBJ_$@)"
- @$(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $@.o \
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEFINES) $(LDFLAGS) $@.o \
$(ALL_OBJECTS) $(TOBJ_$@) $(LIBS) $(TOPT_$@) -o $@
@if test -f $@.exe; then $(STRIP) $@.exe; else $(STRIP) $@; fi
@@ -384,7 +385,7 @@
$(HELPER_TOOLS): %: %.o $(ALL_OBJECTS) $(UI_TABS) Makefile
@printf "$(LOGFORMAT_TOOL)" helper "$@ $(TOBJ_$@)" "$(MODE)"
- @$(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $@.o \
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEFINES) $(LDFLAGS) $@.o \
$(ALL_OBJECTS) $(TOBJ_$@) $(LIBS) -o $@
#--------------------------
@@ -397,19 +398,19 @@
$(UI_OBJECTS): %.o: %.c ui-%.c ui-%.h version.h Makefile
@printf "$(LOGFORMAT_CC)" +object "$@" "$(MODE)"
- @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
#--------------------------
$(C_OBJECTS): %.o: %.c version.h Makefile $(TEXT_FILES)
@printf "$(LOGFORMAT_CC)" object "$@" "$(MODE)"
- @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
#--------------------------
$(ASM_OBJECTS): %.o: %.S Makefile
@printf "$(LOGFORMAT_CC)" asm "$@" "$(MODE)"
- @$(CC) $(CFLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEPFLAGS) $(DEFINES) -c $< -o $@
#--------------------------
@@ -442,11 +443,11 @@
$(LIBBZ2_OBJ): %.o: %.c Makefile
@printf "$(LOGFORMAT_CC)" object "$(subst src/libbz2/,,$@)" "$(MODE) [libbz2]"
- @$(CC) $(CFLAGS) $(DEPFLAGS) $(BZIP2_FLAGS) $(DEFINES) -c $< -o $@
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEPFLAGS) $(BZIP2_FLAGS) $(DEFINES) -c $< -o $@
$(LZMA_OBJ): %.o: %.c Makefile
@printf "$(LOGFORMAT_CC)" object "$(subst src/lzma/,,$@)" "$(MODE) [lzma]"
- @$(CC) $(CFLAGS) $(DEPFLAGS) $(LZMA_FLAGS) $(DEFINES) -c $< -o $@
+ @$(CC) $(CFLAGS) $(DEF_FLAGS) $(DEPFLAGS) $(LZMA_FLAGS) $(DEFINES) -c $< -o $@
#
###############################################################################
@@ -658,6 +659,8 @@
@echo ""
@echo "CFLAGS: $(CFLAGS)"
@echo ""
+ @echo "DEF_FLAGS: $(DEF_FLAGS)"
+ @echo ""
@echo "LDFLAGS: $(LDFLAGS)"
@echo ""
@echo "LIBS: $(LIBS)"
@@ -1005,7 +1008,7 @@
@echo " make old enable '-DOLD_FEATURES'"
@echo " make wait enable '-DWAIT'"
@echo " make testtrace enable '-DTESTTRACE'"
- @echo " make flags print DEFINES, CFLAGS and LDFLAGS"
+ @echo " make flags print DEFINES, CFLAGS, DEF_FLAGS and LDFLAGS"
@echo ""
@echo " make doc generate doc files from their templates"
@echo " make distrib make all & build $(DISTRIB_PATH)"
|