diff options
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r-- | scripts/Kbuild.include | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 982dcae7bbe2..c29be8f90248 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -25,6 +25,13 @@ basetarget = $(basename $(notdir $@)) | |||
25 | escsq = $(subst $(squote),'\$(squote)',$1) | 25 | escsq = $(subst $(squote),'\$(squote)',$1) |
26 | 26 | ||
27 | ### | 27 | ### |
28 | # Easy method for doing a status message | ||
29 | kecho := : | ||
30 | quiet_kecho := echo | ||
31 | silent_kecho := : | ||
32 | kecho := $($(quiet)kecho) | ||
33 | |||
34 | ### | ||
28 | # filechk is used to check if the content of a generated file is updated. | 35 | # filechk is used to check if the content of a generated file is updated. |
29 | # Sample usage: | 36 | # Sample usage: |
30 | # define filechk_sample | 37 | # define filechk_sample |
@@ -39,22 +46,15 @@ escsq = $(subst $(squote),'\$(squote)',$1) | |||
39 | # - If they are equal no change, and no timestamp update | 46 | # - If they are equal no change, and no timestamp update |
40 | # - stdin is piped in from the first prerequisite ($<) so one has | 47 | # - stdin is piped in from the first prerequisite ($<) so one has |
41 | # to specify a valid file as first prerequisite (often the kbuild file) | 48 | # to specify a valid file as first prerequisite (often the kbuild file) |
42 | chk_filechk = : | ||
43 | quiet_chk_filechk = echo ' CHK $@' | ||
44 | silent_chk_filechk = : | ||
45 | upd_filechk = : | ||
46 | quiet_upd_filechk = echo ' UPD $@' | ||
47 | silent_upd_filechk = : | ||
48 | |||
49 | define filechk | 49 | define filechk |
50 | $(Q)set -e; \ | 50 | $(Q)set -e; \ |
51 | $($(quiet)chk_filechk); \ | 51 | $(kecho) ' CHK $@'; \ |
52 | mkdir -p $(dir $@); \ | 52 | mkdir -p $(dir $@); \ |
53 | $(filechk_$(1)) < $< > $@.tmp; \ | 53 | $(filechk_$(1)) < $< > $@.tmp; \ |
54 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | 54 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ |
55 | rm -f $@.tmp; \ | 55 | rm -f $@.tmp; \ |
56 | else \ | 56 | else \ |
57 | $($(quiet)upd_filechk); \ | 57 | $(kecho) ' UPD $@'; \ |
58 | mv -f $@.tmp $@; \ | 58 | mv -f $@.tmp $@; \ |
59 | fi | 59 | fi |
60 | endef | 60 | endef |
@@ -144,7 +144,9 @@ ld-option = $(call try-run,\ | |||
144 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | 144 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj |
145 | 145 | ||
146 | # Prefix -I with $(srctree) if it is not an absolute path. | 146 | # Prefix -I with $(srctree) if it is not an absolute path. |
147 | addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) | 147 | # skip if -I has no parameter |
148 | addtree = $(if $(patsubst -I%,%,$(1)), \ | ||
149 | $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)) | ||
148 | 150 | ||
149 | # Find all -I options and call addtree | 151 | # Find all -I options and call addtree |
150 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) | 152 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) |