Messages in this thread Patch in this message |  | | Date | Sun, 11 Jun 2006 14:10:05 +0200 | | From | Sam Ravnborg <> | | Subject | [PATCH] header install: cosmetic cleanups to kbuild infrastructure |
| |
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) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |