Blame view

scripts/Kbuild.include 11.9 KB
96ac6d435   Greg Kroah-Hartman   treewide: Add SPD...
1
  # SPDX-License-Identifier: GPL-2.0
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
2
3
  ####
  # kbuild: Generic definitions
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
4
  # Convenient variables
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
5
  comma   := ,
13338935f   Masahiro Yamada   kbuild: move "quo...
6
  quote   := "
d51bfb785   Sam Ravnborg   kbuild: introduce...
7
  squote  := '
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
8
9
  empty   :=
  space   := $(empty) $(empty)
9c8fa9bc0   Masahiro Yamada   kbuild: fix if_ch...
10
  space_escape := _-_SPACE_-_
9564a8cf4   Rasmus Villemoes   Kbuild: fix # esc...
11
  pound := \#
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
12
13
  
  ###
48f1f0589   Sam Ravnborg   kbuild: consisten...
14
15
16
17
  # Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
  dot-target = $(dir $@).$(notdir $@)
  
  ###
30a772977   Masahiro Yamada   kbuild: use -MMD ...
18
  # The temporary file to save gcc -MMD generated dependencies must not
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
19
  # contain a comma
48f1f0589   Sam Ravnborg   kbuild: consisten...
20
  depfile = $(subst $(comma),_,$(dot-target).d)
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
21
22
  
  ###
5e8d780d7   Sam Ravnborg   kbuild: fix ia64 ...
23
24
25
26
  # filename of target with directory and extension stripped
  basetarget = $(basename $(notdir $@))
  
  ###
afa974b77   Masahiro Yamada   kbuild: add real-...
27
28
29
30
  # real prerequisites without phony targets
  real-prereqs = $(filter-out $(PHONY), $^)
  
  ###
d51bfb785   Sam Ravnborg   kbuild: introduce...
31
32
33
34
  # Escape single quote for use in echo statements
  escsq = $(subst $(squote),'\$(squote)',$1)
  
  ###
7e826c44f   Masahiro Yamada   kbuild: add strin...
35
36
37
38
  # Quote a string to pass it to C files. foo => '"foo"'
  stringify = $(squote)$(quote)$1$(quote)$(squote)
  
  ###
5410ecc0d   Mike Frysinger   kbuild: introduce...
39
40
41
42
43
44
45
  # Easy method for doing a status message
         kecho := :
   quiet_kecho := echo
  silent_kecho := :
  kecho := $($(quiet)kecho)
  
  ###
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
46
47
  # filechk is used to check if the content of a generated file is updated.
  # Sample usage:
ba97df455   Masahiro Yamada   kbuild: use assig...
48
49
50
  #
  # filechk_sample = echo $(KERNELRELEASE)
  # version.h: FORCE
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
51
  #	$(call filechk,sample)
ba97df455   Masahiro Yamada   kbuild: use assig...
52
  #
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
53
54
55
56
57
  # The rule defined shall write to stdout the content of the new file.
  # The existing file will be compared with the new one.
  # - If no file exist it is created
  # - If the content differ the new file is used
  # - If they are equal no change, and no timestamp update
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
58
  define filechk
88fe89a47   Masahiro Yamada   kbuild: remove *....
59
60
61
62
63
64
65
  	$(Q)set -e;						\
  	mkdir -p $(dir $@);					\
  	trap "rm -f $(dot-target).tmp" EXIT;			\
  	{ $(filechk_$(1)); } > $(dot-target).tmp;		\
  	if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then	\
  		$(kecho) '  UPD     $@';			\
  		mv -f $(dot-target).tmp $@;			\
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
66
67
  	fi
  endef
20a468b51   Sam Ravnborg   kbuild: make cc-v...
68
  ######
9d6e7a709   Sam Ravnborg   kbuild: fix comme...
69
  # gcc support functions
cd238effe   Mauro Carvalho Chehab   docs: kbuild: con...
70
  # See documentation in Documentation/kbuild/makefiles.rst
20a468b51   Sam Ravnborg   kbuild: make cc-v...
71

910b40468   Sam Ravnborg   kbuild: introduce...
72
73
  # cc-cross-prefix
  # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
