aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2022-03-17 14:32:13 +0000
committerAdam Spragg <adam@spra.gg>2022-03-17 14:32:13 +0000
commit9d2e75bcfade4accd67685440b832e7143cbedda (patch)
tree05ed8c66439db1d9e544a43b4f0c33eaff51e07e
parentbdf37b08ad0dfc36a8af9bb3160ae6b492802b30 (diff)
Remember the value of PREFIX between runs
So when you do `make PREFIX=/usr` and then `make install`, it installs to `/usr`.
-rw-r--r--.gitignore1
-rw-r--r--makefile8
2 files changed, 8 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..366ad13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+prefix.mk
diff --git a/makefile b/makefile
index b128988..c8ff8f2 100644
--- a/makefile
+++ b/makefile
@@ -1,5 +1,7 @@
PREFIX=/usr/local
+include prefix.mk
+
SBINDIR=$(PREFIX)/sbin
SED_SHELL:=
@@ -10,7 +12,7 @@ SED_SYSD+=s:^ExecStart=.*/\([^/]\+\)$$:ExecStart=$(SBINDIR)/\1:;
.PHONY: all
-all:
+all: prefix.mk
sed -i -e '$(SED_SHELL)' adu-download
sed -i -e '$(SED_SHELL)' adu-upgrade
sed -i -e '$(SED_SYSD)' adu-download.service
@@ -51,3 +53,7 @@ uninstall:
rm -f '$(SBINDIR)/adu-download'
systemctl daemon-reload
+
+.PHONY: prefix.mk
+prefix.mk:
+ @echo 'PREFIX=$(PREFIX)' >$@