#/* Copyright 1988,1990,1993,1994 by Paul Vixie
# * All rights reserved
# *
# * Distribute freely, except: don't remove my name from the source or
# * documentation (don't take credit for my work), mark your changes (don't
# * get me blamed for your possible bugs), don't alter or remove this
# * notice.  May be sold if buildable source is provided to buyer.  No
# * warrantee of any kind, express or implied, is included with this
# * software; use at your own risk, responsibility for damages (if any) to
# * anyone resulting from the use of this software rests entirely with the
# * user.
# *
# * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
# * I'll try to keep a version up to date.  I can be reached as follows:
# * Paul Vixie          <paul@vix.com>          uunet!decwrl!vixie!paul
# */
# Makefile for vixie's cron
#
# $Id: Makefile,v 1.1.1.1 2005/08/17 06:37:27 johnsoncheng Exp $
#
#
# NOTES:
#	'make' can be done by anyone
#	'make install' must be done by root
#
#	this package needs getopt(3), bitstring(3), and BSD install(8).
#
#	the configurable stuff in this makefile consists of compilation
#	options (use -O, cron runs forever) and destination directories.
#	SHELL is for the 'augumented make' systems where 'make' imports
#	SHELL from the environment and then uses it to run its commands.
#	if your environment SHELL variable is /bin/csh, make goes real
#	slow and sometimes does the wrong thing.  
#
#	this package needs the 'bitstring macros' library, which is
#	available from me or from the comp.sources.unix archive.  if you
#	put 'bitstring.h' in a non-standard place (i.e., not intuited by
#	cc(1)), you will have to define INCLUDE to set the include
#	directory for cc.  INCLUDE should be `-Isomethingorother'.
#
#	there's more configuration info in config.h; edit that first!
#
#################################### begin configurable stuff
VERSION		=	0.13
#<<DESTROOT is assumed to have ./etc, ./bin, and ./man subdirectories>>
DESTROOT	=	$(DESTDIR)/usr
DESTSBIN	=	$(DESTROOT)/sbin
DESTBIN		=	$(DESTROOT)/bin
DESTMAN		=	$(DESTROOT)/man
#<<need bitstring.h>>
INCLUDE		=	-I.
#<<need getopt()>>
LIBS		=
#<<optimize or debug?>>
OPTIM		=	-O2
#OPTIM		=	-gstabs+ -DDEBUGGING
#<<ATT or BSD or POSIX?>>
# (ATT untested)
#COMPAT		=	-DATT
#(BSD is only needed if <sys/params.h> does not define it, as on ULTRIX)
#COMPAT		=	-DBSD
# (POSIX)
COMPAT		=	-DPOSIX
#<<want to use a nonstandard CC?>>
CC		=	gcc
#<<manifest defines>>
#DEFS		= -s
#(SGI IRIX systems need this)
#DEFS		=	-D_BSD_SIGNALS -Dconst=
#<<the name of the BSD-like install program>>
#INSTALL = installbsd
INSTALL = install
#<<any special load flags>>
LDFLAGS		= -s
#################################### end configurable stuff

CFLAGS		+=	$(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS)

INFOS		=	README ChangeLog INSTALL hc-cron.spec doc
HEADERS		=	bitstring.h cron.h config.h pathnames.h \
			externs.h compat.h
SOURCES		=	cron.c crontab.c database.c do_command.c entry.c \
			env.c job.c user.c popen.c misc.c compat.c hccron.c
TAR-BALL	=	$(SOURCES) $(HEADERS) $(INFOS) \
			man Makefile redhat
CRON_OBJ	=	cron.o database.o user.o entry.o job.o do_command.o \
			misc.o env.o popen.o compat.o hccron.o
CRONTAB_OBJ	=	crontab.o misc.o entry.o env.o compat.o

all		:	cron crontab

cron		:	$(CRON_OBJ)
			$(CC) $(LDFLAGS) -o cron $(CRON_OBJ) $(LIBS)

crontab		:	$(CRONTAB_OBJ)
			$(CC) $(LDFLAGS) -o crontab $(CRONTAB_OBJ) $(LIBS)

install		:	all
			$(INSTALL) -c -m 750 -o root -s cron    $(DESTSBIN)/crond
			$(INSTALL) -c -m 4755 -o root -s crontab $(DESTBIN)/
			$(INSTALL) -c -m 644 -o root man/crontab.1 $(DESTMAN)/man1/
			$(INSTALL) -c -m 644 -o root man/crontab.5 $(DESTMAN)/man5/
			$(INSTALL) -c -m 644 -o root man/cron.8 $(DESTMAN)/man8/
			rm -f $(DESTMAN)/man8/crond.8
			ln -sf $(DESTMAN)/man8/cron.8 $(DESTMAN)/man8/crond.8
clean		:
			rm -f *.o cron crontab a.out core tags *~ #*

tar		:	$(TAR-BALL)
			mkdir hc-cron-$(VERSION)
			cp -R $(TAR-BALL) hc-cron-$(VERSION)
			tar -czf hc-cron-$(VERSION).tar.gz hc-cron-$(VERSION)
			rm -rf hc-cron-$(VERSION)
			mv hc-cron-$(VERSION).tar.gz ..

$(CRON_OBJ)	:	cron.h compat.h config.h externs.h pathnames.h Makefile
$(CRONTAB_OBJ)	:	cron.h compat.h config.h externs.h pathnames.h Makefile
