gzip: fix a case where tar xzf fails (we use uninitialized fd)
[oweals/busybox.git] / Makefile.flags
index 487300de263857d1bfac0d2d75aab6263dfd722c..c023299d737be6703bfa52653917393711b9cb81 100644 (file)
@@ -3,6 +3,8 @@
 # ==========================================================================
 
 BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+export BB_VER
+SKIP_STRIP = n
 
 # -std=gnu99 needed for [U]LLONG_MAX on some systems
 CPPFLAGS += $(call cc-option,-std=gnu99,)
@@ -27,6 +29,9 @@ CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
 
 ifeq ($(CONFIG_WERROR),y)
 CFLAGS += $(call cc-option,-Werror,)
+else
+# for development, warn a little bit about unused results..
+CPPFLAGS += -D_FORTIFY_SOURCE=2
 endif
 # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
 CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
@@ -51,20 +56,45 @@ ifeq ($(CONFIG_DEBUG),y)
 CFLAGS += $(call cc-option,-g)
 endif
 
+ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
+# on i386: 14% smaller libbusybox.so
+# (code itself is 9% bigger, we save on relocs/PLT/GOT)
+CFLAGS += -fpic
+# and another 4% reduction of libbusybox.so:
+# (external entry points must be marked EXTERNALLY_VISIBLE)
+CFLAGS += $(call cc-option,-fvisibility=hidden)
+endif
+
 ifeq ($(CONFIG_STATIC),y)
 LDFLAGS += -static
 endif
 
+LDLIBS += m crypt
+
+ifeq ($(CONFIG_PAM),y)
+LDLIBS += pam pam_misc
+endif
+
 ifeq ($(CONFIG_SELINUX),y)
-LDFLAGS += -lselinux -lsepol
+LDLIBS += selinux sepol
 endif
 
 ifeq ($(CONFIG_EFENCE),y)
-LDFLAGS += -lefence
+LDLIBS += efence
 endif
 
 ifeq ($(CONFIG_DMALLOC),y)
-LDFLAGS += -ldmalloc
+LDLIBS += dmalloc
 endif
 
 #LDFLAGS += -nostdlib
+
+LDFLAGS_ELF2FLT = -Wl,-elf2flt
+ifneq (,$(findstring $(LDFLAGS_ELF2FLT),$(LDFLAGS)))
+SKIP_STRIP = y
+endif
+
+# Busybox is a stack-fatty so make sure we increase default size
+# TODO: use "make stksizes" to find & fix big stack users
+# (we stole scripts/checkstack.pl from the kernel... thanks guys!)
+FLTFLAGS += -s 20000