summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-17 13:21:10 +0000
committertron <tron@openttd.org>2005-01-17 13:21:10 +0000
commit9fadf6cf848e8b8248c945066be2fcd4efe2e349 (patch)
tree98659b2526c67b19ef47e45fbb10132199ecdd0c
parentf4f705e72307fb33dfd095bf652b6cac63cb466d (diff)
downloadopenttd-9fadf6cf848e8b8248c945066be2fcd4efe2e349.tar.xz
(svn r1553) Check which gcc version is present and only set availible compiler flags
-rw-r--r--Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 12b468ca0..ce69b772e 100644
--- a/Makefile
+++ b/Makefile
@@ -294,7 +294,20 @@ endif
# -O optimize or -O2 fully optimize (O's above 2 are not recommended)
# -pg profile - generate profiling data. See "man gprof" to use this.
-CFLAGS=-Wall -Wno-multichar -Wsign-compare -W -O1 -Wno-unused-parameter
+CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1-3)
+
+# GNU make can only test for (in)equality
+# this is a workaround to test for >=
+ifeq ($(shell if test ! $(CC_VERSION) \< 2.9; then echo true; fi), true)
+ CFLAGS += -O -Wall -Wno-multichar -Wsign-compare
+endif
+ifeq ($(shell if test ! $(CC_VERSION) \< 3.0; then echo true; fi), true)
+ CFLAGS += -W -Wno-unused-parameter
+endif
+ifeq ($(shell if test ! $(CC_VERSION) \< 3.4; then echo true; fi), true)
+ CFLAGS += -Wdeclaration-after-statement
+endif
+
CDEFS=-DWITH_REV
LDFLAGS=
LIBS=