summaryrefslogtreecommitdiff
path: root/rules.mak
diff options
context:
space:
mode:
Diffstat (limited to 'rules.mak')
-rw-r--r--rules.mak9
1 files changed, 9 insertions, 0 deletions
diff --git a/rules.mak b/rules.mak
index c843a131e8..6dac7773d5 100644
--- a/rules.mak
+++ b/rules.mak
@@ -42,6 +42,15 @@ cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi
set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
+# find-in-path
+# Usage: $(call find-in-path, prog)
+# Looks in the PATH if the argument contains no slash, else only considers one
+# specific directory. Returns an # empty string if the program doesn't exist
+# there.
+find-in-path = $(if $(find-string /, $1), \
+ $(wildcard $1), \
+ $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH)))))
+
# Generate timestamp files for .h include files
%.h: %.h-timestamp