aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilutin Jovanović <jovanovic.milutin@gmail.com>2012-11-14 17:45:15 -0500
committerMilutin Jovanović <jovanovic.milutin@gmail.com>2012-11-14 17:45:15 -0500
commite79c3533ecefd004daad8a27333582b2dad7f0b0 (patch)
treef682ab5244b05e05c6e973bf8434fb122268085d
parent40a54c4399cc5e687d93add4b89bc16c19aaddfe (diff)
downloadtinycc-e79c3533ecefd004daad8a27333582b2dad7f0b0.tar.gz
tinycc-e79c3533ecefd004daad8a27333582b2dad7f0b0.tar.bz2
-Wno-unused-result now added only on gcc >= 4.4
This option does not exist in gcc 4.3 and earlier, and it breaks the build on systems with older compilers. The makefile has been enhanced to test for the version and adds it only if a newer compiler is detected.
-rw-r--r--Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 835ede0..406695b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,18 @@ LDFLAGS_P=$(LDFLAGS)
ifneq ($(GCC_MAJOR),2)
CFLAGS+=-fno-strict-aliasing
ifneq ($(GCC_MAJOR),3)
-CFLAGS+=-Wno-pointer-sign -Wno-sign-compare -Wno-unused-result
+CFLAGS+=-Wno-pointer-sign -Wno-sign-compare
+
+# add -Wno-unused-result only on gcc >= 4.4
+ifeq ($(GCC_MAJOR),4)
+GCCGREATERTHEN44 := $(shell expr `gcc -dumpversion | cut -f2 -d.` \>= 4)
+else
+GCCGREATERTHEN44 := 1
+endif
+ifeq ($(GCCGREATERTHEN44),1)
+CFLAGS+=-Wno-unused-result
+endif
+
endif
endif