fix trivial bug in unpack_gz_stream (wrong fd used in read)
[oweals/busybox.git] / Makefile.flags
index 60bb888d8db53d8dfdaaeee01abb4f3f500bd49c..ee4c518d8accba12e87880106a1bf687fdf842a7 100644 (file)
@@ -4,7 +4,7 @@
 
 BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 export BB_VER
-SKIP_STRIP = n
+SKIP_STRIP ?= n
 
 # -std=gnu99 needed for [U]LLONG_MAX on some systems
 CPPFLAGS += $(call cc-option,-std=gnu99,)
@@ -58,14 +58,14 @@ CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1
 #CFLAGS += $(call cc-option,-Wconversion,)
 
 ifneq ($(CONFIG_DEBUG),y)
-CFLAGS += $(call cc-option,-Os,)
+CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
 else
 CFLAGS += $(call cc-option,-g,)
 #CFLAGS += "-D_FORTIFY_SOURCE=2"
 ifeq ($(CONFIG_DEBUG_PESSIMIZE),y)
 CFLAGS += $(call cc-option,-O0,)
 else
-CFLAGS += $(call cc-option,-Os,)
+CFLAGS += $(call cc-option,-Os,$(call cc-option,-O2,))
 endif
 endif
 
@@ -97,10 +97,22 @@ CFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_CFLAGS)))
 #"))
 endif
 
+ifneq ($(CONFIG_CROSS_COMPILER_PREFIX),"arm-linux-androideabi-")
 LDLIBS += m crypt
+else
+# Android libc has no crypt. TODO: make a generic CONFIG_LINK_WITH_CRYPT option?
+LDLIBS += m
+endif
 
 ifeq ($(CONFIG_PAM),y)
-LDLIBS += pam pam_misc
+# libpam uses libpthread, so for static builds busybox must be linked to
+# libpthread. On some platforms that requires an explicit -lpthread, so
+# it should be in LDLIBS. For non-static builds, scripts/trylink will
+# take care of removing -lpthread if possible. (Not bothering to check
+# CONFIG_STATIC because even in a non-static build it could be that the
+# only libpam available is libpam.a, so -lpthread could still be
+# needed.)
+LDLIBS += pam pam_misc pthread
 endif
 
 ifeq ($(CONFIG_SELINUX),y)