diff --git a/Makefile b/Makefile index 39ee585b52b1..11445a7dd820 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ old_version_h := include/linux/version.h clean-targets := %clean mrproper cleandocs no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ - $(version_h) headers_% archheaders archscripts \ + $(version_h) headers headers_% archheaders archscripts \ %asm-generic kernelversion %src-pkg no-sync-config-targets := $(no-dot-config-targets) install %install \ kernelrelease @@ -1178,25 +1178,32 @@ headerdep: #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -PHONY += archheaders archscripts - -PHONY += __headers -__headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts +quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include + cmd_headers_install = \ + mkdir -p $(INSTALL_HDR_PATH); \ + rsync -mrl --include='*/' --include='*\.h' --exclude='*' \ + usr/include $(INSTALL_HDR_PATH) PHONY += headers_install -headers_install: __headers +headers_install: headers + $(call cmd,headers_install) + +PHONY += archheaders archscripts + +PHONY += headers +headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include PHONY += headers_check -headers_check: headers_install +headers_check: headers $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include HDRCHECK=1 ifdef CONFIG_HEADERS_INSTALL -prepare: headers_install +prepare: headers endif ifdef CONFIG_HEADERS_CHECK diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6a6ea4219d1e..0031a31d98c2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -324,9 +324,7 @@ config HEADERS_CHECK attempt to include files which were not exported, etc. If you're making modifications to header files which are - relevant for userspace, say 'Y', and check the headers - exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in - your build tree), to make sure they're suitable. + relevant for userspace, say 'Y'. config OPTIMIZE_INLINING bool "Allow compiler to uninline functions marked 'inline'" diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 3d1ebaabd1b6..1af6d0b06585 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -41,7 +41,7 @@ ifeq ($(skip-inst),) kbuild-file := $(srctree)/$(obj)/Kbuild -include $(kbuild-file) -installdir := $(INSTALL_HDR_PATH)/$(dst) +installdir := usr/$(dst) gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) header-files := $(notdir $(wildcard $(srcdir)/*.h)) header-files := $(filter-out $(no-export-headers), $(header-files)) @@ -60,10 +60,10 @@ output-files := $(addprefix $(installdir)/, $(all-files)) oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders)) -# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) +# Prefix unwanted with full paths to objtree unwanted-file := $(addprefix $(installdir)/, $(unwanted)) -printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) +printdir = $(patsubst %/,%,$(dir $@)) quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ file$(if $(word 2, $(all-files)),s)) @@ -81,7 +81,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) cmd_check = for f in $(all-files); do \ echo "$(installdir)/$${f}"; done \ | xargs \ - $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ + $(PERL) $< usr/include $(SRCARCH); \ touch $@ ifndef HDRCHECK