]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Loopify the pmake gcc flag detection
authorRoy Marples <roy@marples.name>
Fri, 24 Aug 2007 11:05:38 +0000 (11:05 +0000)
committerRoy Marples <roy@marples.name>
Fri, 24 Aug 2007 11:05:38 +0000 (11:05 +0000)
Makefile

index af449ee066c53eddc46311d39eedd854a979286b..53b77e8f33ee8c09a97f318016c3d8a1b796f60d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,28 @@
+# Should work for both GNU make and BSD make
 VERSION = 3.1.5
 CFLAGS ?= -O2 -pipe
 
-# Should work for both GNU make and BSD make
-
 # Saying that, this function only works with GNU Make :/
 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
-         then echo "$(1)"; else echo "$(2)"; fi)
+                 then echo "$(1)"; else echo "$(2)"; fi)
 
 # Luckily we can do this more long winded thing with pmake used by the BSDs
-# FIXME: Look into making this into a loop
-WAFTST != if $(CC) -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
-         then echo "-Wdeclaration-after-statement"; fi
-WSEQ   != if $(CC) -Wsequence-point -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
-         then echo "-Wsequence-point"; fi
-WEXTRA != if $(CC) -Wextra -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
-         then echo "-Wextra"; fi
+WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra ; do \
+       if $(CC) -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+       then echo -n "$$x "; fi \
+       done
 
 # Loads of nice flags to ensure our code is good
 # IMPORTANT: We should be using c99 instead of gnu99 but for some reason
 # generic linux headers as of 2.6.19 don't allow this in asm/types.h
 CFLAGS += -pedantic -std=gnu99 \
-    -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
-    -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
-    -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
-    -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
-    $(call check_gcc, -Wdeclaration-after-statement) \
-    $(call check_gcc, -Wsequence-point) \
-    $(call check_gcc, -Wextra) $(WAFTST) $(WSEQ) $(WEXTRA)
+                 -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
+                 -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
+                 -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
+                 -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
+                 $(call check_gcc, -Wdeclaration-after-statement) \
+                 $(call check_gcc, -Wsequence-point) \
+                 $(call check_gcc, -Wextra) $(WEXTRA)
 
 # -Werrror is a good flag to use for development, but some platforms may
 #  have buggy headers from time to time, so you may need to comment this out
@@ -47,7 +43,7 @@ TARGET = $(SBIN_TARGETS)
 
 dhcpcd_H = version.h
 dhcpcd_OBJS = arp.o client.o common.o configure.o dhcp.o dhcpcd.o duid.o \
-               info.o interface.o ipv4ll.o logger.o signals.o socket.o
+                         info.o interface.o ipv4ll.o logger.o signals.o socket.o
 
 # Darwin needs this, but we have no way of detecting this atm
 #LIBRESOLV = -lresolv