* [PATCH] header install: cosmetic cleanups to kbuild infrastructure
@ 2006-06-11 12:10 Sam Ravnborg
2006-06-11 12:47 ` David Woodhouse
0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2006-06-11 12:10 UTC (permalink / raw)
To: David Woodhouse, LKML
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] header install: cosmetic cleanups to kbuild infrastructure
2006-06-11 12:10 [PATCH] header install: cosmetic cleanups to kbuild infrastructure Sam Ravnborg
@ 2006-06-11 12:47 ` David Woodhouse
2006-06-11 14:34 ` Sam Ravnborg
0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2006-06-11 12:47 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: LKML
On Sun, 2006-06-11 at 14:10 +0200, Sam Ravnborg wrote:
> -headers_install: include/linux/version.h
> +headers_install: prepare
That breaks cross-export of headers when we don't have a cross-compiler.
I care about this case because it's how we do glibc-kernheaders for
Fedora at the moment -- we build a tarball containing _all_ the headers,
and that tarball is used as source for a separate glibc-kernheaders
package, after reviewing the changes in it.
for a in x86_64 s390 ia64 powerpc sparc64; do
make ARCH=$a INSTALL_HDR_PATH=/tmp/fish/$a headers_install
done
cd /tmp/fish
mv usr usr.$$
mv x86_64 usr
mv usr/include/asm usr/include/asm-bix86
mv sparc64/include/asm usr/include/asm-bisparc
mv sparc64/include/asm-sparc{,64} usr/include
for a in s390 ia64 powerpc; do
mv -v $a/include/asm usr/include/asm-$a
rm -rf $a
done
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] header install: cosmetic cleanups to kbuild infrastructure
2006-06-11 12:47 ` David Woodhouse
@ 2006-06-11 14:34 ` Sam Ravnborg
2006-06-11 15:12 ` David Woodhouse
0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2006-06-11 14:34 UTC (permalink / raw)
To: David Woodhouse; +Cc: LKML
On Sun, Jun 11, 2006 at 01:47:19PM +0100, David Woodhouse wrote:
> On Sun, 2006-06-11 at 14:10 +0200, Sam Ravnborg wrote:
> > -headers_install: include/linux/version.h
> > +headers_install: prepare
>
> That breaks cross-export of headers when we don't have a cross-compiler.
That was i thinko that slept through. In general avoiding all the
specific dependencies in the mess that is named Makefile is good but
in this case there is no good reason to use the prepare targets.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] header install: cosmetic cleanups to kbuild infrastructure
2006-06-11 14:34 ` Sam Ravnborg
@ 2006-06-11 15:12 ` David Woodhouse
0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2006-06-11 15:12 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: LKML
On Sun, 2006-06-11 at 16:34 +0200, Sam Ravnborg wrote:
> That was i thinko that slept through. In general avoiding all the
> specific dependencies in the mess that is named Makefile is good but
> in this case there is no good reason to use the prepare targets.
OK, I've applied your patch and then switched that back to depend on
include/linux/version.h again. Thanks.
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-06-11 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-11 12:10 [PATCH] header install: cosmetic cleanups to kbuild infrastructure Sam Ravnborg
2006-06-11 12:47 ` David Woodhouse
2006-06-11 14:34 ` Sam Ravnborg
2006-06-11 15:12 ` David Woodhouse
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®