diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-10 23:45:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-10 23:45:36 -0400 |
| commit | 791a9a666d1afe2603bcb2c6a4852d684e879252 (patch) | |
| tree | 5ebffa701b75c843fb10455b1e776e5df798d715 /scripts | |
| parent | 23ea3f62f3f90caaa7b4bf32690c341101228cca (diff) | |
| parent | 3e18c637fa3e2f6836a4034c80ca0a86be968efc (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.headersinst | 68 |
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 |
| 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 $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj))) | 19 | _dst := $(if $(dst),$(dst),$(obj)) |
| 18 | 20 | ||
| 19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild | 21 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild |
| 20 | ifneq ($(wildcard $(old-kbuild-file)),) | 22 | ifneq ($(wildcard $(old-kbuild-file)),) |
| @@ -25,9 +27,14 @@ 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 | header-files := $(notdir $(wildcard $(srcdir)/*.h)) | ||
| 34 | header-files += $(notdir $(wildcard $(srcdir)/*.agh)) | ||
| 35 | header-files := $(filter-out $(no-export-headers), $(header-files)) | ||
| 36 | genhdr-files := $(notdir $(wildcard $(gendir)/*.h)) | ||
| 37 | genhdr-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 |
| 33 | install-file := $(installdir)/.install | 40 | install-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 |
| 38 | wrapper-files := $(filter $(header-y), $(generic-y)) | 45 | generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h)) |
| 39 | 46 | wrapper-files := $(filter $(generic-files), $(generic-y)) | |
| 40 | srcdir := $(srctree)/$(obj) | 47 | wrapper-files := $(filter-out $(header-files), $(wrapper-files)) |
| 41 | gendir := $(objtree)/$(gen) | ||
| 42 | |||
| 43 | oldsrcdir := $(srctree)/$(subst /uapi,,$(obj)) | ||
| 44 | 48 | ||
| 45 | # all headers files for this dir | 49 | # all headers files for this dir |
| 46 | header-y := $(filter-out $(generic-y), $(header-y)) | 50 | all-files := $(header-files) $(genhdr-files) $(wrapper-files) |
| 47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) | ||
| 48 | output-files := $(addprefix $(installdir)/, $(all-files)) | 51 | output-files := $(addprefix $(installdir)/, $(all-files)) |
| 49 | 52 | ||
| 50 | input-files1 := $(foreach hdr, $(header-y), \ | 53 | ifneq ($(mandatory-y),) |
| 51 | $(if $(wildcard $(srcdir)/$(hdr)), \ | 54 | missing := $(filter-out $(all-files),$(mandatory-y)) |
| 52 | $(wildcard $(srcdir)/$(hdr))) \ | 55 | ifneq ($(missing),) |
| 53 | ) | 56 | $(error Some mandatory headers ($(missing)) are missing in $(obj)) |
| 54 | input-files1-name := $(notdir $(input-files1)) | 57 | endif |
| 55 | input-files2 := $(foreach hdr, $(header-y), \ | 58 | endif |
| 56 | $(if $(wildcard $(srcdir)/$(hdr)),, \ | ||
| 57 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ | ||
| 58 | $(wildcard $(oldsrcdir)/$(hdr)), \ | ||
| 59 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ | ||
| 60 | )) | ||
| 61 | input-files2-name := $(notdir $(input-files2)) | ||
| 62 | input-files3 := $(foreach hdr, $(genhdr-y), \ | ||
| 63 | $(if $(wildcard $(gendir)/$(hdr)), \ | ||
| 64 | $(wildcard $(gendir)/$(hdr)), \ | ||
| 65 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ | ||
| 66 | )) | ||
| 67 | input-files3-name := $(notdir $(input-files3)) | ||
| 68 | 59 | ||
| 69 | # Work out what needs to be removed | 60 | # Work out what needs to be removed |
| 70 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | 61 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) |
| @@ -78,9 +69,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | |||
| 78 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 69 | quiet_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 | ||
| 108 | targets += $(install-file) | 98 | targets += $(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) |
