Minor modifications to back service files
[moggers87-useful.git] / Makefile
blobac89627679fdb8cae3b881ca802d1cd0bd5854fa
1 scripts = $(shell find . -maxdepth 1 -name \*.sh -type f)
2 templates = $(shell find templates -maxdepth 1 -type f -printf "%f\n")
3 units = $(shell find -maxdepth 1 -name \*.service -or -name \*.timer)
4 export prefix ?= /usr/local
6 define TEMPLATE_RULE
7 $(1): $(2)
8 cat $(2) | envsubst > $(1)
9 endef
11 .PHONY: all
12 all: $(templates)
14 .PHONY: clean
15 clean:
16 rm $(templates)
18 .PHONY: install
19 install: $(scripts) $(units)
20 install -D -t $(prefix)/bin $(scripts)
21 install -D -t $(prefix)/lib/systemd/system $(units)
22 install -D -t $(prefix)/lib/systemd/user $(units)
25 $(foreach _tmpl,$(templates),$(eval $(call TEMPLATE_RULE,$(_tmpl),templates/$(_tmpl))))