systemd-cron-next/Makefile.in

136 lines
5.0 KiB
Makefile
Raw Normal View History

2015-08-05 15:10:46 +03:00
package := $(shell head -n1 README.md)
2015-08-05 13:54:01 +03:00
version := $(shell awk '/^version =/ { gsub("\"", "", $$3); print $$3; exit }' Cargo.toml)
2015-07-28 20:52:43 +03:00
schedules := @schedules@
enable_persistent := @enable_persistent@
prefix := @prefix@
bindir := @bindir@
confdir := @confdir@
datadir := @datadir@
libdir := @libdir@
statedir := @statedir@
mandir := @mandir@
docdir := @docdir@
unitdir := @unitdir@
runparts := @runparts@
srcdir := $(CURDIR)/src
outdir := $(CURDIR)/out
builddir := $(outdir)/build
distname := $(package)-$(version)
distdir := $(outdir)/dist/$(distname)
tarball := $(outdir)/dist/$(distname).tar.xz
out_services := $(foreach schedule,$(schedules),$(builddir)/units/cron-$(schedule).service)
out_timers := $(foreach schedule,$(schedules),$(builddir)/units/cron-$(schedule).timer)
out_targets := $(foreach schedule,$(schedules),$(builddir)/units/cron-$(schedule).target)
out_units := $(out_services) $(out_timers) $(out_targets) $(builddir)/units/cron.target \
$(builddir)/units/cron-update.path $(builddir)/units/cron-update.service \
$(builddir)/units/cron-failure@.service
2015-12-10 21:16:12 +03:00
out_manuals := $(patsubst $(CURDIR)/man/%.in,$(builddir)/man/%,$(wildcard $(CURDIR)/man/*))
2015-07-29 02:28:36 +03:00
out_programs := $(patsubst $(srcdir)/bin/%.rs,$(builddir)/bin/%,$(wildcard $(srcdir)/bin/*.rs))
2015-07-28 20:54:32 +03:00
outputs := $(out_units) $(out_manuals) $(out_programs)
2015-07-28 20:52:43 +03:00
define \n
endef
null :=
2015-12-10 21:16:12 +03:00
persistent = $(if $(filter $(enable_persistent),yes),persistent,)
2015-07-28 20:52:43 +03:00
all: $(builddir) $(outputs)
clean:
2015-12-10 21:16:12 +03:00
rm -rf $(outdir)
2015-07-28 20:52:43 +03:00
distprep: $(distdir) VERSION
2015-12-10 21:34:58 +03:00
cp -a Cargo.toml Cargo.lock configure Makefile.in LICENSE README.md VERSION src man units $(distdir)
2015-07-28 20:52:43 +03:00
VERSION: Cargo.toml
grep "^version =" Cargo.toml | sed -e 's/^version = "//' -e 's/"$$//' > VERSION
2015-07-28 20:52:43 +03:00
dist: $(tarball)
test: all
$(foreach manpage,$(out_manuals),\
man --warnings --encoding=utf8 --local-file $(manpage) 2>&1 > /dev/null${\n})
2015-07-29 02:28:36 +03:00
cargo test
build: all
2015-12-10 21:31:05 +03:00
RUN_PARTS="$(runparts)" STATE_DIR="$(statedir)" cargo install --path $(CURDIR) --root $(builddir) \
--features "$(schedules) $(persistent)"
2015-07-29 02:28:36 +03:00
install: build
2015-08-05 13:41:44 +03:00
install -m2755 -g `getent group cron || echo root` -s -D $(builddir)/bin/crontab $(DESTDIR)$(bindir)/crontab
2015-07-29 02:28:36 +03:00
install -m755 -s -D $(builddir)/bin/systemd-crontab-generator $(DESTDIR)$(libdir)/systemd/system-generators/systemd-crontab-generator
2015-08-05 14:59:38 +03:00
install -m755 -s -D $(builddir)/bin/remove-stale-stamps $(DESTDIR)$(libdir)/$(package)/remove-stale-stamps
2015-07-29 02:28:36 +03:00
install -m755 -s -D $(builddir)/bin/mail-on-failure $(DESTDIR)$(libdir)/$(package)/mail-on-failure
install -m755 -s -D $(builddir)/bin/boot-delay $(DESTDIR)$(libdir)/$(package)/boot-delay
2015-07-28 20:52:43 +03:00
install -m644 -D $(builddir)/man/systemd.cron.7 $(DESTDIR)$(mandir)/man7/systemd.cron.7
install -m644 -D $(builddir)/man/crontab.1 $(DESTDIR)$(mandir)/man1/crontab.1
install -m644 -D $(builddir)/man/crontab.5 $(DESTDIR)$(mandir)/man5/crontab.5
install -m644 -D $(builddir)/man/anacrontab.5 $(DESTDIR)$(mandir)/man5/anacrontab.5
install -m644 -D $(builddir)/man/systemd-crontab-generator.8 $(DESTDIR)$(mandir)/man8/systemd-crontab-generator.8
install -m644 -D $(builddir)/units/cron.target $(DESTDIR)$(unitdir)/cron.target
install -m644 $(builddir)/units/cron-update.path $(DESTDIR)$(unitdir)
install -m644 $(builddir)/units/cron-update.service $(DESTDIR)$(unitdir)
install -m644 $(builddir)/units/cron-failure@.service $(DESTDIR)$(unitdir)
$(foreach schedule,$(schedules),\
install -m644 $(builddir)/units/cron-$(schedule).timer $(DESTDIR)$(unitdir)${\n})
$(foreach schedule,$(schedules),\
install -m644 $(builddir)/units/cron-$(schedule).target $(DESTDIR)$(unitdir)${\n})
$(foreach schedule,$(schedules),\
install -m644 $(builddir)/units/cron-$(schedule).service $(DESTDIR)$(unitdir)${\n})
uninstall:
rm -f $(DESTDIR)$(bindir)/crontab
rm -f $(DESTDIR)$(libdir)/systemd/system-generators/systemd-crontab-generator
2015-08-05 14:59:38 +03:00
rm -f $(DESTDIR)$(libdir)/$(package)/remove-stale-stamps
rm -f $(DESTDIR)$(libdir)/$(package)/mail-on-failure
rm -f $(DESTDIR)$(libdir)/$(package)/boot-delay
2015-07-28 20:52:43 +03:00
rm -f $(DESTDIR)$(mandir)/man7/systemd.cron.7
rm -f $(DESTDIR)$(mandir)/man1/crontab.1
rm -f $(DESTDIR)$(mandir)/man5/crontab.5
rm -f $(DESTDIR)$(mandir)/man5/anacrontab.5
rm -f $(DESTDIR)$(mandir)/man8/systemd-crontab-generator.8
rm -f $(DESTDIR)$(unitdir)/cron.target
rm -f $(DESTDIR)$(unitdir)/cron-update.path
rm -f $(DESTDIR)$(unitdir)/cron-update.service
rm -f $(DESTDIR)$(unitdir)/cron-failure@.service
$(foreach schedule,$(schedules),\
rm -f $(DESTDIR)$(unitdir)/cron-$(schedule).timer${\n})
$(foreach schedule,$(schedules),\
rm -f $(DESTDIR)$(unitdir)/cron-$(schedule).target${\n})
$(foreach schedule,$(schedules),\
rm -f $(DESTDIR)$(unitdir)/cron-$(schedule).service${\n})
$(outputs): | $(builddir)
$(outdir):
mkdir -p $@
$(builddir):
mkdir -p $@
mkdir -p $@/bin
mkdir -p $@/man
mkdir -p $@/units
$(distdir):
mkdir -p $(distdir)
$(tarball): distprep
cd $(distdir)/..; tar -cJ --owner=root --group=root --file $(tarball) $(distname)
2015-07-29 02:28:36 +03:00
.PHONY: all clean build dist distprep install uninstall
2015-07-28 20:52:43 +03:00