aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-08-22 15:14:22 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-08-22 15:14:22 +0200
commita23a4605c2ad54359f7ea4068e79a54ef3cf3620 (patch)
tree5fbc571074d9fc96aeb99e08bd89480001c616ba /Makefile
parentf9a71d169c02064bf27d6be4993fee555c35c244 (diff)
downloadhistory-a23a4605c2ad54359f7ea4068e79a54ef3cf3620.tar.gz
kbuild: Consolidated cc support function
Added three function to top-level Makefile: cc-option (replacing check_gcc) cc-option-yn (as cc-option but return y or n) cc-version (numeric version of $(CC)) Documentation added to Documentation/kbuild/makefiles.txt The check_gcc version is still present, but now spit out a arning if used. The new naming where chosen to get consistent naming of all three functions Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 26 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 5a13059cd523a3..e2e2cbe44b195e 100644
--- a/Makefile
+++ b/Makefile
@@ -256,9 +256,32 @@ ifneq ($(findstring s,$(MAKEFLAGS)),)
quiet=silent_
endif
-check_gcc = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+export quiet Q KBUILD_VERBOSE
+
+######
+# cc support functions to be used (only) in arch/$(ARCH)/Makefile
+# See documentation in Documentation/kbuild/makefiles.txt
+
+# cc-option
+# Usage: cflags-y += $(call gcc-option, -march=winchip-c6, -march=i586)
+
+cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
+# For backward compatibility
+check_gcc = $(warning check_gcc is deprecated - use cc-option) \
+ $(call cc-option, $(1),$(2))
+
+# cc-option-yn
+# Usage: flag := $(call gcc-option-yn, -march=winchip-c6)
+cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
+
+# cc-version
+# Usage gcc-ver := $(call cc-version $(CC))
+cc-version = $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
+ $(if $(1), $(1), $(CC))
-export quiet Q KBUILD_VERBOSE check_gcc
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)
@@ -463,7 +486,7 @@ CFLAGS += -g
endif
# warn about C99 declaration after statement
-CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,)
+CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
#
# INSTALL_PATH specifies where to place the updated kernel and system map