summaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-10-30 06:52:34 +0000
committerEric Andersen <andersen@codepoet.org>2002-10-30 06:52:34 +0000
commitefe794763c983c4079409c90ce7780999024d4ad (patch)
tree0e2a59ccad45e4f1fcddfa038540326192a85ec5 /Rules.mak
parent98e199aba033daa324ef324658914b05f71025bf (diff)
Use a nifty macro to make testing gcc features simpler
and easier to read. -Erik
Diffstat (limited to 'Rules.mak')
-rw-r--r--Rules.mak23
1 files changed, 12 insertions, 11 deletions
diff --git a/Rules.mak b/Rules.mak
index e8745a14a..4c27771b6 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -37,8 +37,13 @@ UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION)
LIBC:=$(TOPDIR)libc/libc.a
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
+# A nifty macro to make testing gcc features easier
+check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
+ then echo "$(1)"; else echo "$(2)"; fi)
+
# check if we have nawk, otherwise user awk
-AWK:= ${shell if [ -x /usr/bin/nawk ]; then echo "/usr/bin/nawk"; else echo "/usr/bin/awk"; fi}
+AWK:=$(shell if [ -x /usr/bin/nawk ]; then echo "/usr/bin/nawk"; \
+ else echo "/usr/bin/awk"; fi)
NATIVE_ARCH:= ${shell uname -m | sed \
-e 's/i.86/i386/' \
@@ -74,25 +79,21 @@ ARFLAGS:=r
ifndef OPTIMIZATION
# use '-Os' optimization if available, else use -O2, allow Config to override
-OPTIMIZATION:= ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
- then echo "-Os"; else echo "-O2" ; fi}
+OPTIMIZATION:=
+OPTIMIZATION+=${call check_gcc,-Os,-O2}
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}
+ OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
+ OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
+ -malign-functions=0 -malign-jumps=0 -malign-loops=0)
endif
endif
# Add a bunch of extra pedantic annoyingly strict checks
-WARNINGS+=-Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
+WARNINGS+=-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
CFLAGS:=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) \