diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:50:49 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:50:49 +0000 |
commit | 5b0f9e417e8b7c7a0700cea4a550843a8c1af087 (patch) | |
tree | 96345c4e4c9f37215f4e71e56912cd42dd43378d | |
parent | 27f64e1f4eb4354844f6553e37501deffde8373e (diff) | |
download | busybox-w32-5b0f9e417e8b7c7a0700cea4a550843a8c1af087.tar.gz busybox-w32-5b0f9e417e8b7c7a0700cea4a550843a8c1af087.tar.bz2 busybox-w32-5b0f9e417e8b7c7a0700cea4a550843a8c1af087.zip |
Rework optimization code. Be more compiler aware.
-Erik
-rw-r--r-- | Rules.mak | 42 |
1 files changed, 36 insertions, 6 deletions
@@ -111,16 +111,46 @@ export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP | |||
111 | #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) | 111 | #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) |
112 | #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") | 112 | #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") |
113 | 113 | ||
114 | # use '-Os' optimization if available, else use -O2 | ||
115 | OPTIMIZATION:=${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \ | ||
116 | >/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi} | ||
117 | GCC_STACK_BOUNDRY:=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null \ | ||
118 | >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; else echo "" ; fi} | ||
119 | OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer $(GCC_STACK_BOUNDRY) #-fstrict-aliasing -march=i386 -mcpu=i386 -malign-functions=0 -malign-jumps=0 | ||
120 | WARNINGS:=-Wall -Wstrict-prototypes -Wshadow | 114 | WARNINGS:=-Wall -Wstrict-prototypes -Wshadow |
121 | CFLAGS:=-I$(TOPDIR)include | 115 | CFLAGS:=-I$(TOPDIR)include |
122 | ARFLAGS:=-r | 116 | ARFLAGS:=-r |
123 | 117 | ||
118 | TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | ||
119 | -e 's/i.86/i386/' \ | ||
120 | -e 's/sparc.*/sparc/' \ | ||
121 | -e 's/arm.*/arm/g' \ | ||
122 | -e 's/m68k.*/m68k/' \ | ||
123 | -e 's/ppc/powerpc/g' \ | ||
124 | -e 's/v850.*/v850/g' \ | ||
125 | -e 's/sh[234]/sh/' \ | ||
126 | -e 's/mips.*/mips/' \ | ||
127 | } | ||
128 | |||
129 | #-------------------------------------------------------- | ||
130 | # Arch specific compiler optimization stuff should go here. | ||
131 | # Unless you want to override the defaults, do not set anything | ||
132 | # for OPTIMIZATION... | ||
133 | |||
134 | # use '-Os' optimization if available, else use -O2 | ||
135 | OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ | ||
136 | then echo "-Os"; else echo "-O2" ; fi} | ||
137 | |||
138 | # Some nice architecture specific optimizations | ||
139 | ifeq ($(strip $(TARGET_ARCH)),arm) | ||
140 | OPTIMIZATION+=-fstrict-aliasing | ||
141 | endif | ||
142 | ifeq ($(strip $(TARGET_ARCH)),i386) | ||
143 | OPTIMIZATION+=-march=i386 | ||
144 | OPTIMIZATION+=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ | ||
145 | /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} | ||
146 | OPTIMIZATION+=${shell if $(CC) -falign-functions=1 -falign-jumps=0 -falign-loops=0 \ | ||
147 | -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo \ | ||
148 | "-falign-functions=1 -falign-jumps=0 -falign-loops=0"; else \ | ||
149 | if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ | ||
150 | /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi; fi} | ||
151 | endif | ||
152 | OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer | ||
153 | |||
124 | # | 154 | # |
125 | #-------------------------------------------------------- | 155 | #-------------------------------------------------------- |
126 | # If you're going to do a lot of builds with a non-vanilla configuration, | 156 | # If you're going to do a lot of builds with a non-vanilla configuration, |