# Makefile for date_parse and friends
#
# Copyright (C) 1995 by Jef Poskanzer <jef@mail.acme.com>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

# CONFIGURE: the directory where you want the executables installed
BINDIR =	/usr/local/bin

# CONFIGURE: the directory tree where you want the man pages installed
MANDIR =	/usr/local/man

# CONFIGURE: type of system - uncomment one of these
DEFINES =	-DOS_BSD
#DEFINES =	-DOS_SYSV

# CONFIGURE: your compiler
CC =		cc

# CONFIGURE: your compiler flags
CFLAGS =	-O $(DEFINES) -ansi -pedantic -U__STRICT_ANSI__ -Wall -Wpointer-arith -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wno-long-long

# CONFIGURE: your loader flags
LDFLAGS =	-s

# End of configurable definitions.

EXES =		date_order date_sort date_merge deltime timegraph xmit_time

all:		$(EXES)

date_order:	date_order.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) date_order.c date_parse.o -o date_order

date_sort:	date_sort.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) date_sort.c date_parse.o -o date_sort

date_merge:	date_merge.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) date_merge.c date_parse.o -o date_merge

deltime:	deltime.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) deltime.c date_parse.o -o deltime

timegraph:	timegraph.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) timegraph.c date_parse.o -o timegraph

xmit_time:	xmit_time.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) xmit_time.c date_parse.o -o xmit_time

ctime:		ctime.c
	$(CC) $(CFLAGS) $(LDFLAGS) ctime.c -o ctime

.c.o:
	$(CC) $(CFLAGS) -c $<

test:		all dptest
	./dptest < test_input | diff test_output -

dptest:		dptest.c date_parse.h date_parse.o
	$(CC) $(CFLAGS) $(LDFLAGS) dptest.c date_parse.o -o dptest

install:	all
	for i in $(EXES) ; do \
	    rm -f $(BINDIR)/$$i ; \
	    cp $$i $(BINDIR)/$$i ; \
	done
	rm -f $(MANDIR)/man3/date_parse.3
	cp date_parse.3 $(MANDIR)/man3/date_parse.3
	for i in $(EXES) ; do \
	    rm -f $(MANDIR)/man1/$$i.1 ; \
	    cp $$i.1 $(MANDIR)/man1/$$i.1 ; \
	done

clean:
	rm -f *.o $(EXES) dptest ctime a.out core
