# 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
DISTTAR= /home/httpd/htdocs/FreeSrc/dcron29.tgz

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:
	rm -f /usr/bin/crond /usr/bin/crontab
	cp crond crontab /usr/bin
	chown root.wheel /usr/bin/crond
	chown root.cron /usr/bin/crontab
	chmod 700 /usr/bin/crond
	chmod 4750 /usr/bin/crontab
	-mkdirs /usr/man/man1
	-mkdirs /usr/man/man8
	cp crontab.1 /usr/man/man1
	cp crond.8 /usr/man/man8
	chmod 444 /usr/man/man1/crontab.1
	chmod 444 /usr/man/man8/crond.8

# dillon-specific
#

tar: clean
	(cd ..; tar czf $(DISTTAR).new dcron)
	chown dillon $(DISTTAR).new
	chmod 644 $(DISTTAR).new
	mv -f $(DISTTAR).new $(DISTTAR)

