Added CONFIG_CLEAR and CONFIG_RESET to config.maemo
[busybox4maemo] / Makefile.flags
1 # ==========================================================================
2 # Build system
3 # ==========================================================================
4
5 BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
6 export BB_VER
7 SKIP_STRIP = n
8
9 # -std=gnu99 needed for [U]LLONG_MAX on some systems
10 CPPFLAGS += $(call cc-option,-std=gnu99,)
11
12 CPPFLAGS += \
13         -Iinclude -Ilibbb \
14         $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) -I$(srctree)/libbb \
15         -include include/autoconf.h \
16         -D_GNU_SOURCE -DNDEBUG \
17         $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
18         -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP
19
20 # flag checks are grouped together to speed the checks up a bit..
21 CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,)
22 CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
23 CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
24 # If you want to add "-Wmissing-prototypes -Wmissing-declarations" above
25 # (or anything else for that matter) make sure that it is still possible
26 # to build bbox without warnings. Current offender: find.c:alloc_action().
27 # Looks more like gcc bug: gcc will warn on it with or without prototype.
28 # But still, warning-free compile is a must, or else we will drown
29 # in warnings pretty soon.
30
31 ifeq ($(CONFIG_WERROR),y)
32 CFLAGS += $(call cc-option,-Werror,)
33 else
34 # for development, warn a little bit about unused results..
35 CPPFLAGS += -D_FORTIFY_SOURCE=2
36 endif
37 # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
38 CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
39
40 # gcc emits bogus "no prev proto" warning on find.c:alloc_action()
41 ifneq ($(CONFIG_WERROR),y)
42 CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
43 endif
44
45 CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
46 # -fno-guess-branch-probability: prohibit pseudo-random guessing
47 # of branch probabilities (hopefully makes bloatcheck more stable):
48 CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
49 CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
50 CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
51
52 # FIXME: These warnings are at least partially to be concerned about and should
53 # be fixed..
54 #CFLAGS+=$(call cc-option,-Wconversion,)
55
56 ifeq ($(CONFIG_DEBUG),y)
57 CFLAGS += $(call cc-option,-g)
58 endif
59
60 ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
61 # on i386: 14% smaller libbusybox.so
62 # (code itself is 9% bigger, we save on relocs/PLT/GOT)
63 CFLAGS += -fpic
64 # and another 4% reduction of libbusybox.so:
65 # (external entry points must be marked EXTERNALLY_VISIBLE)
66 CFLAGS += $(call cc-option,-fvisibility=hidden)
67 endif
68
69 ifeq ($(CONFIG_STATIC),y)
70 LDFLAGS += -static
71 endif
72
73 LDLIBS += m crypt
74
75 ifeq ($(CONFIG_PAM),y)
76 LDLIBS += pam pam_misc
77 endif
78
79 ifeq ($(CONFIG_SELINUX),y)
80 LDLIBS += selinux sepol
81 endif
82
83 ifeq ($(CONFIG_EFENCE),y)
84 LDLIBS += efence
85 endif
86
87 ifeq ($(CONFIG_DMALLOC),y)
88 LDLIBS += dmalloc
89 endif
90
91 #LDFLAGS += -nostdlib
92
93 LDFLAGS_ELF2FLT = -Wl,-elf2flt
94 ifneq (,$(findstring $(LDFLAGS_ELF2FLT),$(LDFLAGS)))
95 SKIP_STRIP = y
96 endif
97
98 # Busybox is a stack-fatty so make sure we increase default size
99 # TODO: use "make stksizes" to find & fix big stack users
100 # (we stole scripts/checkstack.pl from the kernel... thanks guys!)
101 # Reduced from 20k to 16k in 1.9.0.
102 FLTFLAGS += -s 16000