mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-08 02:21:18 +00:00
fcc8487d47
Regularly, when a new header is created in include/uapi/, the developer forgets to add it in the corresponding Kbuild file. This error is usually detected after the release is out. In fact, all headers under uapi directories should be exported, thus it's useless to have an exhaustive list. After this patch, the following files, which were not exported, are now exported (with make headers_install_all): asm-arc/kvm_para.h asm-arc/ucontext.h asm-blackfin/shmparam.h asm-blackfin/ucontext.h asm-c6x/shmparam.h asm-c6x/ucontext.h asm-cris/kvm_para.h asm-h8300/shmparam.h asm-h8300/ucontext.h asm-hexagon/shmparam.h asm-m32r/kvm_para.h asm-m68k/kvm_para.h asm-m68k/shmparam.h asm-metag/kvm_para.h asm-metag/shmparam.h asm-metag/ucontext.h asm-mips/hwcap.h asm-mips/reg.h asm-mips/ucontext.h asm-nios2/kvm_para.h asm-nios2/ucontext.h asm-openrisc/shmparam.h asm-parisc/kvm_para.h asm-powerpc/perf_regs.h asm-sh/kvm_para.h asm-sh/ucontext.h asm-tile/shmparam.h asm-unicore32/shmparam.h asm-unicore32/ucontext.h asm-x86/hwcap2.h asm-xtensa/kvm_para.h drm/armada_drm.h drm/etnaviv_drm.h drm/vgem_drm.h linux/aspeed-lpc-ctrl.h linux/auto_dev-ioctl.h linux/bcache.h linux/btrfs_tree.h linux/can/vxcan.h linux/cifs/cifs_mount.h linux/coresight-stm.h linux/cryptouser.h linux/fsmap.h linux/genwqe/genwqe_card.h linux/hash_info.h linux/kcm.h linux/kcov.h linux/kfd_ioctl.h linux/lightnvm.h linux/module.h linux/nbd-netlink.h linux/nilfs2_api.h linux/nilfs2_ondisk.h linux/nsfs.h linux/pr.h linux/qrtr.h linux/rpmsg.h linux/sched/types.h linux/sed-opal.h linux/smc.h linux/smc_diag.h linux/stm.h linux/switchtec_ioctl.h linux/vfio_ccw.h linux/wil6210_uapi.h rdma/bnxt_re-abi.h Note that I have removed from this list the files which are generated in every exported directories (like .install or .install.cmd). Thanks to Julien Floret <julien.floret@6wind.com> for the tip to get all subdirs with a pure makefile command. For the record, note that exported files for asm directories are a mix of files listed by: - include/uapi/asm-generic/Kbuild.asm; - arch/<arch>/include/uapi/asm/Kbuild; - arch/<arch>/include/asm/Kbuild. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Acked-by: Mark Salter <msalter@redhat.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
133 lines
4.4 KiB
Makefile
133 lines
4.4 KiB
Makefile
# ==========================================================================
|
|
# Installing headers
|
|
#
|
|
# All headers under include/uapi, include/generated/uapi,
|
|
# arch/<arch>/include/uapi/asm and arch/<arch>/include/generated/uapi/asm are
|
|
# exported.
|
|
# They are preprocessed to remove __KERNEL__ section of the file.
|
|
#
|
|
# ==========================================================================
|
|
|
|
# generated header directory
|
|
gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
|
|
|
|
# Kbuild file is optional
|
|
kbuild-file := $(srctree)/$(obj)/Kbuild
|
|
-include $(kbuild-file)
|
|
|
|
# called may set destination dir (when installing to asm/)
|
|
_dst := $(if $(dst),$(dst),$(obj))
|
|
|
|
old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
|
|
ifneq ($(wildcard $(old-kbuild-file)),)
|
|
include $(old-kbuild-file)
|
|
endif
|
|
|
|
include scripts/Kbuild.include
|
|
|
|
installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
|
|
|
|
srcdir := $(srctree)/$(obj)
|
|
gendir := $(objtree)/$(gen)
|
|
subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
|
|
subdirs += $(subdir-y)
|
|
header-files := $(notdir $(wildcard $(srcdir)/*.h))
|
|
header-files += $(notdir $(wildcard $(srcdir)/*.agh))
|
|
header-files := $(filter-out $(no-export-headers), $(header-files))
|
|
genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
|
|
genhdr-files := $(filter-out $(header-files), $(genhdr-files))
|
|
|
|
# files used to track state of install/check
|
|
install-file := $(installdir)/.install
|
|
check-file := $(installdir)/.check
|
|
|
|
# generic-y list all files an architecture uses from asm-generic
|
|
# Use this to build a list of headers which require a wrapper
|
|
generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h))
|
|
wrapper-files := $(filter $(generic-files), $(generic-y))
|
|
wrapper-files := $(filter-out $(header-files), $(wrapper-files))
|
|
|
|
# all headers files for this dir
|
|
all-files := $(header-files) $(genhdr-files) $(wrapper-files)
|
|
output-files := $(addprefix $(installdir)/, $(all-files))
|
|
|
|
ifneq ($(mandatory-y),)
|
|
missing := $(filter-out $(all-files),$(mandatory-y))
|
|
ifneq ($(missing),)
|
|
$(error Some mandatory headers ($(missing)) are missing in $(obj))
|
|
endif
|
|
endif
|
|
|
|
# Work out what needs to be removed
|
|
oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
|
|
unwanted := $(filter-out $(all-files),$(oldheaders))
|
|
|
|
# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
|
|
unwanted-file := $(addprefix $(installdir)/, $(unwanted))
|
|
|
|
printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
|
|
|
|
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
|
|
file$(if $(word 2, $(all-files)),s))
|
|
cmd_install = \
|
|
$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
|
|
$(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
|
|
for F in $(wrapper-files); do \
|
|
echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
|
|
done; \
|
|
touch $@
|
|
|
|
quiet_cmd_remove = REMOVE $(unwanted)
|
|
cmd_remove = rm -f $(unwanted-file)
|
|
|
|
quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
|
|
# Headers list can be pretty long, xargs helps to avoid
|
|
# the "Argument list too long" error.
|
|
cmd_check = for f in $(all-files); do \
|
|
echo "$(installdir)/$${f}"; done \
|
|
| xargs \
|
|
$(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
|
|
touch $@
|
|
|
|
PHONY += __headersinst __headerscheck
|
|
|
|
ifndef HDRCHECK
|
|
# Rules for installing headers
|
|
__headersinst: $(subdirs) $(install-file)
|
|
@:
|
|
|
|
targets += $(install-file)
|
|
$(install-file): scripts/headers_install.sh \
|
|
$(addprefix $(srcdir)/,$(header-files)) \
|
|
$(addprefix $(gendir)/,$(genhdr-files)) FORCE
|
|
$(if $(unwanted),$(call cmd,remove),)
|
|
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
|
|
$(call if_changed,install)
|
|
|
|
else
|
|
__headerscheck: $(subdirs) $(check-file)
|
|
@:
|
|
|
|
targets += $(check-file)
|
|
$(check-file): scripts/headers_check.pl $(output-files) FORCE
|
|
$(call if_changed,check)
|
|
|
|
endif
|
|
|
|
# Recursion
|
|
.PHONY: $(subdirs)
|
|
$(subdirs):
|
|
$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
|
|
|
|
targets := $(wildcard $(sort $(targets)))
|
|
cmd_files := $(wildcard \
|
|
$(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
|
|
ifneq ($(cmd_files),)
|
|
include $(cmd_files)
|
|
endif
|
|
|
|
.PHONY: $(PHONY)
|
|
PHONY += FORCE
|
|
FORCE: ;
|