15
15
-include include/autoconf.h \
16
16
-D_GNU_SOURCE -DNDEBUG \
17
17
$(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
18
-D"BB_VER=KBUILD_STR($(BB_VER))"
18
$(if $(CONFIG_TIME64),-D_TIME_BITS=64) \
19
-DBB_VER=$(squote)$(quote)$(BB_VER)$(quote)$(squote)
20
21
CFLAGS += $(call cc-option,-Wall,)
21
22
CFLAGS += $(call cc-option,-Wshadow,)
58
59
CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
59
60
CFLAGS += $(call cc-option,-funsigned-char,)
62
ifeq ($(CONFIG_STATIC_LIBGCC),y)
63
# Disable it, for example, if you get
62
64
# "clang-9: warning: argument unused during compilation: '-static-libgcc'"
63
65
CFLAGS += $(call cc-option,-static-libgcc,)
77
79
CFLAGS += $(call cc-option,-fno-builtin-printf,)
79
81
# clang-9 does not like "str" + N and "if (CONFIG_ITEM && cond)" constructs
80
83
CFLAGS += $(call cc-option,-Wno-string-plus-int -Wno-constant-logical-operand)
82
86
# FIXME: These warnings are at least partially to be concerned about and should
84
88
#CFLAGS += $(call cc-option,-Wconversion,)
86
90
ifneq ($(CONFIG_DEBUG),y)
87
CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
91
CFLAGS += $(call cc-option,-Oz,$(call cc-option,-Os,$(call cc-option,-O2,)))
89
93
CFLAGS += $(call cc-option,-g,)
90
94
#CFLAGS += "-D_FORTIFY_SOURCE=2"
91
95
ifeq ($(CONFIG_DEBUG_PESSIMIZE),y)
92
96
CFLAGS += $(call cc-option,-O0,)
94
CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
98
CFLAGS += $(call cc-option,-Oz,$(call cc-option,-Os,$(call cc-option,-O2,)))
97
101
ifeq ($(CONFIG_DEBUG_SANITIZE),y)
142
146
export SYSROOT=$(CONFIG_SYSROOT)
149
# libm may be needed for dc, awk, ntpd
145
151
# Android has no separate crypt library
146
152
# gcc-4.2.1 fails if we try to feed C source on stdin:
147
153
# echo 'int main(void){return 0;}' | $(CC) $(CFLAGS) -lcrypt -o /dev/null -xc -
148
154
# fall back to using a temp file:
149
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c)
155
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -lcrypt -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
156
RT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -lrt -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
150
157
ifeq ($(CRYPT_AVAILABLE),y)
155
# libm may be needed for dc, awk, ntpd
156
160
# librt may be needed for clock_gettime()
161
ifeq ($(RT_AVAILABLE),y)
158
165
# libpam may use libpthread, libdl and/or libaudit.
159
166
# On some platforms that requires an explicit -lpthread, -ldl, -laudit.
180
187
ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
188
ifneq (,$(findstring linux,$(shell $(CC) $(CFLAGS) -dumpmachine)))
191
ifneq (,$(findstring gnu,$(shell $(CC) $(CFLAGS) -dumpmachine)))
184
196
ifeq ($(CONFIG_EFENCE),y)
207
ifneq ($(CONFIG_EXTRA_LDLIBS),)
208
LDLIBS += $(strip $(subst ",,$(CONFIG_EXTRA_LDLIBS)))
212
219
# Busybox is a stack-fatty so make sure we increase default size
213
220
# TODO: use "make stksizes" to find & fix big stack users
214
221
# (we stole scripts/checkstack.pl from the kernel... thanks guys!)