about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexey Yerin <yyp@disroot.org>2025-02-22 23:38:59 +0300
committerAlexey Yerin <yyp@disroot.org>2025-02-22 23:38:59 +0300
commitd1d8d1ae4b82190183e70622c4d7471e55ae28b5 (patch)
tree25447a3162c2aaeaceeead8a2b0cfbe09df7c571
parent27daf656c320c96f0b57f3e3404f2ac94cd85216 (diff)
Use hare version -vv to get the value of HAREPATH
-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: