aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 6e2a5cd332af54f6511bcf2853ed3a72dc902050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 < $<)