X-Git-Url: http://git.onelab.eu/?p=ipfw.git;a=blobdiff_plain;f=ipfw%2FMakefile;fp=ipfw%2FMakefile;h=439bed9958605c40e1e0e80a0bdb25344cd03618;hp=387c9871097f86dec23d76a9d70f83e70ae2bfee;hb=0f1c6cc4407449512f44a7c52ad0a1a4902dd0be;hpb=4ca93c4f545e2988ac916de4fd22f8e909000a29 diff --git a/ipfw/Makefile b/ipfw/Makefile index 387c987..439bed9 100644 --- a/ipfw/Makefile +++ b/ipfw/Makefile @@ -1,6 +1,4 @@ # -# $Id$ -# # GNUMakefile to build the userland part of ipfw on Linux and Windows # # enable extra debugging information @@ -9,6 +7,28 @@ XOSARCH := $(shell uname) OSARCH ?= $(XOSARCH) $(warning Building userland ipfw for $(VER) $(OSARCH)) +# utility to figure if gcc has a given option +#################### extract from Kbuild.include +# try-run +# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) +# Exit code chooses option. "$$TMP" is can be used as temporary file and +# is automatically cleaned up. +try-run = $(shell set -e; \ + TMP="$(TMPOUT).$$$$.tmp"; \ + TMPO="$(TMPOUT).$$$$.o"; \ + if ($(1)) >/dev/null 2>&1; \ + then echo "$(2)"; \ + else echo "$(3)"; \ + fi; \ + rm -f "$$TMP" "$$TMPO") + +# cc-option +# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) + +cc-option = $(call try-run,\ + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) +#################### + #TCC=c:/tesi/tcc # common flags @@ -22,6 +42,7 @@ ifneq ($(VER),openwrt) ifeq ($(OSARCH),Linux) EXTRA_CFLAGS += -D__BSD_VISIBLE EXTRA_CFLAGS += -Werror + EXTRA_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable) else # must be Cygwin ? ifeq ($(TCC),) EXTRA_CFLAGS += -I/cygdrive/c/WinDDK/7600.16385.0/inc/ddk