INSTALL_HDR_PATH=$(objtree)/usr
export INSTALL_HDR_PATH
-headers_install_all: include/linux/version.h
- $(Q)unifdef -Ux /dev/null
+ HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
+
+ PHONY += headers_install_all
- $(MAKE) ARCH=$$arch -rR -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
++headers_install_all: include/linux/version.h scripts_basic FORCE
++ $(Q)$(MAKE) $(build)=scripts scripts/unifdef
+ $(Q)for arch in $(HDRARCHES); do \
++ $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
+ done
+
PHONY += headers_install
-headers_install: include/linux/version.h
+headers_install: include/linux/version.h scripts_basic FORCE
+ @if [ ! -r include/asm-$(ARCH)/Kbuild ]; then \
+ echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \
+ exit 1 ; fi
- $(Q)unifdef -Ux /dev/null
- $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include
+ $(Q)$(MAKE) $(build)=scripts scripts/unifdef
+ $(Q)rm -rf $(INSTALL_HDR_PATH)/include
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include
PHONY += headers_check
headers_check: headers_install