diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 37 | ||||
-rw-r--r-- | scripts/Makefile.build | 3 |
2 files changed, 39 insertions, 1 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 0168d6c37075..92ce94b58bd6 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -44,6 +44,43 @@ define filechk | |||
44 | fi | 44 | fi |
45 | endef | 45 | endef |
46 | 46 | ||
47 | ###### | ||
48 | # cc support functions to be used (only) in arch/$(ARCH)/Makefile | ||
49 | # See documentation in Documentation/kbuild/makefiles.txt | ||
50 | |||
51 | # as-option | ||
52 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) | ||
53 | |||
54 | as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ | ||
55 | -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ | ||
56 | else echo "$(2)"; fi ;) | ||
57 | |||
58 | # cc-option | ||
59 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) | ||
60 | |||
61 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
62 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | ||
63 | |||
64 | # cc-option-yn | ||
65 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) | ||
66 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
67 | > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) | ||
68 | |||
69 | # cc-option-align | ||
70 | # Prefix align with either -falign or -malign | ||
71 | cc-option-align = $(subst -functions=0,,\ | ||
72 | $(call cc-option,-falign-functions=0,-malign-functions=0)) | ||
73 | |||
74 | # cc-version | ||
75 | # Usage gcc-ver := $(call cc-version, $(CC)) | ||
76 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ | ||
77 | $(if $(1), $(1), $(CC))) | ||
78 | |||
79 | # cc-ifversion | ||
80 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | ||
81 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | ||
82 | echo $(3); fi;) | ||
83 | |||
47 | ### | 84 | ### |
48 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | 85 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= |
49 | # Usage: | 86 | # Usage: |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index c33e62bde6b0..2737765f2fb4 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -10,11 +10,12 @@ __build: | |||
10 | # Read .config if it exist, otherwise ignore | 10 | # Read .config if it exist, otherwise ignore |
11 | -include .config | 11 | -include .config |
12 | 12 | ||
13 | include scripts/Kbuild.include | ||
14 | |||
13 | # The filename Kbuild has precedence over Makefile | 15 | # The filename Kbuild has precedence over Makefile |
14 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 16 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
15 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) | 17 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) |
16 | 18 | ||
17 | include scripts/Kbuild.include | ||
18 | include scripts/Makefile.lib | 19 | include scripts/Makefile.lib |
19 | 20 | ||
20 | ifdef host-progs | 21 | ifdef host-progs |