Properly honor FILEUTILS_INTERACTIVE and FILEUTILS_FORCE for
[oweals/busybox.git] / Rules.mak
index 2e9aa27e6f0bfa7f7e9a1e155b9e34c15f7bac67..0f6f9b152e16fbd677aaec155e13bcc81b18a6cb 100644 (file)
--- a/Rules.mak
+++ b/Rules.mak
@@ -36,7 +36,7 @@ TARGET_OS:=linux
 # If you want to add some simple compiler switches (like -march=i686),
 # especially from the command line, use this instead of CFLAGS directly.
 # For optimization overrides, it's better still to set OPTIMIZATION.
-CFLAGS_EXTRA:=
+CFLAGS_EXTRA:=#-Werror
  
 # If you want a static binary, turn this on.
 DOSTATIC:=false
@@ -91,7 +91,7 @@ export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
 
 # To compile vs uClibc, just use the compiler wrapper built by uClibc...
 # Everything should compile and work as expected these days...
-#CC:=/usr/i386-linux-uclibc/usr/bin/i386-uclibc-gcc
+#CC:=/usr/i386-linux-uclibc/bin/i386-uclibc-gcc
 
 # To compile vs some other alternative libc, you may need to use/adjust
 # the following lines to meet your needs...
@@ -111,16 +111,46 @@ export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
 #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
 #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
 
-# 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}
-GCC_STACK_BOUNDRY:=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null \
-       >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; else echo "" ; fi}
-OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer $(GCC_STACK_BOUNDRY) #-fstrict-aliasing -march=i386 -mcpu=i386 -malign-functions=0 -malign-jumps=0
 WARNINGS:=-Wall -Wstrict-prototypes -Wshadow
 CFLAGS:=-I$(TOPDIR)include
 ARFLAGS:=-r
 
+TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \
+               -e 's/i.86/i386/' \
+               -e 's/sparc.*/sparc/' \
+               -e 's/arm.*/arm/g' \
+               -e 's/m68k.*/m68k/' \
+               -e 's/ppc/powerpc/g' \
+               -e 's/v850.*/v850/g' \
+               -e 's/sh[234]/sh/' \
+               -e 's/mips.*/mips/' \
+               }
+
+#--------------------------------------------------------
+# Arch specific compiler optimization stuff should go here.
+# Unless you want to override the defaults, do not set anything
+# for OPTIMIZATION...
+
+# 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}
+
+# Some nice architecture specific optimizations
+ifeq ($(strip $(TARGET_ARCH)),arm)
+       OPTIMIZATION+=-fstrict-aliasing
+endif
+ifeq ($(strip $(TARGET_ARCH)),i386)
+       OPTIMIZATION+=-march=i386
+       OPTIMIZATION+=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \
+               /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi}
+       OPTIMIZATION+=${shell if $(CC) -falign-functions=1 -falign-jumps=0 -falign-loops=0 \
+               -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo \
+               "-falign-functions=1 -falign-jumps=0 -falign-loops=0"; else \
+               if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \
+               /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi; fi}
+endif
+OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
+
 #
 #--------------------------------------------------------
 # If you're going to do a lot of builds with a non-vanilla configuration,