diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c876ade --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,22 @@ | |||
1 | UNIT = suspend-below-battery-capacity | ||
2 | BINDIR = /usr/local/bin | ||
3 | BINARIES = $(UNIT) | ||
4 | .PHONY: all install-bin install | ||
5 | |||
6 | all: | ||
7 | @echo "run 'make install' to install" | ||
8 | |||
9 | ifeq ($(shell id -u),0) | ||
10 | |||
11 | install: $(UNIT).service install-bin | ||
12 | systemctl enable --now $(shell realpath -e $<) | ||
13 | |||
14 | install-bin: | ||
15 | install -t $(BINDIR) -- $(BINARIES) | ||
16 | |||
17 | else | ||
18 | |||
19 | install install-bin: | ||
20 | sudo $(MAKE) -$(MAKEFLAGS) $@ | ||
21 | |||
22 | endif | ||