Skip to content

Commit 4e420aa

Browse files
committed
kbuild: always unifdef files in headers_install*
unifdef utility is fast enough to warrant that we always run the scripts through unifdef. This patch runs all headers listed with header-y and unifdef-y through unifdef. Next step is to drop unifdef-y in all Kbuild files and that can now be done in smaller steps. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Adrian Bunk <bunk@kernel.org>
1 parent e6883b1 commit 4e420aa

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

scripts/Makefile.headersinst

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,22 @@ ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
5050
_dst := include/asm
5151
endif
5252

53-
header-y := $(sort $(header-y))
54-
unifdef-y := $(sort $(unifdef-y))
53+
header-y := $(sort $(header-y) $(unifdef-y))
5554
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
5655
header-y := $(filter-out %/, $(header-y))
57-
header-y := $(filter-out $(unifdef-y),$(header-y))
5856

5957
# stamp files for header checks
60-
check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y))
58+
check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
6159

6260
# Work out what needs to be removed
6361
oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
64-
unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders))
62+
unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
6563

6664
oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
6765
unwanted += $(filter-out $(check-y),$(oldcheckstamps))
6866

6967
# Prefix them all with full paths to $(INSTALL_HDR_PATH)
7068
header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
71-
unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y))
7269
objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
7370
check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
7471

@@ -88,10 +85,6 @@ quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
8885
cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
8986
$(INSTALL_HDR_PATH)/$(_dst)
9087

91-
quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
92-
cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
93-
> $@
94-
9588
quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
9689
cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
9790
| $(HDRSED) > $@ || :
@@ -151,10 +144,10 @@ include /dev/null $(wildcard $(check-y))
151144

152145
else
153146
# Rules for installing headers
154-
__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y)
147+
__headersinst: $(subdir-y) $(header-y) $(altarch-y) $(objhdr-y)
155148
@true
156149

157-
$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
150+
$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
158151

159152
$(INSTALL_HDR_PATH)/$(_dst):
160153
$(call cmd,mkdir)
@@ -164,18 +157,16 @@ $(unwanted):
164157
$(call cmd,remove)
165158

166159
ifdef GENASM
167-
$(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES)
160+
$(objhdr-y) $(header-y): $(KBUILDFILES)
168161
$(call cmd,gen)
169162

170163
else
171-
$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
164+
$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
172165
$(call cmd,o_hdr_install)
173166

174-
$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
175-
$(call cmd,headers_install)
176-
177-
$(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
167+
$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
178168
$(call cmd,unifdef)
169+
179170
endif
180171
endif
181172

@@ -184,7 +175,7 @@ hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
184175
.PHONY: altarch-dir
185176
# All the files in the normal arch dir must be created first, since we test
186177
# for their existence.
187-
altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y)
178+
altarch-dir: $(subdir-y) $(header-y) $(objhdr-y)
188179
$(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
189180
$(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
190181

0 commit comments

Comments
 (0)