aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGrégoire Duchêne <greg@awhk.org>2025-12-13 12:09:46 +0000
committerGrégoire Duchêne <greg@awhk.org>2025-12-13 12:09:46 +0000
commitaa417238310ff54d6547f3f01a6a727c57bb044e (patch)
tree80e361ad0016434d337580e3a31583ff757d7456 /Makefile
parent07c6d7fc24af62a56fff0ee7c5514858ea92dc9e (diff)
Add a Makefile and a launchd agent
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6e2a5cd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+BIN = .build/$(CONFIG)
+CONFIG ?= release
+DESTDIR ?= ~/.local/bin
+LAUNCHD ?= ~/Library/LaunchAgents
+
+.PHONY: clean install install-launchd-agent
+
+caffeinate-downloads: $(BIN)/caffeinate-downloads
+ cp $< $@
+
+clean:
+ rm -f caffeinate-downloads
+ swift package clean
+
+install: $(DESTDIR) $(DESTDIR)/caffeinate-downloads
+install-launchd-agent: $(LAUNCHD)/caffeinate-downloads.plist
+
+$(BIN)/caffeinate-downloads: $(wildcard Sources/*.swift)
+ swift build --configuration $(CONFIG)
+
+$(DESTDIR):
+ install -d $@
+
+$(DESTDIR)/caffeinate-downloads: $(BIN)/caffeinate-downloads
+ install $< $@
+
+$(LAUNCHD)/caffeinate-downloads.plist: launchd-agent.json
+ DESTDIR=$(DESTDIR) plutil -convert xml1 -o $@ - <<< $$(envsubst < $<)