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