aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-10 23:45:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-10 23:45:36 -0400
commit791a9a666d1afe2603bcb2c6a4852d684e879252 (patch)
tree5ebffa701b75c843fb10455b1e776e5df798d715 /scripts
parent23ea3f62f3f90caaa7b4bf32690c341101228cca (diff)
parent3e18c637fa3e2f6836a4034c80ca0a86be968efc (diff)
Merge tag 'kbuild-uapi-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild UAPI updates from Masahiro Yamada: "Improvement of headers_install by Nicolas Dichtel. It has been long since the introduction of uapi directories, but the de-coupling of exported headers has not been completed. Headers listed in header-y are exported whether they exist in uapi directories or not. His work fixes this inconsistency. All (and only) headers under uapi directories are now exported. The asm-generic wrappers are still exceptions, but this is a big step forward" * tag 'kbuild-uapi-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: arch/include: remove empty Kbuild files uapi: export all arch specifics directories uapi: export all headers under uapi directories smc_diag.h: fix include from userland btrfs_tree.h: fix include from userland uapi: includes linux/types.h before exporting files Makefile.headersinst: remove destination-y option Makefile.headersinst: cleanup input files x86: stop exporting msr-index.h to userland nios2: put setup.h in uapi h8300: put bitsperlong.h in uapi
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst68
1 files changed, 30 insertions, 38 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6ca3a38..6ba97a1f9c5a 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -1,20 +1,22 @@
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 and arch/<arch>/include/generated/uapi 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
11gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) 12gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
12 13
14# Kbuild file is optional
13kbuild-file := $(srctree)/$(obj)/Kbuild 15kbuild-file := $(srctree)/$(obj)/Kbuild
14include $(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 $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj))) 19_dst := $(if $(dst),$(dst),$(obj))
18 20
19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild 21old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
20ifneq ($(wildcard $(old-kbuild-file)),) 22ifneq ($(wildcard $(old-kbuild-file)),)
@@ -25,9 +27,14 @@ include scripts/Kbuild.include
25 27
26installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) 28installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
27 29
28header-y := $(sort $(header-y)) 30srcdir := $(srctree)/$(obj)
29subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 31gendir := $(objtree)/$(gen)
30header-y := $(filter-out %/, $(header-y)) 32subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
33header-files := $(notdir $(wildcard $(srcdir)/*.h))
34header-files += $(notdir $(wildcard $(srcdir)/*.agh))
35header-files := $(filter-out $(no-export-headers), $(header-files))
36genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
37genhdr-files := $(filter-out $(header-files), $(genhdr-files))
31 38
32# files used to track state of install/check 39# files used to track state of install/check
33install-file := $(installdir)/.install 40install-file := $(installdir)/.install
@@ -35,36 +42,20 @@ check-file := $(installdir)/.check
35 42
36# generic-y list all files an architecture uses from asm-generic 43# generic-y list all files an architecture uses from asm-generic
37# Use this to build a list of headers which require a wrapper 44# Use this to build a list of headers which require a wrapper
38wrapper-files := $(filter $(header-y), $(generic-y)) 45generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h))
39 46wrapper-files := $(filter $(generic-files), $(generic-y))
40srcdir := $(srctree)/$(obj) 47wrapper-files := $(filter-out $(header-files), $(wrapper-files))
41gendir := $(objtree)/$(gen)
42
43oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
44 48
45# all headers files for this dir 49# all headers files for this dir
46header-y := $(filter-out $(generic-y), $(header-y)) 50all-files := $(header-files) $(genhdr-files) $(wrapper-files)
47all-files := $(header-y) $(genhdr-y) $(wrapper-files)
48output-files := $(addprefix $(installdir)/, $(all-files)) 51output-files := $(addprefix $(installdir)/, $(all-files))
49 52
50input-files1 := $(foreach hdr, $(header-y), \ 53ifneq ($(mandatory-y),)
51 $(if $(wildcard $(srcdir)/$(hdr)), \ 54missing := $(filter-out $(all-files),$(mandatory-y))
52 $(wildcard $(srcdir)/$(hdr))) \ 55ifneq ($(missing),)
53 ) 56$(error Some mandatory headers ($(missing)) are missing in $(obj))
54input-files1-name := $(notdir $(input-files1)) 57endif
55input-files2 := $(foreach hdr, $(header-y), \ 58endif
56 $(if $(wildcard $(srcdir)/$(hdr)),, \
57 $(if $(wildcard $(oldsrcdir)/$(hdr)), \
58 $(wildcard $(oldsrcdir)/$(hdr)), \
59 $(error Missing UAPI file $(srcdir)/$(hdr))) \
60 ))
61input-files2-name := $(notdir $(input-files2))
62input-files3 := $(foreach hdr, $(genhdr-y), \
63 $(if $(wildcard $(gendir)/$(hdr)), \
64 $(wildcard $(gendir)/$(hdr)), \
65 $(error Missing generated UAPI file $(gendir)/$(hdr)) \
66 ))
67input-files3-name := $(notdir $(input-files3))
68 59
69# Work out what needs to be removed 60# Work out what needs to be removed
70oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) 61oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +69,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
78quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 69quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
79 file$(if $(word 2, $(all-files)),s)) 70 file$(if $(word 2, $(all-files)),s))
80 cmd_install = \ 71 cmd_install = \
81 $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \ 72 $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
82 $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \ 73 $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
83 $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
84 for F in $(wrapper-files); do \ 74 for F in $(wrapper-files); do \
85 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ 75 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
86 done; \ 76 done; \
@@ -106,7 +96,9 @@ __headersinst: $(subdirs) $(install-file)
106 @: 96 @:
107 97
108targets += $(install-file) 98targets += $(install-file)
109$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE 99$(install-file): scripts/headers_install.sh \
100 $(addprefix $(srcdir)/,$(header-files)) \
101 $(addprefix $(gendir)/,$(genhdr-files)) FORCE
110 $(if $(unwanted),$(call cmd,remove),) 102 $(if $(unwanted),$(call cmd,remove),)
111 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) 103 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
112 $(call if_changed,install) 104 $(call if_changed,install)