aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.headersinst
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-10-02 13:01:57 -0400
committerDavid Howells <dhowells@redhat.com>2012-10-02 13:01:57 -0400
commit10b63956fce7f369cc37fd4d994f09bd5203efe4 (patch)
tree4b0e607507b19a89a8c22f21d2552e66255faac5 /scripts/Makefile.headersinst
parentec28b7f250b19f31e14b69b015d61d0818bf43a0 (diff)
UAPI: Plumb the UAPI Kbuilds into the user header installation and checking
Plumb the UAPI Kbuilds into the user header installation and checking system. As the headers are split the entries will be transferred across from the old Kbuild files to the UAPI Kbuild files. The changes made in this commit are: (1) Exported generated files (of which there are currently four) are moved to uapi/ directories under the appropriate generated/ directory, thus we get: include/generated/uapi/linux/version.h arch/x86/include/generated/uapi/asm/unistd_32.h arch/x86/include/generated/uapi/asm/unistd_64.h arch/x86/include/generated/uapi/asm/unistd_x32.h These paths were added to the build as -I flags in a previous patch. (2) scripts/Makefile.headersinst is now given the UAPI path to install from rather than the old path. It then determines the old path from that and includes that Kbuild also if it exists, thus permitting the headers to exist in either directory during the changeover. I also renamed the "install" variable to "installdir" as it refers to a directory not the install program. (3) scripts/headers_install.pl is altered to take a list of source file paths instead of just their names so that the makefile can tell it exactly where to find each file. For the moment, files can be obtained from one of four places for each output directory: .../include/uapi/foo/ .../include/generated/uapi/foo/ .../include/foo/ .../include/generated/foo/ The non-UAPI paths will be dropped later. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'scripts/Makefile.headersinst')
-rw-r--r--scripts/Makefile.headersinst45
1 files changed, 31 insertions, 14 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 463b95acc15b..06ba4a70bd4d 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -8,7 +8,7 @@
8# ========================================================================== 8# ==========================================================================
9 9
10# called may set destination dir (when installing to asm/) 10# called may set destination dir (when installing to asm/)
11_dst := $(if $(dst),$(dst),$(obj)) 11_dst := $(or $(destination-y),$(dst),$(obj))
12 12
13# generated header directory 13# generated header directory
14gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) 14gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
@@ -16,47 +16,64 @@ gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
16kbuild-file := $(srctree)/$(obj)/Kbuild 16kbuild-file := $(srctree)/$(obj)/Kbuild
17include $(kbuild-file) 17include $(kbuild-file)
18 18
19_dst := $(if $(destination-y),$(destination-y),$(_dst)) 19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
20ifneq ($(wildcard $(old-kbuild-file)),)
21include $(old-kbuild-file)
22endif
20 23
21include scripts/Kbuild.include 24include scripts/Kbuild.include
22 25
23install := $(INSTALL_HDR_PATH)/$(_dst) 26installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
24 27
25header-y := $(sort $(header-y)) 28header-y := $(sort $(header-y))
26subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 29subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
27header-y := $(filter-out %/, $(header-y)) 30header-y := $(filter-out %/, $(header-y))
28 31
29# files used to track state of install/check 32# files used to track state of install/check
30install-file := $(install)/.install 33install-file := $(installdir)/.install
31check-file := $(install)/.check 34check-file := $(installdir)/.check
32 35
33# generic-y list all files an architecture uses from asm-generic 36# generic-y list all files an architecture uses from asm-generic
34# Use this to build a list of headers which require a wrapper 37# Use this to build a list of headers which require a wrapper
35wrapper-files := $(filter $(header-y), $(generic-y)) 38wrapper-files := $(filter $(header-y), $(generic-y))
36 39
40srcdir := $(srctree)/$(obj)
41gendir := $(objtree)/$(gen)
42
43oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
44
37# all headers files for this dir 45# all headers files for this dir
38header-y := $(filter-out $(generic-y), $(header-y)) 46header-y := $(filter-out $(generic-y), $(header-y))
39all-files := $(header-y) $(genhdr-y) $(wrapper-files) 47all-files := $(header-y) $(genhdr-y) $(wrapper-files)
40input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ 48output-files := $(addprefix $(installdir)/, $(all-files))
41 $(addprefix $(objtree)/$(gen)/,$(genhdr-y)) 49
42output-files := $(addprefix $(install)/, $(all-files)) 50input-files := $(foreach hdr, $(header-y), \
51 $(or \
52 $(wildcard $(srcdir)/$(hdr)), \
53 $(wildcard $(oldsrcdir)/$(hdr)), \
54 $(error Missing UAPI file $(srcdir)/$(hdr)) \
55 )) \
56 $(foreach hdr, $(genhdr-y), \
57 $(or \
58 $(wildcard $(gendir)/$(hdr)), \
59 $(error Missing generated UAPI file $(gendir)/$(hdr)) \
60 ))
43 61
44# Work out what needs to be removed 62# Work out what needs to be removed
45oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) 63oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
46unwanted := $(filter-out $(all-files),$(oldheaders)) 64unwanted := $(filter-out $(all-files),$(oldheaders))
47 65
48# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) 66# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
49unwanted-file := $(addprefix $(install)/, $(unwanted)) 67unwanted-file := $(addprefix $(installdir)/, $(unwanted))
50 68
51printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) 69printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
52 70
53quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 71quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
54 file$(if $(word 2, $(all-files)),s)) 72 file$(if $(word 2, $(all-files)),s))
55 cmd_install = \ 73 cmd_install = \
56 $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ 74 $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \
57 $(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \
58 for F in $(wrapper-files); do \ 75 for F in $(wrapper-files); do \
59 echo "\#include <asm-generic/$$F>" > $(install)/$$F; \ 76 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
60 done; \ 77 done; \
61 touch $@ 78 touch $@
62 79
@@ -67,7 +84,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
67# Headers list can be pretty long, xargs helps to avoid 84# Headers list can be pretty long, xargs helps to avoid
68# the "Argument list too long" error. 85# the "Argument list too long" error.
69 cmd_check = for f in $(all-files); do \ 86 cmd_check = for f in $(all-files); do \
70 echo "$(install)/$${f}"; done \ 87 echo "$(installdir)/$${f}"; done \
71 | xargs \ 88 | xargs \
72 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ 89 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
73 touch $@ 90 touch $@