aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.headersinst
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /scripts/Makefile.headersinst
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'scripts/Makefile.headersinst')
-rw-r--r--scripts/Makefile.headersinst52
1 files changed, 16 insertions, 36 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 06ba4a70bd4..a57f5bd5a13 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -3,77 +3,57 @@
3# 3#
4# header-y - list files to be installed. They are preprocessed 4# header-y - list files to be installed. They are preprocessed
5# to remove __KERNEL__ section of the file 5# to remove __KERNEL__ section of the file
6# genhdr-y - Same as header-y but in a generated/ directory 6# objhdr-y - Same as header-y but for generated files
7# 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 := $(or $(destination-y),$(dst),$(obj)) 11_dst := $(if $(dst),$(dst),$(obj))
12
13# generated header directory
14gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
15 12
16kbuild-file := $(srctree)/$(obj)/Kbuild 13kbuild-file := $(srctree)/$(obj)/Kbuild
17include $(kbuild-file) 14include $(kbuild-file)
18 15
19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild 16_dst := $(if $(destination-y),$(destination-y),$(_dst))
20ifneq ($(wildcard $(old-kbuild-file)),)
21include $(old-kbuild-file)
22endif
23 17
24include scripts/Kbuild.include 18include scripts/Kbuild.include
25 19
26installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) 20install := $(INSTALL_HDR_PATH)/$(_dst)
27 21
28header-y := $(sort $(header-y)) 22header-y := $(sort $(header-y))
29subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 23subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
30header-y := $(filter-out %/, $(header-y)) 24header-y := $(filter-out %/, $(header-y))
31 25
32# files used to track state of install/check 26# files used to track state of install/check
33install-file := $(installdir)/.install 27install-file := $(install)/.install
34check-file := $(installdir)/.check 28check-file := $(install)/.check
35 29
36# generic-y list all files an architecture uses from asm-generic 30# generic-y list all files an architecture uses from asm-generic
37# Use this to build a list of headers which require a wrapper 31# Use this to build a list of headers which require a wrapper
38wrapper-files := $(filter $(header-y), $(generic-y)) 32wrapper-files := $(filter $(header-y), $(generic-y))
39 33
40srcdir := $(srctree)/$(obj)
41gendir := $(objtree)/$(gen)
42
43oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
44
45# all headers files for this dir 34# all headers files for this dir
46header-y := $(filter-out $(generic-y), $(header-y)) 35header-y := $(filter-out $(generic-y), $(header-y))
47all-files := $(header-y) $(genhdr-y) $(wrapper-files) 36all-files := $(header-y) $(objhdr-y) $(wrapper-files)
48output-files := $(addprefix $(installdir)/, $(all-files)) 37input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \
49 38 $(addprefix $(objtree)/$(obj)/,$(objhdr-y))
50input-files := $(foreach hdr, $(header-y), \ 39output-files := $(addprefix $(install)/, $(all-files))
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 ))
61 40
62# Work out what needs to be removed 41# Work out what needs to be removed
63oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) 42oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h))
64unwanted := $(filter-out $(all-files),$(oldheaders)) 43unwanted := $(filter-out $(all-files),$(oldheaders))
65 44
66# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) 45# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
67unwanted-file := $(addprefix $(installdir)/, $(unwanted)) 46unwanted-file := $(addprefix $(install)/, $(unwanted))
68 47
69printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) 48printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
70 49
71quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 50quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
72 file$(if $(word 2, $(all-files)),s)) 51 file$(if $(word 2, $(all-files)),s))
73 cmd_install = \ 52 cmd_install = \
74 $(PERL) $< $(installdir) $(SRCARCH) $(input-files); \ 53 $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
54 $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
75 for F in $(wrapper-files); do \ 55 for F in $(wrapper-files); do \
76 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ 56 echo "\#include <asm-generic/$$F>" > $(install)/$$F; \
77 done; \ 57 done; \
78 touch $@ 58 touch $@
79 59
@@ -84,7 +64,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
84# Headers list can be pretty long, xargs helps to avoid 64# Headers list can be pretty long, xargs helps to avoid
85# the "Argument list too long" error. 65# the "Argument list too long" error.
86 cmd_check = for f in $(all-files); do \ 66 cmd_check = for f in $(all-files); do \
87 echo "$(installdir)/$${f}"; done \ 67 echo "$(install)/$${f}"; done \
88 | xargs \ 68 | xargs \
89 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ 69 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
90 touch $@ 70 touch $@