Merge git://git.infradead.org/hdrinstall-2.6
* git://git.infradead.org/hdrinstall-2.6: Remove export of include/linux/isdn/tpam.h Remove <linux/i2c-id.h> and <linux/i2c-algo-ite.h> from userspace export Restrict headers exported to userspace for SPARC and SPARC64 Add empty Kbuild files for 'make headers_install' in remaining arches. Add Kbuild file for Alpha 'make headers_install' Add Kbuild file for SPARC 'make headers_install' Add Kbuild file for IA64 'make headers_install' Add Kbuild file for S390 'make headers_install' Add Kbuild file for i386 'make headers_install' Add Kbuild file for x86_64 'make headers_install' Add Kbuild file for PowerPC 'make headers_install' Add generic Kbuild files for 'make headers_install' Basic implementation of 'make headers_check' Basic implementation of 'make headers_install'
This commit is contained in:
158
scripts/Makefile.headersinst
Normal file
158
scripts/Makefile.headersinst
Normal file
@@ -0,0 +1,158 @@
|
||||
# ==========================================================================
|
||||
# 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__
|
||||
|
||||
# Eliminate the contents of (and inclusions of) compiler.h
|
||||
HDRSED := sed -e "s/ inline / __inline__ /g" \
|
||||
-e "s/[[:space:]]__user[[:space:]]\+/ /g" \
|
||||
-e "s/(__user[[:space:]]\+/ (/g" \
|
||||
-e "s/[[:space:]]__force[[:space:]]\+/ /g" \
|
||||
-e "s/(__force[[:space:]]\+/ (/g" \
|
||||
-e "s/[[:space:]]__iomem[[:space:]]\+/ /g" \
|
||||
-e "s/(__iomem[[:space:]]\+/ (/g" \
|
||||
-e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \
|
||||
-e "s/[[:space:]]__attribute_const__$$//" \
|
||||
-e "/^\#include <linux\/compiler.h>/d"
|
||||
|
||||
_dst := $(if $(dst),$(dst),$(obj))
|
||||
|
||||
.PHONY: __headersinst
|
||||
__headersinst:
|
||||
|
||||
|
||||
ifeq (,$(patsubst include/asm/%,,$(obj)/))
|
||||
# For producing the generated stuff in include/asm for biarch builds, include
|
||||
# both sets of Kbuild files; we'll generate anything which is mentioned in
|
||||
# _either_ arch, and recurse into subdirectories which are mentioned in either
|
||||
# arch. Since some directories may exist in one but not the other, we must
|
||||
# use '-include'.
|
||||
GENASM := 1
|
||||
archasm := $(subst include/asm,asm-$(ARCH),$(obj))
|
||||
altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
|
||||
-include $(srctree)/include/$(archasm)/Kbuild
|
||||
-include $(srctree)/include/$(altarchasm)/Kbuild
|
||||
else
|
||||
include $(srctree)/$(obj)/Kbuild
|
||||
endif
|
||||
|
||||
include scripts/Kbuild.include
|
||||
|
||||
# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then
|
||||
# override $(_dst) so that we install to include/asm directly.
|
||||
ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH))
|
||||
_dst := include/asm
|
||||
endif
|
||||
|
||||
header-y := $(sort $(header-y))
|
||||
unifdef-y := $(sort $(unifdef-y))
|
||||
subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
|
||||
header-y := $(filter-out %/, $(header-y))
|
||||
header-y := $(filter-out $(unifdef-y),$(header-y))
|
||||
|
||||
ifdef ALTARCH
|
||||
ifeq ($(obj),include/asm-$(ARCH))
|
||||
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 $(_dst)/$@
|
||||
cmd_o_hdr_install = cp $(objtree)/$(obj)/$@ $(INSTALL_HDR_PATH)/$(_dst)
|
||||
|
||||
quiet_cmd_headers_install = INSTALL $(_dst)/$@
|
||||
cmd_headers_install = $(HDRSED) $(srctree)/$(obj)/$@ \
|
||||
> $(INSTALL_HDR_PATH)/$(_dst)/$@
|
||||
|
||||
quiet_cmd_unifdef = UNIFDEF $(_dst)/$@
|
||||
cmd_unifdef = $(UNIFDEF) $(srctree)/$(obj)/$@ | $(HDRSED) \
|
||||
> $(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 $@
|
||||
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)/$@
|
||||
|
||||
__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y)
|
||||
|
||||
.PHONY: $(header-y) $(unifdef-y) $(subdir-y)
|
||||
|
||||
ifdef HDRCHECK
|
||||
# Rules for checking headers
|
||||
$(objhdr-y) $(header-y) $(unifdef-y):
|
||||
$(call cmd,check)
|
||||
else
|
||||
# Rules for installing headers
|
||||
|
||||
$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): $(_dst)
|
||||
|
||||
.PHONY: $(_dst)
|
||||
$(_dst):
|
||||
$(call cmd,mkdir)
|
||||
|
||||
ifdef GENASM
|
||||
$(objhdr-y) $(header-y) $(unifdef-y):
|
||||
$(call cmd,gen)
|
||||
|
||||
else
|
||||
$(objhdr-y):
|
||||
$(call cmd,o_hdr_install)
|
||||
|
||||
$(header-y):
|
||||
$(call cmd,headers_install)
|
||||
|
||||
$(unifdef-y):
|
||||
$(call cmd,unifdef)
|
||||
endif
|
||||
endif
|
||||
|
||||
hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
|
||||
|
||||
.PHONY: altarch-dir
|
||||
altarch-dir:
|
||||
$(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
|
||||
$(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm
|
||||
|
||||
# Recursion
|
||||
$(subdir-y):
|
||||
$(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
|
8
scripts/hdrcheck.sh
Executable file
8
scripts/hdrcheck.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
for FILE in `grep '^#include <' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
|
||||
if [ ! -r $1/$FILE ]; then
|
||||
echo $2 requires $FILE, which does not exist
|
||||
exit 1
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user