bd55f96fa   Masahiro Yamada   kbuild: refactor ...
74
75
  # Return first <prefix> where a <prefix>gcc is found in PATH.
  # If no gcc found in PATH with listed prefixes return nothing
913ab9780   Masahiro Yamada   kbuild: use more ...
76
77
78
79
80
  #
  # Note: '2>/dev/null' is here to force Make to invoke a shell. Otherwise, it
  # would try to directly execute the shell builtin 'command'. This workaround
  # should be kept for a long time since this issue was fixed only after the
  # GNU Make 4.2.1 release.
d4a74bbfe   Masahiro Yamada   kbuild: use -- se...
81
82
  cc-cross-prefix = $(firstword $(foreach c, $(1), \
  			$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
910b40468   Sam Ravnborg   kbuild: introduce...
83

beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
84
  # output directory for tests below
f2f02ebd8   Masahiro Yamada   kbuild: improve c...
85
  TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
86
87
88
  
  # try-run
  # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
312a3d091   Cao jin   kbuild: trivial c...
89
90
  # Exit code chooses option. "$$TMP" serves as a temporary file and is
  # automatically cleaned up.
e08d6de4e   Masahiro Yamada   kbuild: remove kb...
91
  try-run = $(shell set -e;		\
f2f02ebd8   Masahiro Yamada   kbuild: improve c...
92
93
94
95
  	TMP=$(TMPOUT)/tmp;		\
  	TMPO=$(TMPOUT)/tmp.o;		\
  	mkdir -p $(TMPOUT);		\
  	trap "rm -rf $(TMPOUT)" EXIT;	\
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
96
97
98
  	if ($(1)) >/dev/null 2>&1;	\
  	then echo "$(2)";		\
  	else echo "$(3)";		\
f2f02ebd8   Masahiro Yamada   kbuild: improve c...
99
  	fi)
347a00fb4   Roman Zippel   [PATCH] kbuild: d...
100

20a468b51   Sam Ravnborg   kbuild: make cc-v...
101
  # as-option
bff288c19   Oleg Verych   [PATCH] kbuild, K...
102
  # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
103

e08d6de4e   Masahiro Yamada   kbuild: remove kb...
104
  as-option = $(call try-run,\
b1e0d8b70   Jean Delvare   kbuild: Fix gcc -...
105
  	$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
20a468b51   Sam Ravnborg   kbuild: make cc-v...
106

e2414910f   Andi Kleen   [PATCH] x86: Dete...
107
  # as-instr
bff288c19   Oleg Verych   [PATCH] kbuild, K...
108
  # Usage: cflags-y += $(call as-instr,instr,option1,option2)
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
109

e08d6de4e   Masahiro Yamada   kbuild: remove kb...
110
  as-instr = $(call try-run,\
b1e0d8b70   Jean Delvare   kbuild: Fix gcc -...
111
112
  	printf "%b
  " "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
e2414910f   Andi Kleen   [PATCH] x86: Dete...
113

9f3f1fd29   Matthias Kaehlcke   kbuild: Add __cc-...
114
115
  # __cc-option
  # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
e08d6de4e   Masahiro Yamada   kbuild: remove kb...
116
  __cc-option = $(call try-run,\
9f3f1fd29   Matthias Kaehlcke   kbuild: Add __cc-...
117
  	$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
20a468b51   Sam Ravnborg   kbuild: make cc-v...
118
  # cc-option
bff288c19   Oleg Verych   [PATCH] kbuild, K...
119
  # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
120

9f3f1fd29   Matthias Kaehlcke   kbuild: Add __cc-...
121
  cc-option = $(call __cc-option, $(CC),\
132305b3b   Masahiro Yamada   kbuild: stop filt...
122
  	$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
9f3f1fd29   Matthias Kaehlcke   kbuild: Add __cc-...
123

20a468b51   Sam Ravnborg   kbuild: make cc-v...
124
  # cc-option-yn
bff288c19   Oleg Verych   [PATCH] kbuild, K...
125
  # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
e08d6de4e   Masahiro Yamada   kbuild: remove kb...
126
  cc-option-yn = $(call try-run,\
132305b3b   Masahiro Yamada   kbuild: stop filt...
127
  	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
20a468b51   Sam Ravnborg   kbuild: make cc-v...
128

8417da6f2   Michal Marek   kbuild: Fix passi...
129
130
  # cc-disable-warning
  # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
e08d6de4e   Masahiro Yamada   kbuild: remove kb...
131
  cc-disable-warning = $(call try-run,\
132305b3b   Masahiro Yamada   kbuild: stop filt...
132
  	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
8417da6f2   Michal Marek   kbuild: Fix passi...
133

20a468b51   Sam Ravnborg   kbuild: make cc-v...
134
135
  # cc-ifversion
  # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
d3a918c65   Masahiro Yamada   kbuild: remove cc...
136
  cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
20a468b51   Sam Ravnborg   kbuild: make cc-v...
137

691ef3e7f   Sam Ravnborg   kbuild: introduce...
138
  # ld-option
d503ac531   Masahiro Yamada   kbuild: rename LD...
139
140
  # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
  ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
691ef3e7f   Sam Ravnborg   kbuild: introduce...
141

ccbef1674   Andi Kleen   Kbuild, lto: add ...
142
  # ld-version
ccbef1674   Andi Kleen   Kbuild, lto: add ...
143
  # Note this is mainly for HJ Lu's 3 number binutil versions
e08d6de4e   Masahiro Yamada   kbuild: remove kb...
144
  ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
ccbef1674   Andi Kleen   Kbuild, lto: add ...
145
146
147
  
  # ld-ifversion
  # Usage:  $(call ld-ifversion, -ge, 22252, y)
6dcb4e5ed   Masahiro Yamada   kbuild: allow cc-...
148
  ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
ccbef1674   Andi Kleen   Kbuild, lto: add ...
149

5de043f4b   Oleg Verych   [PATCH] kbuild: i...
150
  ######
0b0bf7a3c   Roland McGrath   [PATCH] vDSO hash...
151

beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
152
  ###
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
153
154
155
  # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
  # Usage:
  # $(Q)$(MAKE) $(build)=dir
5b2389b45   Masahiro Yamada   kbuild: simplify ...
156
  build := -f $(srctree)/scripts/Makefile.build obj
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
157

bc081dd6e   Michal Marek   kbuild: generate ...
158
  ###
9fb5e5372   Robert Richter   dts, kbuild: Fact...
159
160
161
  # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
  # Usage:
  # $(Q)$(MAKE) $(dtbinst)=dir
487c7c770   Masahiro Yamada   kbuild: prefix Ma...
162
  dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
9fb5e5372   Robert Richter   dts, kbuild: Fact...
163

d08372ca2   Linus Torvalds   Merge branch 'kbu...
164
  ###
371fdc77a   Masahiro Yamada   kbuild: collect s...
165
166
167
168
  # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
  # Usage:
  # $(Q)$(MAKE) $(clean)=dir
  clean := -f $(srctree)/scripts/Makefile.clean obj
5de043f4b   Oleg Verych   [PATCH] kbuild: i...
169
170
  # echo command.
  # Short version is used, if $(quiet) equals `quiet_', otherwise full one.
bff288c19   Oleg Verych   [PATCH] kbuild, K...
171
  echo-cmd = $(if $($(quiet)cmd_$(1)),\
5de043f4b   Oleg Verych   [PATCH] kbuild: i...
172
173
174
  	echo '  $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
  
  # printing commands
3a2429e1f   Masahiro Yamada   kbuild: change if...
175
  cmd = @set -e; $(echo-cmd) $(cmd_$(1))
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
176
177
  
  ###
5de043f4b   Oleg Verych   [PATCH] kbuild: i...
178
  # if_changed      - execute command if any prerequisite is newer than
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
179
180
181
182
  #                   target, or command line has changed
  # if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
  #                   including used config symbols
  # if_changed_rule - as if_changed but execute rule instead
cd238effe   Mauro Carvalho Chehab   docs: kbuild: con...
183
  # See Documentation/kbuild/makefiles.rst for more info
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
184
185
  
  ifneq ($(KBUILD_NOCMDDEP),1)
50bcca6ac   Masahiro Yamada   kbuild: rename ar...
186
  # Check if both commands are the same including their order. Result is empty
9c8fa9bc0   Masahiro Yamada   kbuild: fix if_ch...
187
  # string if equal. User may override this check using make KBUILD_NOCMDDEP=1
50bcca6ac   Masahiro Yamada   kbuild: rename ar...
188
  cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
9c8fa9bc0   Masahiro Yamada   kbuild: fix if_ch...
189
                           $(subst $(space),$(space_escape),$(strip $(cmd_$1))))
c4d5ee139   Michal Marek   kbuild: make KBUI...
190
  else
50bcca6ac   Masahiro Yamada   kbuild: rename ar...
191
  cmd-check = $(if $(strip $(cmd_$@)),,1)
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
192
  endif
164f0d2ef   Michal Marek   kbuild: Fix handl...
193
194
  # Replace >$< with >$$< to preserve $ when reloading the .cmd file
  # (needed for make)
9564a8cf4   Rasmus Villemoes   Kbuild: fix # esc...
195
  # Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
164f0d2ef   Michal Marek   kbuild: Fix handl...
196
197
198
  # (needed for make)
  # Replace >'< with >'\''< to be able to enclose the whole string in '...'
  # (needed for the shell)
9564a8cf4   Rasmus Villemoes   Kbuild: fix # esc...
199
  make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
6176aa9ae   Jan Beulich   kbuild: consolida...
200

2d3b1b8f0   Masahiro Yamada   kbuild: drop $(wi...
201
202
203
204
  # Find any prerequisites that are newer than target or that do not exist.
  # (This is not true for now; $? should contain any non-existent prerequisites,
  # but it does not work as expected when .SECONDARY is present. This seems a bug
  # of GNU Make.)
48f1f0589   Sam Ravnborg   kbuild: consisten...
205
  # PHONY targets skipped in both cases.
eba19032f   Masahiro Yamada   kbuild: rename an...
206
  newer-prereqs = $(filter-out $(PHONY),$?)
48f1f0589   Sam Ravnborg   kbuild: consisten...
207

5de043f4b   Oleg Verych   [PATCH] kbuild: i...
208
  # Execute command if command has changed or prerequisite(s) are updated.
eba19032f   Masahiro Yamada   kbuild: rename an...
209
  if_changed = $(if $(newer-prereqs)$(cmd-check),                              \
67126965e   Masahiro Yamada   kbuild: refactor ...
210
  	$(cmd);                                                              \
2aedcd098   Masahiro Yamada   kbuild: suppress ...
211
212
  	printf '%s
  ' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
213

5de043f4b   Oleg Verych   [PATCH] kbuild: i...
214
  # Execute the command and also postprocess generated .d dependencies file.
eba19032f   Masahiro Yamada   kbuild: rename an...
215
  if_changed_dep = $(if $(newer-prereqs)$(cmd-check),$(cmd_and_fixdep),@:)
c1a95fda2   Nicolas Pitre   kbuild: add fine ...
216

e4aca4595   Nicolas Pitre   kbuild: de-duplic...
217
  cmd_and_fixdep =                                                             \
3a2429e1f   Masahiro Yamada   kbuild: change if...
218
  	$(cmd);                                                              \
392885ee8   Masahiro Yamada   kbuild: let fixde...
219
  	scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\
e5d289100   Masahiro Yamada   kbuild: remove tr...
220
  	rm -f $(depfile)
c1a95fda2   Nicolas Pitre   kbuild: add fine ...
221

8ec4b4ff1   Sam Ravnborg   kbuild: introduce...
222
  # Usage: $(call if_changed_rule,foo)
beda9f3a1   Roman Zippel   [PATCH] kbuild: m...
223
224
  # Will check if $(cmd_foo) or any of the prerequisites changed,
  # and if so will execute $(rule_foo).
eba19032f   Masahiro Yamada   kbuild: rename an...
225
  if_changed_rule = $(if $(newer-prereqs)$(cmd-check),$(rule_$(1)),@:)
48f1f0589   Sam Ravnborg   kbuild: consisten...
226

45d506bd6   Sam Ravnborg   kbuild: make V=2 ...
227
  ###
312a3d091   Cao jin   kbuild: trivial c...
228
  # why - tell why a target got built
45d506bd6   Sam Ravnborg   kbuild: make V=2 ...
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
  #       enabled by make V=2
  #       Output (listed in the order they are checked):
  #          (1) - due to target is PHONY
  #          (2) - due to target missing
  #          (3) - due to: file1.h file2.h
  #          (4) - due to command line change
  #          (5) - due to missing .cmd file
  #          (6) - due to target not in $(targets)
  # (1) PHONY targets are always build
  # (2) No target, so we better build it
  # (3) Prerequisite is newer than target
  # (4) The command line stored in the file named dir/.target.cmd
  #     differed from actual command line. This happens when compiler
  #     options changes
  # (5) No dir/.target.cmd file (used to store command line)
  # (6) No dir/.target.cmd file and target not listed in $(targets)
  #     This is a good hint that there is a bug in the kbuild file
  ifeq ($(KBUILD_VERBOSE),2)
  why =                                                                        \
      $(if $(filter $@, $(PHONY)),- due to target is PHONY,                    \
          $(if $(wildcard $@),                                                 \
eba19032f   Masahiro Yamada   kbuild: rename an...
250
              $(if $(newer-prereqs),- due to: $(newer-prereqs),                \
50bcca6ac   Masahiro Yamada   kbuild: rename ar...
251
                  $(if $(cmd-check),                                           \
45d506bd6   Sam Ravnborg   kbuild: make V=2 ...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
                      $(if $(cmd_$@),- due to command line change,             \
                          $(if $(filter $@, $(targets)),                       \
                              - due to missing .cmd file,                      \
                              - due to $(notdir $@) not in $$(targets)         \
                           )                                                   \
                       )                                                       \
                   )                                                           \
               ),                                                              \
               - due to target missing                                         \
           )                                                                   \
       )
  
  echo-why = $(call escsq, $(strip $(why)))
  endif
3ee550f12   David Woodhouse   modsign: Handle s...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
  
  ###############################################################################
  #
  # When a Kconfig string contains a filename, it is suitable for
  # passing to shell commands. It is surrounded by double-quotes, and
  # any double-quotes or backslashes within it are escaped by
  # backslashes.
  #
  # This is no use for dependencies or $(wildcard). We need to strip the
  # surrounding quotes and the escaping from quotes and backslashes, and
  # we *do* need to escape any spaces in the string. So, for example:
  #
  # Usage: $(eval $(call config_filename,FOO))
  #
  # Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
  # transformed as described above to be suitable for use within the
  # makefile.
  #
  # Also, if the filename is a relative filename and exists in the source
  # tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
  # be prefixed to *both* command invocation and dependencies.
  #
  # Note: We also print the filenames in the quiet_cmd_foo text, and
  # perhaps ought to have a version specially escaped for that purpose.
  # But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
  # enough.  It'll strip the quotes in the common case where there's no
  # space and it's a simple filename, and it'll retain the quotes when
  # there's a space. There are some esoteric cases in which it'll print
  # the wrong thing, but we don't really care. The actual dependencies
  # and commands *do* get it right, with various combinations of single
  # and double quotes, backslashes and spaces in the filenames.
  #
  ###############################################################################
  #
3ee550f12   David Woodhouse   modsign: Handle s...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
  define config_filename
  ifneq ($$(CONFIG_$(1)),"")
  $(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
  ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
  else
  ifeq ($$(wildcard $$($(1)_FILENAME)),)
  ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
  $(1)_SRCPREFIX := $(srctree)/
  endif
  endif
  endif
  endif
  endef
  #
  ###############################################################################
9c2af1c73   Masahiro Yamada   kbuild: add .DELE...
315
316
317
  
  # delete partially updated (i.e. corrupted) files on error
  .DELETE_ON_ERROR:
8e9b61b29   Masahiro Yamada   kbuild: move .SEC...
318
319
320
  
  # do not delete intermediate files automatically
  .SECONDARY: