From: Sam Ravnborg <sam@ravnborg.org>
To: David Woodhouse <dwmw2@infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] header install: cosmetic cleanups to kbuild infrastructure
Date: Sun, 11 Jun 2006 14:10:05 +0200 [thread overview]
Message-ID: <20060611121005.GA1342@mars.ravnborg.org> (raw)
A set of cosmetic cleanups for the header install kbuild infrastructure:
o Use consistent style for PHONY target in top-lvel Makefile
o Avoid '@', we want $(Q) so command is visible with make V=1
o Makefile.headerinst now fits within my 80 coloumn window
o Only accept Kbuild as input filename. This is new stuff so no
need to be backward compatible here.
o A small comment in the top of the Makefile.headerinst file to
explain variable usage. More is needed.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
This is on top of hdrinstall-2.6.git as of yesterday.
Sam
diff --git a/Makefile b/Makefile
index 8d92d78..0d372a6 100644
--- a/Makefile
+++ b/Makefile
@@ -862,13 +862,13 @@ # Kernel headers
INSTALL_HDR_PATH=$(MODLIB)/abi
export INSTALL_HDR_PATH
-.PHONY: headers_install
-headers_install: include/linux/version.h
- @unifdef -Ux /dev/null
- @rm -rf $(INSTALL_HDR_PATH)/include
+PHONY += headers_install
+headers_install: prepare
+ $(Q)unifdef -Ux /dev/null
+ $(Q)rm -rf $(INSTALL_HDR_PATH)/include
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include
-.PHONY: headers_check
+PHONY += headers_check
headers_check: headers_install
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index e653334..4e1f973 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -1,5 +1,10 @@
# ==========================================================================
# Installing headers
+#
+# header-y files will be installed verbatim
+# unifdef-y are the files where unifdef will be run before installing files
+# objhdr-y are generated files that will be installed verbatim
+#
# ==========================================================================
UNIFDEF := unifdef -U__KERNEL__
@@ -19,10 +24,10 @@ # use '-include'.
GENASM := 1
archasm := $(subst include/asm,asm-$(ARCH),$(obj))
altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
--include $(if $(wildcard $(srctree)/include/$(archasm)/Kbuild), include/$(archasm)/Kbuild, include/$(archasm)/Makefile)
--include $(if $(wildcard $(srctree)/include/$(altarchasm)/Kbuild), include/$(altarchasm)/Kbuild, include/$(altarchasm)/Makefile)
+-include $(srctree)/include/$(archasm)/Kbuild
+-include $(srctree)/include/$(altarchasm)/Kbuild
else
-include $(if $(wildcard $(srctree)/$(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+include $(srctree)/$(obj)/Kbuild
endif
include scripts/Kbuild.include
@@ -45,47 +50,55 @@ altarch-y := altarch-dir
endif
endif
+# Make the definitions visible for recursive make invocations
export ALTARCH
export ARCHDEF
export ALTARCHDEF
-quiet_cmd_o_hdr_install = INSTALL_O $(_dst)/$@
+quiet_cmd_o_hdr_install = INSTALL $(_dst)/$@
cmd_o_hdr_install = cp $(objtree)/$(obj)/$@ $(INSTALL_HDR_PATH)/$(_dst)
quiet_cmd_headers_install = INSTALL $(_dst)/$@
cmd_headers_install = cp $(srctree)/$(obj)/$@ $(INSTALL_HDR_PATH)/$(_dst)
quiet_cmd_unifdef = UNIFDEF $(_dst)/$@
- cmd_unifdef = $(UNIFDEF) $(srctree)/$(obj)/$@ > $(INSTALL_HDR_PATH)/$(_dst)/$@ || :
+ cmd_unifdef = $(UNIFDEF) $(srctree)/$(obj)/$@ \
+ > $(INSTALL_HDR_PATH)/$(_dst)/$@ || :
-quiet_cmd_check = CHECK $(_dst)/$@
- cmd_check = $(srctree)/scripts/hdrcheck.sh $(INSTALL_HDR_PATH)/include $(INSTALL_HDR_PATH)/$(_dst)/$@
+quiet_cmd_check = CHECK $(_dst)/$@
+ cmd_check = $(srctree)/scripts/hdrcheck.sh \
+ $(INSTALL_HDR_PATH)/include \
+ $(INSTALL_HDR_PATH)/$(_dst)/$@
-quiet_cmd_mkdir = MKDIR $@
+quiet_cmd_mkdir = MKDIR $@
cmd_mkdir = mkdir -p $(INSTALL_HDR_PATH)/$@
-quiet_cmd_gen = GEN $(_dst)/$@
- cmd_gen = STUBDEF=__ASM_STUB_`echo $@ | tr a-z. A-Z_` ; \
- ( echo "/* File autogenerated by 'make headers_install' */" ; \
- echo "\#ifndef $$STUBDEF" ; \
- echo "\#define $$STUBDEF" ; \
- echo "\# if $(ARCHDEF)" ; \
- if [ -r $(srctree)/include/$(archasm)/$@ ]; then \
- echo "\# include <$(archasm)/$@>" ; \
- else \
- echo "\# error $(archasm)/$@ does not exist in the $(ARCH) architecture" ; \
- fi ; \
- echo "\# elif $(ALTARCHDEF)" ; \
- if [ -r $(srctree)/include/$(altarchasm)/$@ ]; then \
- echo "\# include <$(altarchasm)/$@>" ; \
- else \
- echo "\# error $(altarchasm)/$@ does not exist in the $(ALTARCH) architecture" ; \
- fi ; \
- echo "\# else" ; \
- echo "\# warning This machine appears to be neither $(ARCH) nor $(ALTARCH)." ; \
- echo "\# endif" ; \
- echo "\#endif /* $$STUBDEF */" ; \
- ) > $(INSTALL_HDR_PATH)/$(_dst)/$@
+quiet_cmd_gen = GEN $(_dst)/$@
+ cmd_gen = \
+STUBDEF=__ASM_STUB_`echo $@ | tr a-z. A-Z_`; \
+(echo "/* File autogenerated by 'make headers_install' */" ; \
+echo "\#ifndef $$STUBDEF" ; \
+echo "\#define $$STUBDEF" ; \
+echo "\# if $(ARCHDEF)" ; \
+if [ -r $(srctree)/include/$(archasm)/$@ ]; then \
+ echo "\# include <$(archasm)/$@>" ; \
+else \
+ echo "\# error $(archasm)/$@ does not exist in" \
+ "the $(ARCH) architecture" ; \
+fi ; \
+echo "\# elif $(ALTARCHDEF)" ; \
+if [ -r $(srctree)/include/$(altarchasm)/$@ ]; then \
+ echo "\# include <$(altarchasm)/$@>" ; \
+else \
+ echo "\# error $(altarchasm)/$@ does not exist in" \
+ "the $(ALTARCH) architecture" ; \
+fi ; \
+echo "\# else" ; \
+echo "\# warning This machine appears to be" \
+ "neither $(ARCH) nor $(ALTARCH)." ; \
+echo "\# endif" ; \
+echo "\#endif /* $$STUBDEF */" ; \
+) > $(INSTALL_HDR_PATH)/$(_dst)/$@
__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y)
@@ -120,11 +133,13 @@ else
endif
endif
+hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+
.PHONY: altarch-dir
altarch-dir:
- $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
- $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include/asm dst=include/asm
+ $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
+ $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm
# Recursion
$(subdir-y):
- $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
+ $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
next reply other threads:[~2006-06-11 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-11 12:10 Sam Ravnborg [this message]
2006-06-11 12:47 ` David Woodhouse
2006-06-11 14:34 ` Sam Ravnborg
2006-06-11 15:12 ` David Woodhouse
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=20060611121005.GA1342@mars.ravnborg.org \
--to=sam@ravnborg.org \
--cc=dwmw2@infradead.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
all inboxes | Powered by JetHome®