From: Sam Ravnborg <sam@ravnborg.org>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 4/6] kbuild: code refactoring in Makefile.headerinst
Date: Sun, 8 Jun 2008 22:07:36 +0200 [thread overview]
Message-ID: <1212955658-32168-4-git-send-email-sam@ravnborg.org> (raw)
In-Reply-To: <20080608094730.GA30098@uranus.ravnborg.org>
No functional changes just improved readability
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
| 64 +++++++++++++++++++++++-------------------
1 files changed, 35 insertions(+), 29 deletions(-)
--git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1fb8c00..599adc6 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -10,7 +10,7 @@
UNIFDEF := scripts/unifdef -U__KERNEL__
# Eliminate the contents of (and inclusions of) compiler.h
-HDRSED := sed -e "s/ inline / __inline__ /g" \
+HDRSED := sed -e "s/ inline / __inline__ /g" \
-e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \
-e "s/(__user[[:space:]]\{1,\}/ (/g" \
-e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
@@ -37,6 +37,8 @@ ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
_dst := include/asm
endif
+install := $(INSTALL_HDR_PATH)/$(_dst)
+
header-y := $(sort $(header-y) $(unifdef-y))
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
header-y := $(filter-out %/, $(header-y))
@@ -45,34 +47,34 @@ header-y := $(filter-out %/, $(header-y))
check-y := $(patsubst %,.check.%,$(header-y) $(objhdr-y))
# Work out what needs to be removed
-oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
-unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
+oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
+unwanted := $(filter-out $(header-y) $(objhdr-y),$(oldheaders))
-oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
-unwanted += $(filter-out $(check-y),$(oldcheckstamps))
+oldcheckstamps := $(patsubst $(install)/%,%,$(wildcard $(install)/.check.*.h))
+unwanted += $(filter-out $(check-y),$(oldcheckstamps))
# Prefix them all with full paths to $(INSTALL_HDR_PATH)
-header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
-objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
-check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
+header-y := $(patsubst %,$(install)/%,$(header-y))
+objhdr-y := $(patsubst %,$(install)/%,$(objhdr-y))
+check-y := $(patsubst %,$(install)/%,$(check-y))
-quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
- $(INSTALL_HDR_PATH)/$(_dst)
+quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_o_hdr_install = cp $(patsubst $(install)/%,$(objtree)/$(obj)/%,$@) \
+ $(install)
-quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
- | $(HDRSED) > $@ || :
+quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_unifdef = $(UNIFDEF) $(patsubst $(install)/%,$(srctree)/$(obj)/%,$@)\
+ | $(HDRSED) > $@ || :
-quiet_cmd_check = CHECK $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/.check.%,$(_dst)/%,$@)
- cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \
- $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
+quiet_cmd_check = CHECK $(patsubst $(install)/.check.%,$(_dst)/%,$@)
+ cmd_check = $(CONFIG_SHELL) $(srctree)/scripts/hdrcheck.sh \
+ $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
-quiet_cmd_remove = REMOVE $(_dst)/$@
- cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@
+quiet_cmd_remove = REMOVE $(_dst)/$@
+ cmd_remove = rm -f $(install)/$@
-quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
- cmd_mkdir = mkdir -p $@
+quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+ cmd_mkdir = mkdir -p $@
.PHONY: __headersinst __headerscheck
@@ -80,13 +82,14 @@ ifdef HDRCHECK
__headerscheck: $(subdir-y) $(check-y)
@true
-$(check-y) : $(INSTALL_HDR_PATH)/$(_dst)/.check.%.h : $(INSTALL_HDR_PATH)/$(_dst)/%.h
+$(check-y) : $(install)/.check.%.h : $(install)/%.h
$(call cmd,check)
# Other dependencies for $(check-y)
include /dev/null $(wildcard $(check-y))
-# ... but leave $(check-y) as .PHONY for now until those deps are actually correct.
+# but leave $(check-y) as .PHONY for now until those
+# deps are actually correct.
.PHONY: $(check-y)
else
@@ -94,26 +97,29 @@ else
__headersinst: $(subdir-y) $(header-y) $(objhdr-y)
@true
-$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
+$(objhdr-y) $(subdir-y) $(header-y): | $(install) $(unwanted)
-$(INSTALL_HDR_PATH)/$(_dst):
+$(install):
$(call cmd,mkdir)
+# Rules for removing unwanted header files
.PHONY: $(unwanted)
$(unwanted):
$(call cmd,remove)
-$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
+# Install generated files
+$(objhdr-y): $(install)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
$(call cmd,o_hdr_install)
-$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
+# Unifdef header files and install them
+$(header-y): $(install)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
$(call cmd,unifdef)
endif
-hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
# Recursion
.PHONY: $(subdir-y)
$(subdir-y):
- $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
+ $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
--
1.5.4.1.143.ge7e51
next prev parent reply other threads:[~2008-06-08 20:06 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-08 9:47 [PATCH] Speed up "make headers_*" Sam Ravnborg
2008-06-08 10:12 ` Vegard Nossum
2008-06-08 10:41 ` Sam Ravnborg
2008-06-08 10:49 ` David Woodhouse
2008-06-08 11:17 ` Sam Ravnborg
2008-06-08 12:23 ` Oleg Verych
2008-06-08 13:17 ` David Woodhouse
2008-06-08 17:06 ` Segher Boessenkool
2008-06-08 17:34 ` Andreas Schwab
2008-06-08 19:45 ` Segher Boessenkool
2008-06-08 20:36 ` Geert Uytterhoeven
2008-06-08 11:01 ` WANG Cong
2008-06-08 11:18 ` Sam Ravnborg
2008-06-08 11:06 ` Vegard Nossum
2008-06-08 11:20 ` Sam Ravnborg
2008-06-08 11:20 ` David Woodhouse
2008-06-08 11:30 ` Sam Ravnborg
2008-06-08 11:47 ` David Woodhouse
2008-06-08 12:14 ` David Woodhouse
2008-06-08 12:29 ` David Woodhouse
2008-06-08 20:07 ` Sam Ravnborg
2008-06-08 20:58 ` David Woodhouse
2008-06-08 21:13 ` Sam Ravnborg
2008-06-09 6:23 ` Sam Ravnborg
2008-06-08 20:07 ` [PATCH 1/6] kbuild: refactor headers_* targets in Makefile Sam Ravnborg
2008-06-08 20:07 ` [PATCH 2/6] kbuild: always unifdef files in headers_install* Sam Ravnborg
2008-06-08 20:07 ` [PATCH 3/6] kbuild: drop support of ALTARCH for headers_* Sam Ravnborg
2008-06-08 20:07 ` Sam Ravnborg [this message]
2008-06-08 20:07 ` [PATCH 5/6] kbuild: error out early in make headers_install Sam Ravnborg
2008-06-09 10:19 ` David Woodhouse
2008-06-08 20:07 ` [PATCH 6/6] kbuild: optimize headers_* targets Sam Ravnborg
2008-06-08 20:37 ` Vegard Nossum
2008-06-08 21:15 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1212955658-32168-4-git-send-email-sam@ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox