From 52b7080796355a01bde723af9944a61c40866dc4 Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Thu, 17 Aug 2017 22:23:22 +0200 Subject: [PATCH] vendor: Add project pathmap defs Change-Id: I5357eadcf6efe6ddbd6686ed69db0d59114e0a5d --- build/core/pathmap.mk | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 build/core/pathmap.mk diff --git a/build/core/pathmap.mk b/build/core/pathmap.mk new file mode 100644 index 00000000..39a2b062 --- /dev/null +++ b/build/core/pathmap.mk @@ -0,0 +1,40 @@ +# +# Returns the path to the requested module's include directory, +# relative to the root of the source tree. Does not handle external +# modules. +# +# $(1): a list of modules (or other named entities) to find the includes for +# +define include-path-for +$(foreach n,$(1),$(patsubst $(n):%,%,$(filter $(n):%,$(pathmap_INCL)))) +endef + +# Enter project path into pathmap +# +# $(1): name +# $(2): path +# +define project-set-path +$(eval pathmap_PROJ += $(1):$(2)) +endef + +# Enter variant project path into pathmap +# +# $(1): name +# $(2): variable to check +# $(3): base path +# +define project-set-path-variant + $(call project-set-path,$(1),$(strip \ + $(if $($(2)), \ + $(3)-$($(2)), \ + $(3)))) +endef + +# Returns the path to the requested module's include directory, +# relative to the root of the source tree. +# +# $(1): a list of modules (or other named entities) to find the projects for +define project-path-for +$(foreach n,$(1),$(patsubst $(n):%,%,$(filter $(n):%,$(pathmap_PROJ)))) +endef