summaryrefslogtreecommitdiffstats
path: root/kernel/scripts/Makefile.headersinst
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/scripts/Makefile.headersinst
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/scripts/Makefile.headersinst')
-rw-r--r--kernel/scripts/Makefile.headersinst139
1 files changed, 139 insertions, 0 deletions
diff --git a/kernel/scripts/Makefile.headersinst b/kernel/scripts/Makefile.headersinst
new file mode 100644
index 000000000..1106d6ca3
--- /dev/null
+++ b/kernel/scripts/Makefile.headersinst
@@ -0,0 +1,139 @@
+# ==========================================================================
+# Installing headers
+#
+# header-y - list files to be installed. They are preprocessed
+# to remove __KERNEL__ section of the file
+# genhdr-y - Same as header-y but in a generated/ directory
+#
+# ==========================================================================
+
+# generated header directory
+gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
+
+kbuild-file := $(srctree)/$(obj)/Kbuild
+include $(kbuild-file)
+
+# called may set destination dir (when installing to asm/)
+_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+
+old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
+ifneq ($(wildcard $(old-kbuild-file)),)
+include $(old-kbuild-file)
+endif
+
+include scripts/Kbuild.include
+
+installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
+
+header-y := $(sort $(header-y))
+subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
+header-y := $(filter-out %/, $(header-y))
+
+# files used to track state of install/check
+install-file := $(installdir)/.install
+check-file := $(installdir)/.check
+
+# generic-y list all files an architecture uses from asm-generic
+# Use this to build a list of headers which require a wrapper
+wrapper-files := $(filter $(header-y), $(generic-y))
+
+srcdir := $(srctree)/$(obj)
+gendir := $(objtree)/$(gen)
+
+oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
+
+# all headers files for this dir
+header-y := $(filter-out $(generic-y), $(header-y))
+all-files := $(header-y) $(genhdr-y) $(wrapper-files)
+output-files := $(addprefix $(installdir)/, $(all-files))
+
+input-files1 := $(foreach hdr, $(header-y), \
+ $(if $(wildcard $(srcdir)/$(hdr)), \
+ $(wildcard $(srcdir)/$(hdr))) \
+ )
+input-files1-name := $(notdir $(input-files1))
+input-files2 := $(foreach hdr, $(header-y), \
+ $(if $(wildcard $(srcdir)/$(hdr)),, \
+ $(if $(wildcard $(oldsrcdir)/$(hdr)), \
+ $(wildcard $(oldsrcdir)/$(hdr)), \
+ $(error Missing UAPI file $(srcdir)/$(hdr))) \
+ ))
+input-files2-name := $(notdir $(input-files2))
+input-files3 := $(foreach hdr, $(genhdr-y), \
+ $(if $(wildcard $(gendir)/$(hdr)), \
+ $(wildcard $(gendir)/$(hdr)), \
+ $(error Missing generated UAPI file $(gendir)/$(hdr)) \
+ ))
+input-files3-name := $(notdir $(input-files3))
+
+# Work out what needs to be removed
+oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
+unwanted := $(filter-out $(all-files),$(oldheaders))
+
+# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
+unwanted-file := $(addprefix $(installdir)/, $(unwanted))
+
+printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
+
+quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
+ file$(if $(word 2, $(all-files)),s))
+ cmd_install = \
+ $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
+ $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
+ $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+ for F in $(wrapper-files); do \
+ echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
+ done; \
+ touch $@
+
+quiet_cmd_remove = REMOVE $(unwanted)
+ cmd_remove = rm -f $(unwanted-file)
+
+quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
+# Headers list can be pretty long, xargs helps to avoid
+# the "Argument list too long" error.
+ cmd_check = for f in $(all-files); do \
+ echo "$(installdir)/$${f}"; done \
+ | xargs \
+ $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
+ touch $@
+
+PHONY += __headersinst __headerscheck
+
+ifndef HDRCHECK
+# Rules for installing headers
+__headersinst: $(subdirs) $(install-file)
+ @:
+
+targets += $(install-file)
+$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
+ $(if $(unwanted),$(call cmd,remove),)
+ $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
+ $(call if_changed,install)
+
+else
+__headerscheck: $(subdirs) $(check-file)
+ @:
+
+targets += $(check-file)
+$(check-file): scripts/headers_check.pl $(output-files) FORCE
+ $(call if_changed,check)
+
+endif
+
+# Recursion
+.PHONY: $(subdirs)
+$(subdirs):
+ $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
+
+targets := $(wildcard $(sort $(targets)))
+cmd_files := $(wildcard \
+ $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+
+ifneq ($(cmd_files),)
+ include $(cmd_files)
+endif
+
+.PHONY: $(PHONY)
+PHONY += FORCE
+FORCE: ;