new applets: selinux utils by KaiGai Kohei <kaigai@kaigai.gr.jp>
[platform/upstream/busybox.git] / Makefile.flags
1 # ==========================================================================
2 # Build system
3 # ==========================================================================
4
5 BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
6
7 # -std=gnu99 needed for [U]LLONG_MAX on some systems
8 CPPFLAGS += $(call cc-option,-std=gnu99,)
9
10 CPPFLAGS += \
11         -Iinclude -Ilibbb \
12         $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) -I$(srctree)/libbb \
13         -include include/autoconf.h \
14         -D_GNU_SOURCE -DNDEBUG \
15         $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
16         -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP
17
18 # flag checks are grouped together to speed the checks up a bit..
19 CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,)
20 CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
21 # If you want to add "-Wmissing-prototypes -Wmissing-declarations" above
22 # (or anything else for that matter) make sure that it is still possible
23 # to build bbox without warnings. Current offender: find.c:alloc_action().
24 # Looks more like gcc bug: gcc will warn on it with or without prototype.
25 # But still, warning-free compile is a must, or else we will drown
26 # in warnings pretty soon.
27
28 ifeq ($(CONFIG_WERROR),y)
29 CFLAGS += $(call cc-option,-Werror,)
30 endif
31 # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
32 CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
33
34 # gcc emits bogus "no prev proto" warning on find.c:alloc_action()
35 ifneq ($(CONFIG_WERROR),y)
36 CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
37 endif
38
39 CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
40 # -fno-guess-branch-probability: prohibit pseudo-random guessing
41 # of branch probabilities (hopefully makes bloatcheck more stable):
42 CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
43 CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
44 CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
45
46 # FIXME: These warnings are at least partially to be concerned about and should
47 # be fixed..
48 #CFLAGS+=$(call cc-option,-Wconversion,)
49
50 ifeq ($(CONFIG_DEBUG),y)
51 CFLAGS += $(call cc-option,-g)
52 endif
53
54 ifeq ($(CONFIG_STATIC),y)
55 LDFLAGS += -static
56 endif
57
58 ifeq ($(CONFIG_SELINUX),y)
59 LDFLAGS += -lselinux -lsepol
60 endif
61 #LDFLAGS += -nostdlib