about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile13
1 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 1a56721..9b658bb 100644
--- a/Makefile
+++ b/Makefile
@@ -41,14 +41,21 @@ uninstall4:
 		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
-HAREPATH_CMD = hare version -v | awk 'harepath { gsub(/^\t/, ""); print }; /^HAREPATH/ { harepath = 1 }' | tr '\n' ':'
+HAREPATH_ENV_CMD = hare version -vv | grep '^HAREPATH'
+
+# hare version -vv returns the value of HAREPATH in form
+# HAREPATH=<possibly shell-quoted string>
+#
+# Using eval on that line will set the HAREPATH variable in the environment to
+# the unquoted value, which makes it easy to add the bindings directory to the
+# path
 
 demo:
-	env HAREPATH="$(BINDINGS_DIR):$$($(HAREPATH_CMD))" \
+	eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \
 		hare build $$(pkg-config --libs-only-l gtk+-3.0) -o demo cmd/demo
 
 demo4:
-	env HAREPATH="$(BINDINGS_DIR):$$($(HAREPATH_CMD))" \
+	eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \
 		hare build $$(pkg-config --libs-only-l gtk4) -o demo4 cmd/demo4
 
 clean: