svn 15355 replaced "BusyBox is licensed under the GNU General Public Public
[oweals/busybox.git] / Rules.mak
index 6df828c7c658a03fb75114b2a2eab871ee62081f..d8614e625706d852d05c0aa727618755226c6cf6 100644 (file)
--- a/Rules.mak
+++ b/Rules.mak
@@ -15,7 +15,7 @@ PROG      := busybox
 MAJOR_VERSION   :=1
 MINOR_VERSION   :=2
 SUBLEVEL_VERSION:=0
-EXTRAVERSION    :=
+EXTRAVERSION    :=-svn
 VERSION   :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
 BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
 
@@ -166,15 +166,17 @@ LD_END_GROUP:= -Wl,--end-group
 endif
 
 CHECKED_LDFLAGS := $(call check_ld,$(LD),--warn-common,)
+#CHECKED_LDFLAGS := $(call check_ld,$(LD),-static-libgcc,)
 
 # Pin CHECKED_CFLAGS with := so it's only evaluated once.
 CHECKED_CFLAGS:=$(call check_cc,$(CC),-Wall,)
 CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,)
 CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,)
 CHECKED_CFLAGS+=$(call check_cc,$(CC),-funsigned-char,)
-CHECKED_CFLAGS+=$(call check_cc,$(CC),-mmax-stack-frame=256,)
-CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen)
-CHECKED_CFLAGS+=$(call check_cc,$(CC),-finline-limit=0)
+CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen,)
+CHECKED_CFLAGS+=$(call check_cc,$(CC),-finline-limit=0,)
+CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winline,)
+CHECKED_CFLAGS+=$(call check_cc,$(CC),-static-libgcc,)
 
 # Preemptively pin this too.
 PROG_CFLAGS:=
@@ -215,11 +217,13 @@ endif
 ifeq ($(strip $(TARGET_ARCH)),i386)
        OPTIMIZATION+=$(call check_cc,$(CC),-march=i386,)
 # gcc-4.0 and older seem to benefit from these
-#ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
+ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
        OPTIMIZATION+=$(call check_cc,$(CC),-mpreferred-stack-boundary=2,)
-       OPTIMIZATION+=$(call check_cc,$(CC),-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
-               -malign-functions=0 -malign-jumps=0 -malign-loops=0)
-#endif # gcc-4.0 and older
+       OPTIMIZATION+=$(call check_cc,$(CC),-falign-functions=1 -falign-jumps=1 -falign-loops=1, -malign-functions=0 -malign-jumps=0 -malign-loops=0,)
+
+       # gcc 4.1 produces many broken, totally invalid warnings
+       CHECKED_CFLAGS+=$(call check_cc,$(CC),-Werror,)
+endif # gcc-4.0 and older
 
 # gcc-4.1 and beyond seem to benefit from these
 ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
@@ -232,7 +236,7 @@ ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
 endif # gcc-4.1 and beyond
 endif
 OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,)
-OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
+CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,)
 
 #
 #--------------------------------------------------------
@@ -263,8 +267,6 @@ ifeq ($(strip $(CONFIG_DEBUG)),y)
     CFLAGS +=-g
 else
     CFLAGS +=-DNDEBUG
-    CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,)
-    CHECKED_LDFLAGS += $(call check_ld,--gc-sections,)
 endif
 
 ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y)
@@ -284,6 +286,11 @@ endif
 STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP))
 ifeq ($(strip $(CONFIG_STATIC)),y)
     PROG_CFLAGS += $(call check_cc,$(CC),-static,)
+else
+    ifneq ($(strip $(CONFIG_DEBUG)),y)
+        OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
+        CHECKED_LDFLAGS += $(call check_ld,$(LD),--gc-sections,)
+    endif
 endif
 CFLAGS_SHARED := $(call check_cc,$(CC),-shared,)
 LIB_CFLAGS+=$(CFLAGS_SHARED)
@@ -294,7 +301,7 @@ ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
 endif
 
 ifeq ($(strip $(CONFIG_SELINUX)),y)
-    LIBRARIES += -lselinux
+    LIBRARIES += -lselinux -lsepol
 endif
 
 ifeq ($(strip $(PREFIX)),)
@@ -358,36 +365,36 @@ endif
 endif
 
 show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
