# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
+# be gentle to vi coloring.. ")
# To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs...
# A nifty macro to make testing gcc features easier, but note that everything
# that uses this _must_ use := or it will be re-evaluated everytime it is
# referenced.
-ifeq ($(strip $(V)),2)
+ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2;
endif
check_cc=$(shell \
rm -f conftest.c conftest.o; \
fi)
+ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
+check_cc:=
+endif
+
# A not very robust macro to check for available ld flags
-ifeq ($(strip $(V)),2)
+ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2;
endif
check_ld=$(shell \
echo "-Wl,$(2)" ; \
fi)
+ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
+check_ld:=
+endif
+
# A not very robust macro to check for available strip flags
-ifeq ($(strip $(V)),2)
+ifeq ($(strip $(BUILD_VERBOSE)),2)
VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2;
endif
check_strip=$(shell \
rm -f conftest.c conftest.o > /dev/null 2>&1 ; \
fi)
+ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),)
+check_strip:=
+endif
# Select the compiler needed to build binaries for your development system
$(AR) $(ARFLAGS) conftest.a conftest.o ; \
$(CC) -Wl,--start-group conftest.a conftest_main.o -Wl,--end-group \
-o conftest > /dev/null 2>&1 && echo "-Wl,--start-group" ; \
- echo rm conftest_main.o conftest_main.c conftest.o conftest.c \
+ rm conftest_main.o conftest_main.c conftest.o conftest.c \
conftest.a conftest > /dev/null 2>&1 ; )
ifneq ($(findstring start-group,$(LD_START_GROUP)),)
LD_END_GROUP:= -Wl,--end-group
endif # gcc-4.1 and beyond
endif
OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,)
+OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,)
#
#--------------------------------------------------------
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)
PREFIX:=`pwd`/_install
endif
-#ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
-# CFLAGS += -D__need_getopt
-#endif
+ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
+ CFLAGS += -D__need_getopt
+endif
# Additional complications due to support for pristine source dir.
# Include files in the build directory should take precedence over
DISP := sil
Q := @
else
-ifneq ($(V)$(VERBOSE),)
+ifneq ($(BUILD_VERBOSE),)
SECHO := @-false
DISP := ver
Q :=
cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $<
cmd_strip = $(STRIPCMD) $@
-cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
+cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
+ $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
+ -o $@ $(LD_START_GROUP) \
+ $(APPLETS_DEFINE) $(APPLET_SRC) \
+ $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
+ $(LDBUSYBOX) $(LIBRARIES) \
+ $(LD_END_GROUP)
+cmd_link.so = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
+ $(LIB_CFLAGS) $(CFLAGS_COMBINE) $(LIB_LDFLAGS) \
+ -o $(@) $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \
+ $(LIBRARY_DEFINE) $(^) \
+ $(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP)
cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@
cmd_ar = $(AR) $(ARFLAGS) $@ $^
cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@
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 | tr '[:lower:]' '[:upper:]')
+uppercase = $(shell echo $1 | $(SED) -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/")
%.a:
@if test -z "$($(call uppercase,$*)_DIR)" ; then \
echo "Invalid target $@" ; \