[PATCH] header install: cosmetic cleanups to kbuild infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux