aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 25 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ec02957ac..29a6cb0df 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,30 @@ DOSTATIC=false
#This will choke on a non-debian system
ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
+GCCMAJVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\1/p"`
+GCCMINVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\2/p"`
+
+GCCSUPPORTSOPTSIZE=$(shell \
+if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
+ if ( test $(GCCMINVERSION) -ge 95 ) ; 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
# -D_GNU_SOURCE is needed because environ is used in init.c
ifeq ($(DODEBUG),true)
@@ -38,7 +62,7 @@ ifeq ($(DODEBUG),true)
STRIP=
LDFLAGS=
else
- CFLAGS+=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
+ CFLAGS+=-Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
LDFLAGS= -s
STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
#Only staticly link when _not_ debugging