Added extra/crond.service for systemd
[dcron.git] / Makefile
blobc7cc3596d894829aa741aa0be46e373c556e1835
1 # Makefile for Dillon's crond and crontab
2 VERSION = 4.5
4 # these variables can be configured by e.g. `make SCRONTABS=/different/path`
5 PREFIX = /usr/local
6 CRONTAB_GROUP = wheel
7 SCRONTABS = /etc/cron.d
8 CRONTABS = /var/spool/cron/crontabs
9 CRONSTAMPS = /var/spool/cron/cronstamps
10 # used for syslog
11 LOG_IDENT = crond
12 # used for logging to file (syslog manages its own timestamps)
13 # if LC_TIME is set, it will override any compiled-in timestamp format
14 TIMESTAMP_FMT = %b %e %H:%M:%S
15 SBINDIR = $(PREFIX)/sbin
16 BINDIR = $(PREFIX)/bin
17 MANDIR = $(PREFIX)/share/man
19 -include config
22 SHELL = /bin/sh
23 INSTALL = install -o root
24 INSTALL_PROGRAM = $(INSTALL) -D
25 INSTALL_DATA = $(INSTALL) -D -m0644 -g root
26 INSTALL_DIR = $(INSTALL) -d -m0755 -g root
27 CFLAGS ?= -O2
28 CFLAGS += -Wall -Wstrict-prototypes -Wno-missing-field-initializers
29 SRCS = main.c subs.c database.c job.c concat.c chuser.c
30 OBJS = main.o subs.o database.o job.o concat.o chuser.o
31 TABSRCS = crontab.c chuser.c
32 TABOBJS = crontab.o chuser.o
33 PROTOS = protos.h
34 LIBS =
35 LDFLAGS =
36 DEFS = -DVERSION='"$(VERSION)"' \
37 -DSCRONTABS='"$(SCRONTABS)"' -DCRONTABS='"$(CRONTABS)"' \
38 -DCRONSTAMPS='"$(CRONSTAMPS)"' -DLOG_IDENT='"$(LOG_IDENT)"' \
39 -DTIMESTAMP_FMT='"$(TIMESTAMP_FMT)"'
41 # save variables needed for `make install` in config
42 all: $(PROTOS) crond crontab ;
43 rm -f config
44 echo "PREFIX = $(PREFIX)" >> config
45 echo "SBINDIR = $(SBINDIR)" >> config
46 echo "BINDIR = $(BINDIR)" >> config
47 echo "MANDIR = $(MANDIR)" >> config
48 echo "CRONTAB_GROUP = $(CRONTAB_GROUP)" >> config
49 echo "SCRONTABS = $(SCRONTABS)" >> config
50 echo "CRONTABS = $(CRONTABS)" >> config
51 echo "CRONSTAMPS = $(CRONSTAMPS)" >> config
53 protos.h: $(SRCS) $(TABSRCS)
54 fgrep -h Prototype $(SRCS) $(TABSRCS) > protos.h
56 crond: $(OBJS)
57 $(CC) $(LDFLAGS) $^ $(LIBS) -o crond
59 crontab: $(TABOBJS)
60 $(CC) $(LDFLAGS) $^ -o crontab
62 %.o: %.c defs.h $(PROTOS)
63 $(CC) $(CFLAGS) $(CPPFLAGS) -c $(DEFS) $< -o $@
65 install:
66 $(INSTALL_PROGRAM) -m0700 -g root crond $(DESTDIR)$(SBINDIR)/crond
67 $(INSTALL_PROGRAM) -m4750 -g $(CRONTAB_GROUP) crontab $(DESTDIR)$(BINDIR)/crontab
68 $(INSTALL_DATA) crontab.1 $(DESTDIR)$(MANDIR)/man1/crontab.1
69 $(INSTALL_DATA) crond.8 $(DESTDIR)$(MANDIR)/man8/crond.8
70 $(INSTALL_DIR) $(DESTDIR)$(SCRONTABS)
71 $(INSTALL_DIR) $(DESTDIR)$(CRONTABS)
72 $(INSTALL_DIR) $(DESTDIR)$(CRONSTAMPS)
74 clean: force
75 rm -f *.o $(PROTOS)
76 rm -f crond crontab config
78 force: ;
80 man: force
81 -pandoc -t man -f markdown -s crontab.markdown -o crontab.1
82 -pandoc -t man -f markdown -s crond.markdown -o crond.8
84 # for maintainer's use only
85 TARNAME = /home/abs/_dcron/dcron-$(VERSION).tar.gz
86 dist: clean man
87 bsdtar -cz --exclude repo/.git -f $(TARNAME).new -s'=^repo=dcron-$(VERSION)=' -C .. repo
88 mv -f $(TARNAME).new $(TARNAME)