PROG := busybox
MAJOR_VERSION :=1
MINOR_VERSION :=1
-SUBLEVEL_VERSION:=0
-EXTRAVERSION :=-rc1
+SUBLEVEL_VERSION:=1
+EXTRAVERSION :=-pre0
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
then echo "$(1)"; else echo "$(2)"; fi \
fi)
-# Setup some shortcuts so that silent mode is silent like it should be
-ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
-export MAKE_IS_SILENT=n
-SECHO=@echo
-else
-export MAKE_IS_SILENT=y
-SECHO=-@false
-endif
+# A not very robust macro to check for available ld flags
+check_ld=$(shell \
+ if [ "x$(1)" != "x" ]; then \
+ $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
+ fi)
CFLAGS+=$(call check_gcc,-funsigned-char,)
ifeq ($(CONFIG_BUILD_AT_ONCE),y)
# gcc 2.95 exits with 0 for "unrecognized option"
ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0)
- OPTIMIZATION+=$(call check_gcc,-combine,)
+ OPTIMIZATION+=$(call check_gcc,--combine,)
endif
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
endif # CONFIG_BUILD_AT_ONCE
+LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,)
+#LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,)
+#LIB_LDFLAGS+=$(call check_ld,--as-needed,)
+#LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,)
+
+
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
- OPTIMIZATION+=$(call check_gcc,-msingle-pic-base,)
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,)
OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
endif # gcc-4.1 and beyond
endif
-OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
+OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,)
#
#--------------------------------------------------------
endif
ifeq ($(strip $(CONFIG_DEBUG)),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
- LDFLAGS +=-Wl,-warn-common
+ LDFLAGS += $(call check_ld,--warn-common,)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
- LDFLAGS += -Wl,-warn-common -Wl,--sort-common
+ LDFLAGS += $(call check_ld,--warn-common,)
+ LDFLAGS += $(call check_ld,--sort-common,)
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(CONFIG_STATIC)),y)
- LDFLAGS += --static
-#else
-# LIBRARIES += -ldl
+ PROG_CFLAGS += $(call check_gcc,-static,)
endif
+CFLAGS_SHARED += $(call check_gcc,-shared,)
+LIB_CFLAGS+=$(CFLAGS_SHARED)
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
- CFLAGS_PIC:= -fPIC #-DPIC
+ CFLAGS_PIC:= $(call check_gcc,-fPIC,)
endif
ifeq ($(strip $(CONFIG_SELINUX)),y)
INSTALL_OPTS=
endif
+#------------------------------------------------------------
+# Make the output nice and tight
+MAKEFLAGS += --no-print-directory
+export MAKE_IS_SILENT=n
+ifneq ($(findstring s,$(MAKEFLAGS)),)
+export MAKE_IS_SILENT=y
+SECHO := @-false
+DISP := sil
+Q := @
+else
+ifneq ($(V)$(VERBOSE),)
+SECHO := @-false
+DISP := ver
+Q :=
+else
+SECHO := @echo
+DISP := pur
+Q := @
+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_ar = echo " "AR $(ARFLAGS) $(show_objs)
+sil_disp_compile.c = true
+sil_disp_compile.h = true
+sil_disp_strip = true
+sil_disp_link = true
+sil_disp_ar = 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_ar = echo $(cmd_ar)
+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_ar = $($(DISP)_disp_ar)
+disp_gen = $(SECHO) " "GEN $@ ; true
+disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true
+cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
+cmd_strip = $(STRIPCMD) $@
+cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
+cmd_ar = $(AR) $(ARFLAGS) $@ $^
+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_ar = @$(disp_ar) ; $(cmd_ar)
+
.PHONY: dummy