aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include40
1 files changed, 20 insertions, 20 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 96926eb13b0a..d65c40331e66 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -57,7 +57,7 @@ endef
57# See documentation in Documentation/kbuild/makefiles.txt 57# See documentation in Documentation/kbuild/makefiles.txt
58 58
59# checker-shell 59# checker-shell
60# Usage: option = $(call checker-shell, $(CC)...-o $$OUT, option-ok, otherwise) 60# Usage: option = $(call checker-shell,$(CC)...-o $$OUT,option-ok,otherwise)
61# Exit code chooses option. $$OUT is safe location for needless output. 61# Exit code chooses option. $$OUT is safe location for needless output.
62define checker-shell 62define checker-shell
63 $(shell set -e; \ 63 $(shell set -e; \
@@ -74,23 +74,23 @@ define checker-shell
74endef 74endef
75 75
76# as-option 76# as-option
77# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) 77# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
78as-option = $(call checker-shell, \ 78as-option = $(call checker-shell,\
79 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT, $(1), $(2)) 79 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT,$(1),$(2))
80 80
81# as-instr 81# as-instr
82# Usage: cflags-y += $(call as-instr, instr, option1, option2) 82# Usage: cflags-y += $(call as-instr,instr,option1,option2)
83as-instr = $(call checker-shell, \ 83as-instr = $(call checker-shell,\
84 printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -, $(2), $(3)) 84 printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -,$(2),$(3))
85 85
86# cc-option 86# cc-option
87# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) 87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
88cc-option = $(call checker-shell, \ 88cc-option = $(call checker-shell,\
89 $(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT, $(1), $(2)) 89 $(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT,$(1),$(2))
90 90
91# cc-option-yn 91# cc-option-yn
92# Usage: flag := $(call cc-option-yn, -march=winchip-c6) 92# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
93cc-option-yn = $(call cc-option, "y", "n", $(1)) 93cc-option-yn = $(call cc-option,"y","n",$(1))
94 94
95# cc-option-align 95# cc-option-align
96# Prefix align with either -falign or -malign 96# Prefix align with either -falign or -malign
@@ -98,7 +98,7 @@ cc-option-align = $(subst -functions=0,,\
98 $(call cc-option,-falign-functions=0,-malign-functions=0)) 98 $(call cc-option,-falign-functions=0,-malign-functions=0))
99 99
100# cc-version 100# cc-version
101# Usage gcc-ver := $(call cc-version, $(CC)) 101# Usage gcc-ver := $(call cc-version,$(CC))
102cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) 102cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
103 103
104# cc-ifversion 104# cc-ifversion
@@ -107,8 +107,8 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
107 107
108# ld-option 108# ld-option
109# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) 109# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
110ld-option = $(call checker-shell, \ 110ld-option = $(call checker-shell,\
111 $(CC) $(1) -nostdlib -xc /dev/null -o $$OUT, $(1), $(2)) 111 $(CC) $(1) -nostdlib -xc /dev/null -o $$OUT,$(1),$(2))
112 112
113###### 113######
114 114
@@ -120,22 +120,22 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
120# Prefix -I with $(srctree) if it is not an absolute path, 120# Prefix -I with $(srctree) if it is not an absolute path,
121# add original to the end 121# add original to the end
122addtree = $(if \ 122addtree = $(if \
123 $(filter-out -I/%, $(1)), $(patsubst -I%,-I$(srctree)/%,$(1))) $(1) 123 $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
124 124
125# Find all -I options and call addtree 125# Find all -I options and call addtree
126flags = $(foreach o,$($(1)), \ 126flags = $(foreach o,$($(1)),\
127 $(if $(filter -I%,$(o)), $(call addtree, $(o)), $(o))) 127 $(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
128 128
129# echo command. 129# echo command.
130# Short version is used, if $(quiet) equals `quiet_', otherwise full one. 130# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
131echo-cmd = $(if $($(quiet)cmd_$(1)), \ 131echo-cmd = $(if $($(quiet)cmd_$(1)),\
132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) 132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
133 133
134# printing commands 134# printing commands
135cmd = @$(echo-cmd) $(cmd_$(1)) 135cmd = @$(echo-cmd) $(cmd_$(1))
136 136
137# Add $(obj)/ for paths that are not absolute 137# Add $(obj)/ for paths that are not absolute
138objectify = $(foreach o,$(1), $(if $(filter /%,$(o)), $(o), $(obj)/$(o))) 138objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
139 139
140### 140###
141# if_changed - execute command if any prerequisite is newer than 141# if_changed - execute command if any prerequisite is newer than