diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-10-30 06:55:37 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-10-30 06:55:37 +0000 |
commit | 1b6eb9b6ebd7771db9d1bf481569085ff88197de (patch) | |
tree | b6f6fe91659e6dc9be9fdcc1405544acbe5e94a3 | |
parent | df5b8679a28b54602e5a981b9ee0a5c30d0e4ba2 (diff) | |
download | busybox-w32-1b6eb9b6ebd7771db9d1bf481569085ff88197de.tar.gz busybox-w32-1b6eb9b6ebd7771db9d1bf481569085ff88197de.tar.bz2 busybox-w32-1b6eb9b6ebd7771db9d1bf481569085ff88197de.zip |
Use a nifty macro to make testing gcc features simpler
and much easier to read.
-Erik
-rw-r--r-- | Rules.mak | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -125,6 +125,9 @@ TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | |||
125 | -e 's/sh[234]/sh/' \ | 125 | -e 's/sh[234]/sh/' \ |
126 | -e 's/mips.*/mips/' \ | 126 | -e 's/mips.*/mips/' \ |
127 | } | 127 | } |
128 | # A nifty macro to make testing gcc features easier | ||
129 | check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ | ||
130 | then echo "$(1)"; else echo "$(2)"; fi) | ||
128 | 131 | ||
129 | #-------------------------------------------------------- | 132 | #-------------------------------------------------------- |
130 | # Arch specific compiler optimization stuff should go here. | 133 | # Arch specific compiler optimization stuff should go here. |
@@ -132,8 +135,8 @@ TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | |||
132 | # for OPTIMIZATION... | 135 | # for OPTIMIZATION... |
133 | 136 | ||
134 | # use '-Os' optimization if available, else use -O2 | 137 | # use '-Os' optimization if available, else use -O2 |
135 | OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null \ | 138 | OPTIMIZATION:= |
136 | >/dev/null 2>&1; then echo "-Os"; else echo "-O2" ; fi} | 139 | OPTIMIZATION+=${call check_gcc,-Os,-O2} |
137 | 140 | ||
138 | # Some nice architecture specific optimizations | 141 | # Some nice architecture specific optimizations |
139 | ifeq ($(strip $(TARGET_ARCH)),arm) | 142 | ifeq ($(strip $(TARGET_ARCH)),arm) |
@@ -141,13 +144,9 @@ ifeq ($(strip $(TARGET_ARCH)),arm) | |||
141 | endif | 144 | endif |
142 | ifeq ($(strip $(TARGET_ARCH)),i386) | 145 | ifeq ($(strip $(TARGET_ARCH)),i386) |
143 | OPTIMIZATION+=-march=i386 | 146 | OPTIMIZATION+=-march=i386 |
144 | OPTIMIZATION+=${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ | 147 | OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,) |
145 | /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} | 148 | OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\ |
146 | OPTIMIZATION+=${shell if $(CC) -falign-functions=1 -falign-jumps=0 -falign-loops=0 \ | 149 | -malign-functions=0 -malign-jumps=0 -malign-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 | 150 | endif |
152 | OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer | 151 | OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer |
153 | 152 | ||