Commit 4e420aa9 authored by Sam Ravnborg's avatar Sam Ravnborg

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: default avatarSam Ravnborg <sam@ravnborg.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Adrian Bunk <bunk@kernel.org>
parent e6883b18
...@@ -50,25 +50,22 @@ ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR)) ...@@ -50,25 +50,22 @@ ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm _dst := include/asm
endif endif
header-y := $(sort $(header-y)) header-y := $(sort $(header-y) $(unifdef-y))
unifdef-y := $(sort $(unifdef-y))
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y))) subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
header-y := $(filter-out %/, $(header-y)) header-y := $(filter-out %/, $(header-y))
header-y := $(filter-out $(unifdef-y),$(header-y))
# stamp files for header checks # stamp files for header checks
check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y)) check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
# Work out what needs to be removed # Work out what needs to be removed
oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h)) oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders)) unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h)) oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
unwanted += $(filter-out $(check-y),$(oldcheckstamps)) unwanted += $(filter-out $(check-y),$(oldcheckstamps))
# Prefix them all with full paths to $(INSTALL_HDR_PATH) # Prefix them all with full paths to $(INSTALL_HDR_PATH)
header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y)) header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y))
objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
...@@ -88,10 +85,6 @@ quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) ...@@ -88,10 +85,6 @@ quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \ cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
$(INSTALL_HDR_PATH)/$(_dst) $(INSTALL_HDR_PATH)/$(_dst)
quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
> $@
quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \ cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
| $(HDRSED) > $@ || : | $(HDRSED) > $@ || :
...@@ -151,10 +144,10 @@ include /dev/null $(wildcard $(check-y)) ...@@ -151,10 +144,10 @@ include /dev/null $(wildcard $(check-y))
else else
# Rules for installing headers # Rules for installing headers
__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y) __headersinst: $(subdir-y) $(header-y) $(altarch-y) $(objhdr-y)
@true @true
$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted) $(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
$(INSTALL_HDR_PATH)/$(_dst): $(INSTALL_HDR_PATH)/$(_dst):
$(call cmd,mkdir) $(call cmd,mkdir)
...@@ -164,18 +157,16 @@ $(unwanted): ...@@ -164,18 +157,16 @@ $(unwanted):
$(call cmd,remove) $(call cmd,remove)
ifdef GENASM ifdef GENASM
$(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES) $(objhdr-y) $(header-y): $(KBUILDFILES)
$(call cmd,gen) $(call cmd,gen)
else else
$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES) $(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
$(call cmd,o_hdr_install) $(call cmd,o_hdr_install)
$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) $(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
$(call cmd,headers_install)
$(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
$(call cmd,unifdef) $(call cmd,unifdef)
endif endif
endif endif
...@@ -184,7 +175,7 @@ hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj ...@@ -184,7 +175,7 @@ hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
.PHONY: altarch-dir .PHONY: altarch-dir
# All the files in the normal arch dir must be created first, since we test # All the files in the normal arch dir must be created first, since we test
# for their existence. # for their existence.
altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y) altarch-dir: $(subdir-y) $(header-y) $(objhdr-y)
$(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH) $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
$(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR) $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment