From 3d427ac5efd249dc25dd03deb30520335f68911a Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Fri, 12 May 2000 19:38:40 +0000 Subject: [PATCH] Some experimental stuff (work in progress). heheh. -Erik --- Makefile | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index d7b1a9bdb..1ea5368d0 100644 --- a/Makefile +++ b/Makefile @@ -31,37 +31,12 @@ DODEBUG = true # If you want a static binary, turn this on. DOSTATIC = false -# Figure out what arch we are on (not used at the moment) -ARCH := $(shell uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/') - - CC = gcc -GCCMAJVERSION = $(shell $(CC) --version | cut -f1 -d'.') -GCCMINVERSION = $(shell $(CC) --version | cut -f2 -d'.') - +# use '-Os' optimization if available, else use -O2 +OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ + then echo "-Os"; else echo "-O2" ; fi) -GCCSUPPORTSOPTSIZE = $(shell \ -if ( test $(GCCMAJVERSION) -eq 2 ) ; then \ - if ( test $(GCCMINVERSION) -ge 66 ) ; then \ - echo "true"; \ - else \ - echo "false"; \ - fi; \ -else \ - if ( test $(GCCMAJVERSION) -gt 2 ) ; then \ - echo "true"; \ - else \ - echo "false"; \ - fi; \ -fi; ) - - -ifeq ($(GCCSUPPORTSOPTSIZE), true) - OPTIMIZATION = -Os -else - OPTIMIZATION = -O2 -endif # Allow alternative stripping tools to be used... ifndef $(STRIPTOOL) @@ -99,6 +74,13 @@ ifdef BB_INIT_SCRIPT CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' endif +# use '-ffunction-sections -fdata-sections' and '--gc-sections' if they work +ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \ + -o /dev/null -xc /dev/null && $(LD) --gc-sections -v >/dev/null && echo 1),1) + CFLAGS += -ffunction-sections -fdata-sections -DFUNCTION_SECTIONS + LDFLAGS += --gc-sections +endif + all: busybox busybox.links doc doc: docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html -- 2.25.1