1 # Makefile for Dillon's crond and crontab
4 # these variables can be configured by e.g. `make SCRONTABS=/different/path`
7 SCRONTABS
= /etc
/cron.d
8 CRONTABS
= /var
/spool
/cron
/crontabs
9 CRONSTAMPS
= /var
/spool
/cron
/cronstamps
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
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
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
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
;
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
57 $(CC
) $(LDFLAGS
) $^
$(LIBS
) -o crond
60 $(CC
) $(LDFLAGS
) $^
-o crontab
62 %.o
: %.c defs.h
$(PROTOS
)
63 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
$(DEFS
) $< -o
$@
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
)
76 rm -f crond crontab config
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
87 bsdtar
-cz
--exclude repo
/.git
-f
$(TARNAME
).new
-s
'=^repo=dcron-$(VERSION)=' -C .. repo
88 mv
-f
$(TARNAME
).new
$(TARNAME
)