diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-05-12 19:38:40 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-05-12 19:38:40 +0000 |
commit | 3d427ac5efd249dc25dd03deb30520335f68911a (patch) | |
tree | b77ecc357ad981263f5c737c7aef4a32b345635c | |
parent | 59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c (diff) | |
download | busybox-3d427ac5efd249dc25dd03deb30520335f68911a.tar.gz |
Some experimental stuff (work in progress). heheh.
-Erik
-rw-r--r-- | Makefile | 38 |
1 files changed, 10 insertions, 28 deletions
@@ -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 |