summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9984122ed96ed68e10a9c143bbd0fe8c718f554b (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
29
30
31
32
33
34
35
36
37
38
39
DESTDIR=
PREFIX=/usr/local
LIBEXECDIR=$(PREFIX)/libexec
LIBDIR=$(PREFIX)/lib
SYSDDIR=$(LIBDIR)/systemd/system
DATADIR=$(PREFIX)/share
MANDIR=$(DATADIR)/man
MAN8DIR=$(MANDIR)/man8


%: %.in
	sed "s|@LIBEXECDIR@|$(LIBEXECDIR)|g" $< >$@
	sed -i "s|@SYSDDIR@|$(SYSDDIR)|g" $@


all: shutdown-if-no-sessions.service ready-for-shutdown.target.8


install: all
	install -m644 -Dt $(DESTDIR)$(SYSDDIR) ready-for-shutdown.target
	install -m644 -Dt $(DESTDIR)$(MAN8DIR) ready-for-shutdown.target.8
	install -m644 -Dt $(DESTDIR)$(SYSDDIR) shutdown-if-no-sessions.service
	install -m644 -Dt $(DESTDIR)$(MAN8DIR) shutdown-if-no-sessions.service.8
	install -m755 -Dt $(DESTDIR)$(LIBEXECDIR) shutdown-if-no-sessions


uninstall:
	rm -f $(DESTDIR)$(SYSDDIR)/ready-for-shutdown.target
	rm -f $(DESTDIR)$(MAN8DIR)/ready-for-shutdown.target.8
	rm -f $(DESTDIR)$(SYSDDIR)/shutdown-if-no-sessions.service
	rm -f $(DESTDIR)$(MAN8DIR)/shutdown-if-no-sessions.service.8
	rm -f $(DESTDIR)$(BINDIR)/shutdown-if-no-sessions


clean:
	rm -f *.service *.target.8


.PHONY: all install uninstall clean