diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2017-03-27 08:20:15 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-05-10 11:21:54 -0400 |
commit | fcc8487d477a3452a1d0ccbdd4c5e0e1e3cb8bed (patch) | |
tree | 74079c37b73d6be983b3c5767babc880c103dadf /scripts | |
parent | ea6819e1f2d6c30624ea067f4b3a50a3cca79d8a (diff) |
uapi: export all headers under uapi directories
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>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.headersinst | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index ca5d439c9abf..20be1fbc19cc 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -1,17 +1,19 @@ | |||
1 | # ========================================================================== | 1 | # ========================================================================== |
2 | # Installing headers | 2 | # Installing headers |
3 | # | 3 | # |
4 | # header-y - list files to be installed. They are preprocessed | 4 | # All headers under include/uapi, include/generated/uapi, |
5 | # to remove __KERNEL__ section of the file | 5 | # arch/<arch>/include/uapi/asm and arch/<arch>/include/generated/uapi/asm are |
6 | # genhdr-y - Same as header-y but in a generated/ directory | 6 | # exported. |
7 | # They are preprocessed to remove __KERNEL__ section of the file. | ||
7 | # | 8 | # |
8 | # ========================================================================== | 9 | # ========================================================================== |
9 | 10 | ||
10 | # generated header directory | 11 | # generated header directory |
11 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) | 12 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) |
12 | 13 | ||
14 | # Kbuild file is optional | ||
13 | kbuild-file := $(srctree)/$(obj)/Kbuild | 15 | kbuild-file := $(srctree)/$(obj)/Kbuild |
14 | include $(kbuild-file) | 16 | -include $(kbuild-file) |
15 | 17 | ||
16 | # called may set destination dir (when installing to asm/) | 18 | # called may set destination dir (when installing to asm/) |
17 | _dst := $(if $(dst),$(dst),$(obj)) | 19 | _dst := $(if $(dst),$(dst),$(obj)) |
@@ -25,9 +27,15 @@ include scripts/Kbuild.include | |||
25 | 27 | ||
26 | installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) | 28 | installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) |
27 | 29 | ||
28 | header-y := $(sort $(header-y)) | 30 | srcdir := $(srctree)/$(obj) |
29 | subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) | 31 | gendir := $(objtree)/$(gen) |
30 | header-y := $(filter-out %/, $(header-y)) | 32 | subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.)) |
33 | subdirs += $(subdir-y) | ||
34 | header-files := $(notdir $(wildcard $(srcdir)/*.h)) | ||
35 | header-files += $(notdir $(wildcard $(srcdir)/*.agh)) | ||
36 | header-files := $(filter-out $(no-export-headers), $(header-files)) | ||
37 | genhdr-files := $(notdir $(wildcard $(gendir)/*.h)) | ||
38 | genhdr-files := $(filter-out $(header-files), $(genhdr-files)) | ||
31 | 39 | ||
32 | # files used to track state of install/check | 40 | # files used to track state of install/check |
33 | install-file := $(installdir)/.install | 41 | install-file := $(installdir)/.install |
@@ -35,25 +43,20 @@ check-file := $(installdir)/.check | |||
35 | 43 | ||
36 | # generic-y list all files an architecture uses from asm-generic | 44 | # generic-y list all files an architecture uses from asm-generic |
37 | # Use this to build a list of headers which require a wrapper | 45 | # Use this to build a list of headers which require a wrapper |
38 | wrapper-files := $(filter $(header-y), $(generic-y)) | 46 | generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h)) |
39 | 47 | wrapper-files := $(filter $(generic-files), $(generic-y)) | |
40 | srcdir := $(srctree)/$(obj) | 48 | wrapper-files := $(filter-out $(header-files), $(wrapper-files)) |
41 | gendir := $(objtree)/$(gen) | ||
42 | 49 | ||
43 | # all headers files for this dir | 50 | # all headers files for this dir |
44 | header-y := $(filter-out $(generic-y), $(header-y)) | 51 | all-files := $(header-files) $(genhdr-files) $(wrapper-files) |
45 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) | ||
46 | output-files := $(addprefix $(installdir)/, $(all-files)) | 52 | output-files := $(addprefix $(installdir)/, $(all-files)) |
47 | 53 | ||
48 | # Check that all expected files exist | 54 | ifneq ($(mandatory-y),) |
49 | $(foreach hdr, $(header-y), \ | 55 | missing := $(filter-out $(all-files),$(mandatory-y)) |
50 | $(if $(wildcard $(srcdir)/$(hdr)),, \ | 56 | ifneq ($(missing),) |
51 | $(error Missing UAPI file $(srcdir)/$(hdr)) \ | 57 | $(error Some mandatory headers ($(missing)) are missing in $(obj)) |
52 | )) | 58 | endif |
53 | $(foreach hdr, $(genhdr-y), \ | 59 | endif |
54 | $(if $(wildcard $(gendir)/$(hdr)),, \ | ||
55 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ | ||
56 | )) | ||
57 | 60 | ||
58 | # Work out what needs to be removed | 61 | # Work out what needs to be removed |
59 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | 62 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) |
@@ -67,8 +70,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | |||
67 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 70 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ |
68 | file$(if $(word 2, $(all-files)),s)) | 71 | file$(if $(word 2, $(all-files)),s)) |
69 | cmd_install = \ | 72 | cmd_install = \ |
70 | $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-y); \ | 73 | $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \ |
71 | $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-y); \ | 74 | $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \ |
72 | for F in $(wrapper-files); do \ | 75 | for F in $(wrapper-files); do \ |
73 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ | 76 | echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ |
74 | done; \ | 77 | done; \ |
@@ -95,8 +98,8 @@ __headersinst: $(subdirs) $(install-file) | |||
95 | 98 | ||
96 | targets += $(install-file) | 99 | targets += $(install-file) |
97 | $(install-file): scripts/headers_install.sh \ | 100 | $(install-file): scripts/headers_install.sh \ |
98 | $(addprefix $(srcdir)/,$(header-y)) \ | 101 | $(addprefix $(srcdir)/,$(header-files)) \ |
99 | $(addprefix $(gendir)/,$(genhdr-y)) FORCE | 102 | $(addprefix $(gendir)/,$(genhdr-files)) FORCE |
100 | $(if $(unwanted),$(call cmd,remove),) | 103 | $(if $(unwanted),$(call cmd,remove),) |
101 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) | 104 | $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) |
102 | $(call if_changed,install) | 105 | $(call if_changed,install) |