-pur_disp_compile.c = echo "  "CC $(show_objs)
-pur_disp_compile.h = echo "  "HOSTCC $(show_objs)
-pur_disp_strip     = echo "  "STRIP $(show_objs)
-pur_disp_link      = echo "  "LINK $(show_objs)
-pur_disp_link.h    = echo "  "HOSTLINK $(show_objs)
-pur_disp_ar        = echo "  "AR $(ARFLAGS) $(show_objs)
-pur_disp_elf2flt   = echo "  "ELF2FLT $(ELF2FLTFLAGS) $(show_objs)
-sil_disp_compile.c = true
-sil_disp_compile.h = true
-sil_disp_strip     = true
-sil_disp_link      = true
-sil_disp_link.h    = true
-sil_disp_ar        = true
-sil_disp_elf2flt   = true
-ver_disp_compile.c = echo $(cmd_compile.c)
-ver_disp_compile.h = echo $(cmd_compile.h)
-ver_disp_strip     = echo $(cmd_strip)
-ver_disp_link      = echo $(cmd_link)
-ver_disp_link.h    = echo $(cmd_link.h)
-ver_disp_ar        = echo $(cmd_ar)
-ver_disp_elf2flt   = echo $(cmd_elf2flt)
-disp_compile.c     = $($(DISP)_disp_compile.c)
-disp_compile.h     = $($(DISP)_disp_compile.h)
-disp_strip         = $($(DISP)_disp_strip)
-disp_link          = $($(DISP)_disp_link)
-disp_link.h        = $($(DISP)_disp_link.h)
-disp_ar            = $($(DISP)_disp_ar)
+pur_disp_compile.c = echo "  "CC $(show_objs) ;
+pur_disp_compile.h = echo "  "HOSTCC $(show_objs) ;
+pur_disp_strip     = echo "  "STRIP $(show_objs) ;
+pur_disp_link      = echo "  "LINK $(show_objs) ;
+pur_disp_link.h    = echo "  "HOSTLINK $(show_objs) ;
+pur_disp_ar        = echo "  "AR $(ARFLAGS) $(show_objs) ;
+pur_disp_elf2flt   = echo "  "ELF2FLT $(ELF2FLTFLAGS) $(show_objs) ;
+sil_disp_compile.c = 
+sil_disp_compile.h = 
+sil_disp_strip     = 
+sil_disp_link      = 
+sil_disp_link.h    = 
+sil_disp_ar        = 
+sil_disp_elf2flt   = 
+ver_disp_compile.c = 
+ver_disp_compile.h = 
+ver_disp_strip     = 
+ver_disp_link      = 
+ver_disp_link.h    = 
+ver_disp_ar        = 
+ver_disp_elf2flt   = 
+disp_compile.c     = $(Q)$($(DISP)_disp_compile.c)
+disp_compile.h     = $(Q)$($(DISP)_disp_compile.h)
+disp_strip         = $(Q)$($(DISP)_disp_strip)
+disp_link          = $(Q)$($(DISP)_disp_link)
+disp_link.h        = $(Q)$($(DISP)_disp_link.h)
+disp_ar            = $(Q)$($(DISP)_disp_ar)
+disp_elf2flt       = $(Q)$($(DISP)_disp_elf2flt)
 disp_gen           = $(SECHO) "  "GEN $@ ; true
 disp_doc           = $(SECHO) "  "DOC $(subst docs/,,$@) ; true
-disp_elf2flt       = $($(DISP)_disp_elf2flt)
 cmd_compile.c      = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
 cmd_compile.h      = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $<
 cmd_strip          = $(STRIPCMD) $@
@@ -406,14 +413,14 @@ cmd_link.so        = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
 cmd_link.h         = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@
 cmd_ar             = $(AR) $(ARFLAGS) $@ $^
 cmd_elf2flt        = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@
-compile.c          = @$(disp_compile.c) ; $(cmd_compile.c)
-compile.h          = @$(disp_compile.h) ; $(cmd_compile.h)
-do_strip           = @$(disp_strip)     ; $(cmd_strip)
-do_link            = @$(disp_link)      ; $(cmd_link)
-do_link.so         = @$(disp_link)      ; $(cmd_link.so)
-do_link.h          = @$(disp_link.h)    ; $(cmd_link.h)
-do_ar              = @$(disp_ar)        ; $(cmd_ar)
-do_elf2flt         = @$(disp_elf2flt)   ; $(cmd_elf2flt)
+compile.c          = $(disp_compile.c) $(cmd_compile.c)
+compile.h          = $(disp_compile.h) $(cmd_compile.h)
+do_strip           = $(disp_strip)     $(cmd_strip)
+do_link            = $(disp_link)      $(cmd_link)
+do_link.so         = $(disp_link)      $(cmd_link.so)
+do_link.h          = $(disp_link.h)    $(cmd_link.h)
+do_ar              = $(disp_ar)        $(cmd_ar)
+do_elf2flt         = $(disp_elf2flt)   $(cmd_elf2flt)
 
 uppercase = $(shell echo $1 | $(SED) -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/")
 %.a: