diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
| commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
| tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /scripts/Makefile.headersinst | |
| parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) | |
Patched in Tegra support.
Diffstat (limited to 'scripts/Makefile.headersinst')
| -rw-r--r-- | scripts/Makefile.headersinst | 52 |
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 | ||
| 14 | gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj))) | ||
| 15 | 12 | ||
| 16 | kbuild-file := $(srctree)/$(obj)/Kbuild | 13 | kbuild-file := $(srctree)/$(obj)/Kbuild |
| 17 | include $(kbuild-file) | 14 | include $(kbuild-file) |
| 18 | 15 | ||
| 19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild | 16 | _dst := $(if $(destination-y),$(destination-y),$(_dst)) |
| 20 | ifneq ($(wildcard $(old-kbuild-file)),) | ||
| 21 | include $(old-kbuild-file) | ||
| 22 | endif | ||
| 23 | 17 | ||
| 24 | include scripts/Kbuild.include | 18 | include scripts/Kbuild.include |
| 25 | 19 | ||
| 26 | installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst)) | 20 | install := $(INSTALL_HDR_PATH)/$(_dst) |
| 27 | 21 | ||
| 28 | header-y := $(sort $(header-y)) | 22 | header-y := $(sort $(header-y)) |
| 29 | subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) | 23 | subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) |
| 30 | header-y := $(filter-out %/, $(header-y)) | 24 | header-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 |
| 33 | install-file := $(installdir)/.install | 27 | install-file := $(install)/.install |
| 34 | check-file := $(installdir)/.check | 28 | check-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 |
| 38 | wrapper-files := $(filter $(header-y), $(generic-y)) | 32 | wrapper-files := $(filter $(header-y), $(generic-y)) |
| 39 | 33 | ||
| 40 | srcdir := $(srctree)/$(obj) | ||
| 41 | gendir := $(objtree)/$(gen) | ||
| 42 | |||
| 43 | oldsrcdir := $(srctree)/$(subst /uapi,,$(obj)) | ||
| 44 | |||
| 45 | # all headers files for this dir | 34 | # all headers files for this dir |
| 46 | header-y := $(filter-out $(generic-y), $(header-y)) | 35 | header-y := $(filter-out $(generic-y), $(header-y)) |
| 47 | all-files := $(header-y) $(genhdr-y) $(wrapper-files) | 36 | all-files := $(header-y) $(objhdr-y) $(wrapper-files) |
| 48 | output-files := $(addprefix $(installdir)/, $(all-files)) | 37 | input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \ |
| 49 | 38 | $(addprefix $(objtree)/$(obj)/,$(objhdr-y)) | |
| 50 | input-files := $(foreach hdr, $(header-y), \ | 39 | output-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 |
| 63 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | 42 | oldheaders := $(patsubst $(install)/%,%,$(wildcard $(install)/*.h)) |
| 64 | unwanted := $(filter-out $(all-files),$(oldheaders)) | 43 | unwanted := $(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) |
| 67 | unwanted-file := $(addprefix $(installdir)/, $(unwanted)) | 46 | unwanted-file := $(addprefix $(install)/, $(unwanted)) |
| 68 | 47 | ||
| 69 | printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | 48 | printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) |
| 70 | 49 | ||
| 71 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 50 | quiet_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 $@ |
