From 2e5895c173d4cceb5426619ab877d72671da849d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 16 Aug 2017 22:24:09 -0400 Subject: Make installation paths and such configurable This doesn't change the default behavior at all. --- Makefile | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 282ed1a..5be885b 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,23 @@ -files.out.all += systemd-timesyncd-wait systemd-timesyncd-wrap -files.sys.all += /usr/lib/systemd/systemd-timesyncd-wait -files.sys.all += /usr/lib/systemd/systemd-timesyncd-wrap -files.sys.all += /usr/lib/systemd/system/systemd-timesyncd-wait.socket -files.sys.all += /usr/lib/systemd/system/systemd-timesyncd-wait.service -files.sys.all += /usr/lib/systemd/system/systemd-timesyncd.service.d/wait.conf +prefix = /usr +rootprefix = $(prefix) +rootlibexecdir = $(rootprefix)/lib/systemd +systemunitdir=$(rootprefix)/lib/systemd/system + +TIMESYNCD_PATH = $(rootlibexecdir)/systemd-timesyncd +RM = /usr/bin/rm + +#### + +files.out.all += systemd-timesyncd-wait +files.out.all += systemd-timesyncd-wrap +files.out.all += systemd-timesyncd.service.d-wait.conf +files.out.all += systemd-timesyncd-wait.service + +files.sys.all += $(rootlibexecdir)/systemd-timesyncd-wait +files.sys.all += $(rootlibexecdir)/systemd-timesyncd-wrap +files.sys.all += $(systemunitdir)/systemd-timesyncd-wait.socket +files.sys.all += $(systemunitdir)/systemd-timesyncd-wait.service +files.sys.all += $(systemunitdir)/systemd-timesyncd.service.d/wait.conf outdir = . srcdir = . @@ -16,9 +30,13 @@ install: $(addprefix $(DESTDIR),$(files.sys.all)) $(outdir)/%: $(srcdir)/%.go go build -o $@ $< -$(DESTDIR)/usr/lib/systemd/%: $(outdir)/% +vars = rootlibexecdir TIMESYNCD_PATH RM +$(outdir)/%: $(srcdir)/%.in + sed $(foreach v,$(vars),-e 's|@$v@|$($v)|g') < $< > $@ + +$(DESTDIR)$(rootlibexecdir)/%: $(outdir)/% install -DTm755 $< $@ -$(DESTDIR)/usr/lib/systemd/system/%: $(srcdir)/% +$(DESTDIR)$(systemunitdir)/%: $(srcdir)/% install -DTm644 $< $@ -$(DESTDIR)/usr/lib/systemd/system/systemd-timesyncd.service.d/wait.conf: systemd-timesyncd.service.d-wait.conf +$(DESTDIR)$(systemunitdir)/systemd-timesyncd.service.d/wait.conf: $(outdir)/systemd-timesyncd.service.d-wait.conf install -DTm644 $< $@ -- cgit v1.2.3