diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-10-08 18:14:09 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-10-09 08:47:13 +0200 |
commit | e357567f4301def83b00e46ed798c7fb9e581b99 (patch) | |
tree | 80836a8fbd42679600adb9cdcd048fd88438a636 | |
parent | feaa92e37dce4eb1d06ac399e6efad1b36bd3bfb (diff) | |
download | ptxdist-e357567f4301def83b00e46ed798c7fb9e581b99.tar.gz ptxdist-e357567f4301def83b00e46ed798c7fb9e581b99.tar.xz |
ptx/in-platformconfigdir: rewrite in make
This is a lot faster than starting a shell.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | rules/pre/get_alternative.make | 15 | ||||
-rw-r--r-- | scripts/libptxdist.sh | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/rules/pre/get_alternative.make b/rules/pre/get_alternative.make index c93499162..1ac538cd0 100644 --- a/rules/pre/get_alternative.make +++ b/rules/pre/get_alternative.make @@ -31,6 +31,19 @@ define ptx/in-path $(call ptx/in-path2,$(1),$(2),$(subst :,$(ptx/def/space),$($(strip $(1))))) endef -ptx/in-platformconfigdir = $(if $(strip $(1)),$(shell ptxd_in_platformconfigdir $(1))) +# +# This must produce the same results as ptxd_in_platformconfigdir() +# +# Strip whitespaces introduced by the multiline macro +define ptx/in-platformconfigdir2 +$(or $(strip $(1)),$(or $(strip $(2)),$(strip $(3)))) +endef +# absolute path / first existing path / path in PTXDIST_PLATFORMCONFIGDIR +define ptx/in-platformconfigdir +$(call ptx/in-platformconfigdir2, +$(filter /%,$(strip $(1))), +$(call ptx/in-path,PTXDIST_PATH_PLATFORMCONFIGDIR,$(1)), +$(PTXDIST_PLATFORMCONFIGDIR)/$(strip $(1))) +endef # vim: syntax=make diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index c8f652fa9..65c1234e3 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -422,6 +422,9 @@ export -f ptxd_in_path # # ptxd_in_platformconfigdir - find paths in platformconfigdir # +# Note: the make implemenation in ptx/in-platformconfigdir must produce the +# same result. +# # $1 filename to find # # If the filename is absolute then return the filename unchanged. |