# Makefile for dillon's cron and crontab
#

CC  = gcc
CFLAGS = -O2 -Wall -Wstrict-prototypes
LIB = 
SRCS = main.c subs.c database.c job.c
OBJS = main.o subs.o database.o job.o
D_SRCS = crontab.c subs.c
D_OBJS = crontab.o subs.o
PROTOS= protos.h

all:	${PROTOS} crond crontab

crond:	${OBJS}
	${CC} ${CFLAGS} -o crond ${OBJS} ${LIB}
	strip crond

crontab:  ${D_OBJS}
	${CC} ${CFLAGS} -o crontab ${D_OBJS}
	strip crontab

protos.h: ${SRCS} ${D_SRCS}
	fgrep -h Prototype ${SRCS} ${D_SRCS} >protos.h

clean:  cleano
	rm -f crond crontab

cleano:
	rm -f *.o dcron.tgz $(PROTOS)

install: crond crontab
	install -o root -g root -m 0755 crond /usr/sbin
	install -o root -g root -m 4755 crontab /usr/bin
	install -o root -g root crontab.1 /usr/man/man1
	install -o root -g root  crond.8 /usr/man/man8

tar: cleano
	(cd ..; tar cvf - dcron | gzip -9 >dcron.tgz.tmp)
	mv -f ../dcron.tgz.tmp dcron.tgz

