# Makefile for splitdigest
# Copyright (c) 1994-1998 by Christopher Heng. All rights reserved.

# $Id: Makefile,v 2.12 1998/03/30 13:35:19 chris Released $


CC = gcc
DBG=-O2 -fomit-frame-pointer -s
CFLAGS = $(DBG) -Wall
LDFLAGS = $(DBG)

# You may define the following to change the default values.
#	DEFCONFIG	default pathname of the configuration file.
#			If you change this, change the macro LIBDIR below
#			as well.
#	MAXCFTABLE	maximum number of digest types in the config file.
#	SEPCHAR		separator character between messages in a digest

DEFCONFIG = /usr/local/lib/splitdigest.config
MAXCFTABLE = 128
MAXSCANFBUF = 512
SEPCHAR	= -
DEFINES = -DDEFCONFIG=\"$(DEFCONFIG)\" -DMAXCFTABLE=$(MAXCFTABLE) \
	-DSEPCHAR=\'$(SEPCHAR)\'

BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1
LIBDIR = /usr/local/lib

INSTALL = install -m 711 -o root -g root
INSTALLDATA = install -m 444 -o root -g root

# -----------------------------------------------------------------------
# End of configurable section of the Makefile.
# You should not need to modify anything below this line
# ------------------------------------------------------------------------

OBJS = main.o cftables.o uncatfile.o

FILES = COPYING CHANGES README Makefile \
        main.c uncatfile.c cftables.c splitdigest.h version.h cftables.h \
        sysdep.h splitdigest.1 splitdigest.config splitdigest.lsm

DOSFILES = msdos/getopt.c msdos/getopt.h msdos/mktemp.c msdos/mktemp.h

SDVERSTR = -nR2_4
SDVERNUM = 2.4
RCSSTATE = -sReleased

all: splitdigest

splitdigest: $(OBJS)
	$(CC) $(LDFLAGS) -o splitdigest $(OBJS)

install: all
	$(INSTALL) splitdigest $(BINDIR)/
	$(INSTALLDATA) splitdigest.1 $(MANDIR)/
	$(INSTALLDATA) splitdigest.config $(LIBDIR)/

clean:
	rm -f *.o splitdigest

main.o: main.c splitdigest.h version.h cftables.h sysdep.h
	$(CC) $(CFLAGS) $(DEFINES) -o main.o -c main.c

cftables.o: cftables.c splitdigest.h cftables.h
	$(CC) $(CFLAGS) $(DEFINES) -o cftables.o -c cftables.c

uncatfile.o: uncatfile.c splitdigest.h cftables.h sysdep.h
	$(CC) $(CFLAGS) $(DEFINES) -o uncatfile.o -c uncatfile.c

checkin:
	ci $(SDVERSTR) -u$(RCSVERNUM) $(RCSSTATE) $(FILES)
	ci $(SDVERSTR) -u$(RCSVERNUM) $(RCSSTATE) $(DOSFILES)

checkout:
	co $(FILES)
	co $(DOSFILES)

develcheckout:
	co -l $(FILES)
	co -l $(DOSFILES)

mytar:	all
	cd ..;\
	tar cvvf spdig-$(SDVERNUM).tar splitdigest-$(SDVERNUM) ;\
	gzip -9 spdig-$(SDVERNUM).tar

dist:	mytar
	rm -rf RCS msdos test bin
	rm *.o
	cd ..;\
	tar cvvf splitdigest-$(SDVERNUM).tar splitdigest-$(SDVERNUM) ;\
	gzip -9 splitdigest-$(SDVERNUM).tar
