github.com/hugh712/snapd@v0.0.0-20200910133618-1a99902bd583/data/systemd-user/Makefile (about) 1 # 2 # Copyright (C) 2019 Canonical Ltd 3 # 4 # This program is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License version 3 as 6 # published by the Free Software Foundation. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 SNAPD_ENVIRONMENT_FILE := /etc/environment 17 BINDIR := /usr/bin 18 SYSTEMDUSERUNITDIR := /usr/lib/systemd/user 19 20 SYSTEMD_UNITS_GENERATED := $(wildcard *.in) 21 # NOTE: sort removes duplicates so this gives us all the units, generated or otherwise 22 SYSTEMD_UNITS = $(sort $(SYSTEMD_UNITS_GENERATED:.in=) $(wildcard *.service) $(wildcard *.timer) $(wildcard *.socket)) 23 24 .PHONY: all 25 all: $(SYSTEMD_UNITS) 26 27 .PHONY: install 28 install:: $(SYSTEMD_UNITS) 29 # NOTE: old (e.g. 14.04) GNU coreutils doesn't -D with -t 30 install -d -m 0755 $(DESTDIR)/$(SYSTEMDUSERUNITDIR) 31 install -m 0644 -t $(DESTDIR)/$(SYSTEMDUSERUNITDIR) $^ 32 33 .PHONY: clean 34 clean: 35 rm -f $(SYSTEMD_UNITS_GENERATED:.in=) 36 37 %: %.in 38 cat $< | \ 39 sed s:@bindir@:$(BINDIR):g | \ 40 cat > $@