xref: /OK3568_Linux_fs/kernel/scripts/Kbuild.include (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun####
3*4882a593Smuzhiyun# kbuild: Generic definitions
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun# Convenient variables
6*4882a593Smuzhiyuncomma   := ,
7*4882a593Smuzhiyunquote   := "
8*4882a593Smuzhiyunsquote  := '
9*4882a593Smuzhiyunempty   :=
10*4882a593Smuzhiyunspace   := $(empty) $(empty)
11*4882a593Smuzhiyunspace_escape := _-_SPACE_-_
12*4882a593Smuzhiyunpound := \#
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun###
15*4882a593Smuzhiyun# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
16*4882a593Smuzhiyundot-target = $(dir $@).$(notdir $@)
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun###
19*4882a593Smuzhiyun# The temporary file to save gcc -MMD generated dependencies must not
20*4882a593Smuzhiyun# contain a comma
21*4882a593Smuzhiyundepfile = $(subst $(comma),_,$(dot-target).d)
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun###
24*4882a593Smuzhiyun# filename of target with directory and extension stripped
25*4882a593Smuzhiyunbasetarget = $(basename $(notdir $@))
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun###
28*4882a593Smuzhiyun# real prerequisites without phony targets
29*4882a593Smuzhiyunreal-prereqs = $(filter-out $(PHONY), $^)
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun###
32*4882a593Smuzhiyun# Escape single quote for use in echo statements
33*4882a593Smuzhiyunescsq = $(subst $(squote),'\$(squote)',$1)
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun###
36*4882a593Smuzhiyun# Quote a string to pass it to C files. foo => '"foo"'
37*4882a593Smuzhiyunstringify = $(squote)$(quote)$1$(quote)$(squote)
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun###
40*4882a593Smuzhiyun# Easy method for doing a status message
41*4882a593Smuzhiyun       kecho := :
42*4882a593Smuzhiyun quiet_kecho := echo
43*4882a593Smuzhiyunsilent_kecho := :
44*4882a593Smuzhiyunkecho := $($(quiet)kecho)
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun###
47*4882a593Smuzhiyun# filechk is used to check if the content of a generated file is updated.
48*4882a593Smuzhiyun# Sample usage:
49*4882a593Smuzhiyun#
50*4882a593Smuzhiyun# filechk_sample = echo $(KERNELRELEASE)
51*4882a593Smuzhiyun# version.h: FORCE
52*4882a593Smuzhiyun#	$(call filechk,sample)
53*4882a593Smuzhiyun#
54*4882a593Smuzhiyun# The rule defined shall write to stdout the content of the new file.
55*4882a593Smuzhiyun# The existing file will be compared with the new one.
56*4882a593Smuzhiyun# - If no file exist it is created
57*4882a593Smuzhiyun# - If the content differ the new file is used
58*4882a593Smuzhiyun# - If they are equal no change, and no timestamp update
59*4882a593Smuzhiyundefine filechk
60*4882a593Smuzhiyun	$(Q)set -e;						\
61*4882a593Smuzhiyun	mkdir -p $(dir $@);					\
62*4882a593Smuzhiyun	trap "rm -f $(dot-target).tmp" EXIT;			\
63*4882a593Smuzhiyun	{ $(filechk_$(1)); } > $(dot-target).tmp;		\
64*4882a593Smuzhiyun	if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then	\
65*4882a593Smuzhiyun		$(kecho) '  UPD     $@';			\
66*4882a593Smuzhiyun		mv -f $(dot-target).tmp $@;			\
67*4882a593Smuzhiyun	fi
68*4882a593Smuzhiyunendef
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun######
71*4882a593Smuzhiyun# gcc support functions
72*4882a593Smuzhiyun# See documentation in Documentation/kbuild/makefiles.rst
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun# cc-cross-prefix
75*4882a593Smuzhiyun# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
76*4882a593Smuzhiyun# Return first <prefix> where a <prefix>gcc is found in PATH.
77*4882a593Smuzhiyun# If no gcc found in PATH with listed prefixes return nothing
78*4882a593Smuzhiyun#
79*4882a593Smuzhiyun# Note: '2>/dev/null' is here to force Make to invoke a shell. Otherwise, it
80*4882a593Smuzhiyun# would try to directly execute the shell builtin 'command'. This workaround
81*4882a593Smuzhiyun# should be kept for a long time since this issue was fixed only after the
82*4882a593Smuzhiyun# GNU Make 4.2.1 release.
83*4882a593Smuzhiyuncc-cross-prefix = $(firstword $(foreach c, $(1), \
84*4882a593Smuzhiyun			$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun# output directory for tests below
87*4882a593SmuzhiyunTMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun# try-run
90*4882a593Smuzhiyun# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
91*4882a593Smuzhiyun# Exit code chooses option. "$$TMP" serves as a temporary file and is
92*4882a593Smuzhiyun# automatically cleaned up.
93*4882a593Smuzhiyuntry-run = $(shell set -e;		\
94*4882a593Smuzhiyun	TMP=$(TMPOUT)/tmp;		\
95*4882a593Smuzhiyun	TMPO=$(TMPOUT)/tmp.o;		\
96*4882a593Smuzhiyun	mkdir -p $(TMPOUT);		\
97*4882a593Smuzhiyun	trap "rm -rf $(TMPOUT)" EXIT;	\
98*4882a593Smuzhiyun	if ($(1)) >/dev/null 2>&1;	\
99*4882a593Smuzhiyun	then echo "$(2)";		\
100*4882a593Smuzhiyun	else echo "$(3)";		\
101*4882a593Smuzhiyun	fi)
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun# as-option
104*4882a593Smuzhiyun# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
105*4882a593Smuzhiyun
106*4882a593Smuzhiyunas-option = $(call try-run,\
107*4882a593Smuzhiyun	$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun# as-instr
110*4882a593Smuzhiyun# Usage: cflags-y += $(call as-instr,instr,option1,option2)
111*4882a593Smuzhiyun
112*4882a593Smuzhiyunas-instr = $(call try-run,\
113*4882a593Smuzhiyun	printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun# __cc-option
116*4882a593Smuzhiyun# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
117*4882a593Smuzhiyun__cc-option = $(call try-run,\
118*4882a593Smuzhiyun	$(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4))
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun# cc-option
121*4882a593Smuzhiyun# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
122*4882a593Smuzhiyun
123*4882a593Smuzhiyuncc-option = $(call __cc-option, $(CC),\
124*4882a593Smuzhiyun	$(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun# cc-option-yn
127*4882a593Smuzhiyun# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
128*4882a593Smuzhiyuncc-option-yn = $(call try-run,\
129*4882a593Smuzhiyun	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun# cc-disable-warning
132*4882a593Smuzhiyun# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
133*4882a593Smuzhiyuncc-disable-warning = $(call try-run,\
134*4882a593Smuzhiyun	$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun# cc-ifversion
137*4882a593Smuzhiyun# Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
138*4882a593Smuzhiyuncc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun# ld-option
141*4882a593Smuzhiyun# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
142*4882a593Smuzhiyunld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun# ld-version
145*4882a593Smuzhiyun# Note this is mainly for HJ Lu's 3 number binutil versions
146*4882a593Smuzhiyunld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun# ld-ifversion
149*4882a593Smuzhiyun# Usage:  $(call ld-ifversion, -ge, 22252, y)
150*4882a593Smuzhiyunld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun######
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun###
155*4882a593Smuzhiyun# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
156*4882a593Smuzhiyun# Usage:
157*4882a593Smuzhiyun# $(Q)$(MAKE) $(build)=dir
158*4882a593Smuzhiyunbuild := -f $(srctree)/scripts/Makefile.build obj
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun###
161*4882a593Smuzhiyun# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
162*4882a593Smuzhiyun# Usage:
163*4882a593Smuzhiyun# $(Q)$(MAKE) $(dtbinst)=dir
164*4882a593Smuzhiyundtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun###
167*4882a593Smuzhiyun# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
168*4882a593Smuzhiyun# Usage:
169*4882a593Smuzhiyun# $(Q)$(MAKE) $(clean)=dir
170*4882a593Smuzhiyunclean := -f $(srctree)/scripts/Makefile.clean obj
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun# echo command.
173*4882a593Smuzhiyun# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
174*4882a593Smuzhiyunecho-cmd = $(if $($(quiet)cmd_$(1)),\
175*4882a593Smuzhiyun	echo '  $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun# sink stdout for 'make -s'
178*4882a593Smuzhiyun       redirect :=
179*4882a593Smuzhiyun quiet_redirect :=
180*4882a593Smuzhiyunsilent_redirect := exec >/dev/null;
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun# Delete the target on interruption
183*4882a593Smuzhiyun#
184*4882a593Smuzhiyun# GNU Make automatically deletes the target if it has already been changed by
185*4882a593Smuzhiyun# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make
186*4882a593Smuzhiyun# will delete incomplete targets), and resume it later.
187*4882a593Smuzhiyun#
188*4882a593Smuzhiyun# However, this does not work when the stderr is piped to another program, like
189*4882a593Smuzhiyun#  $ make >&2 | tee log
190*4882a593Smuzhiyun# Make dies with SIGPIPE before cleaning the targets.
191*4882a593Smuzhiyun#
192*4882a593Smuzhiyun# To address it, we clean the target in signal traps.
193*4882a593Smuzhiyun#
194*4882a593Smuzhiyun# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM.
195*4882a593Smuzhiyun# So, we cover them, and also SIGPIPE just in case.
196*4882a593Smuzhiyun#
197*4882a593Smuzhiyun# Of course, this is unneeded for phony targets.
198*4882a593Smuzhiyundelete-on-interrupt = \
199*4882a593Smuzhiyun	$(if $(filter-out $(PHONY), $@), \
200*4882a593Smuzhiyun		$(foreach sig, HUP INT QUIT TERM PIPE, \
201*4882a593Smuzhiyun			trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun# printing commands
204*4882a593Smuzhiyuncmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1))
205*4882a593Smuzhiyun
206*4882a593Smuzhiyun###
207*4882a593Smuzhiyun# if_changed      - execute command if any prerequisite is newer than
208*4882a593Smuzhiyun#                   target, or command line has changed
209*4882a593Smuzhiyun# if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
210*4882a593Smuzhiyun#                   including used config symbols
211*4882a593Smuzhiyun# if_changed_rule - as if_changed but execute rule instead
212*4882a593Smuzhiyun# See Documentation/kbuild/makefiles.rst for more info
213*4882a593Smuzhiyun
214*4882a593Smuzhiyunifneq ($(KBUILD_NOCMDDEP),1)
215*4882a593Smuzhiyun# Check if both commands are the same including their order. Result is empty
216*4882a593Smuzhiyun# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
217*4882a593Smuzhiyuncmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
218*4882a593Smuzhiyun                         $(subst $(space),$(space_escape),$(strip $(cmd_$1))))
219*4882a593Smuzhiyunelse
220*4882a593Smuzhiyuncmd-check = $(if $(strip $(cmd_$@)),,1)
221*4882a593Smuzhiyunendif
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun# Replace >$< with >$$< to preserve $ when reloading the .cmd file
224*4882a593Smuzhiyun# (needed for make)
225*4882a593Smuzhiyun# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
226*4882a593Smuzhiyun# (needed for make)
227*4882a593Smuzhiyun# Replace >'< with >'\''< to be able to enclose the whole string in '...'
228*4882a593Smuzhiyun# (needed for the shell)
229*4882a593Smuzhiyunmake-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun# Find any prerequisites that are newer than target or that do not exist.
232*4882a593Smuzhiyun# (This is not true for now; $? should contain any non-existent prerequisites,
233*4882a593Smuzhiyun# but it does not work as expected when .SECONDARY is present. This seems a bug
234*4882a593Smuzhiyun# of GNU Make.)
235*4882a593Smuzhiyun# PHONY targets skipped in both cases.
236*4882a593Smuzhiyunnewer-prereqs = $(filter-out $(PHONY),$?)
237*4882a593Smuzhiyun
238*4882a593Smuzhiyun# Execute command if command has changed or prerequisite(s) are updated.
239*4882a593Smuzhiyunif_changed = $(if $(newer-prereqs)$(cmd-check),                              \
240*4882a593Smuzhiyun	$(cmd);                                                              \
241*4882a593Smuzhiyun	printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun# Execute the command and also postprocess generated .d dependencies file.
244*4882a593Smuzhiyunif_changed_dep = $(if $(newer-prereqs)$(cmd-check),$(cmd_and_fixdep),@:)
245*4882a593Smuzhiyun
246*4882a593Smuzhiyuncmd_and_fixdep =                                                             \
247*4882a593Smuzhiyun	$(cmd);                                                              \
248*4882a593Smuzhiyun	scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\
249*4882a593Smuzhiyun	rm -f $(depfile)
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun# Usage: $(call if_changed_rule,foo)
252*4882a593Smuzhiyun# Will check if $(cmd_foo) or any of the prerequisites changed,
253*4882a593Smuzhiyun# and if so will execute $(rule_foo).
254*4882a593Smuzhiyunif_changed_rule = $(if $(newer-prereqs)$(cmd-check),$(rule_$(1)),@:)
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun###
257*4882a593Smuzhiyun# why - tell why a target got built
258*4882a593Smuzhiyun#       enabled by make V=2
259*4882a593Smuzhiyun#       Output (listed in the order they are checked):
260*4882a593Smuzhiyun#          (1) - due to target is PHONY
261*4882a593Smuzhiyun#          (2) - due to target missing
262*4882a593Smuzhiyun#          (3) - due to: file1.h file2.h
263*4882a593Smuzhiyun#          (4) - due to command line change
264*4882a593Smuzhiyun#          (5) - due to missing .cmd file
265*4882a593Smuzhiyun#          (6) - due to target not in $(targets)
266*4882a593Smuzhiyun# (1) PHONY targets are always build
267*4882a593Smuzhiyun# (2) No target, so we better build it
268*4882a593Smuzhiyun# (3) Prerequisite is newer than target
269*4882a593Smuzhiyun# (4) The command line stored in the file named dir/.target.cmd
270*4882a593Smuzhiyun#     differed from actual command line. This happens when compiler
271*4882a593Smuzhiyun#     options changes
272*4882a593Smuzhiyun# (5) No dir/.target.cmd file (used to store command line)
273*4882a593Smuzhiyun# (6) No dir/.target.cmd file and target not listed in $(targets)
274*4882a593Smuzhiyun#     This is a good hint that there is a bug in the kbuild file
275*4882a593Smuzhiyunifeq ($(KBUILD_VERBOSE),2)
276*4882a593Smuzhiyunwhy =                                                                        \
277*4882a593Smuzhiyun    $(if $(filter $@, $(PHONY)),- due to target is PHONY,                    \
278*4882a593Smuzhiyun        $(if $(wildcard $@),                                                 \
279*4882a593Smuzhiyun            $(if $(newer-prereqs),- due to: $(newer-prereqs),                \
280*4882a593Smuzhiyun                $(if $(cmd-check),                                           \
281*4882a593Smuzhiyun                    $(if $(cmd_$@),- due to command line change,             \
282*4882a593Smuzhiyun                        $(if $(filter $@, $(targets)),                       \
283*4882a593Smuzhiyun                            - due to missing .cmd file,                      \
284*4882a593Smuzhiyun                            - due to $(notdir $@) not in $$(targets)         \
285*4882a593Smuzhiyun                         )                                                   \
286*4882a593Smuzhiyun                     )                                                       \
287*4882a593Smuzhiyun                 )                                                           \
288*4882a593Smuzhiyun             ),                                                              \
289*4882a593Smuzhiyun             - due to target missing                                         \
290*4882a593Smuzhiyun         )                                                                   \
291*4882a593Smuzhiyun     )
292*4882a593Smuzhiyun
293*4882a593Smuzhiyunecho-why = $(call escsq, $(strip $(why)))
294*4882a593Smuzhiyunendif
295*4882a593Smuzhiyun
296*4882a593Smuzhiyun###############################################################################
297*4882a593Smuzhiyun#
298*4882a593Smuzhiyun# When a Kconfig string contains a filename, it is suitable for
299*4882a593Smuzhiyun# passing to shell commands. It is surrounded by double-quotes, and
300*4882a593Smuzhiyun# any double-quotes or backslashes within it are escaped by
301*4882a593Smuzhiyun# backslashes.
302*4882a593Smuzhiyun#
303*4882a593Smuzhiyun# This is no use for dependencies or $(wildcard). We need to strip the
304*4882a593Smuzhiyun# surrounding quotes and the escaping from quotes and backslashes, and
305*4882a593Smuzhiyun# we *do* need to escape any spaces in the string. So, for example:
306*4882a593Smuzhiyun#
307*4882a593Smuzhiyun# Usage: $(eval $(call config_filename,FOO))
308*4882a593Smuzhiyun#
309*4882a593Smuzhiyun# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
310*4882a593Smuzhiyun# transformed as described above to be suitable for use within the
311*4882a593Smuzhiyun# makefile.
312*4882a593Smuzhiyun#
313*4882a593Smuzhiyun# Also, if the filename is a relative filename and exists in the source
314*4882a593Smuzhiyun# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
315*4882a593Smuzhiyun# be prefixed to *both* command invocation and dependencies.
316*4882a593Smuzhiyun#
317*4882a593Smuzhiyun# Note: We also print the filenames in the quiet_cmd_foo text, and
318*4882a593Smuzhiyun# perhaps ought to have a version specially escaped for that purpose.
319*4882a593Smuzhiyun# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
320*4882a593Smuzhiyun# enough.  It'll strip the quotes in the common case where there's no
321*4882a593Smuzhiyun# space and it's a simple filename, and it'll retain the quotes when
322*4882a593Smuzhiyun# there's a space. There are some esoteric cases in which it'll print
323*4882a593Smuzhiyun# the wrong thing, but we don't really care. The actual dependencies
324*4882a593Smuzhiyun# and commands *do* get it right, with various combinations of single
325*4882a593Smuzhiyun# and double quotes, backslashes and spaces in the filenames.
326*4882a593Smuzhiyun#
327*4882a593Smuzhiyun###############################################################################
328*4882a593Smuzhiyun#
329*4882a593Smuzhiyundefine config_filename
330*4882a593Smuzhiyunifneq ($$(CONFIG_$(1)),"")
331*4882a593Smuzhiyun$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
332*4882a593Smuzhiyunifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
333*4882a593Smuzhiyunelse
334*4882a593Smuzhiyunifeq ($$(wildcard $$($(1)_FILENAME)),)
335*4882a593Smuzhiyunifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
336*4882a593Smuzhiyun$(1)_SRCPREFIX := $(srctree)/
337*4882a593Smuzhiyunendif
338*4882a593Smuzhiyunendif
339*4882a593Smuzhiyunendif
340*4882a593Smuzhiyunendif
341*4882a593Smuzhiyunendef
342*4882a593Smuzhiyun#
343*4882a593Smuzhiyun###############################################################################
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun# delete partially updated (i.e. corrupted) files on error
346*4882a593Smuzhiyun.DELETE_ON_ERROR:
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun# do not delete intermediate files automatically
349*4882a593Smuzhiyun.SECONDARY:
350