(svn r1553) Check which gcc version is present and only set availible compiler flags
authortron
Mon, 17 Jan 2005 13:21:10 +0000
changeset 1052 f996874f0f16
parent 1051 be278201f830
child 1053 8d90844ddc2e
(svn r1553) Check which gcc version is present and only set availible compiler flags
Makefile
--- a/Makefile	Mon Jan 17 13:13:11 2005 +0000
+++ b/Makefile	Mon Jan 17 13:21:10 2005 +0000
@@ -294,7 +294,20 @@
 # -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=