# Makefile for the library files.
# Copyright (c) 1997, 2001 by M. Broek.
# $Id$

include ../Makefile.global

CLCOMM_SRCS	= clcomm.c client.c crc.c semafore.c signame.c 
CLCOMM_OBJS	= clcomm.o client.o crc.o semafore.o signame.o
CLCOMM_HDRS	= clcomm.h
COMMON_SRCS	= attach.c charconv_utf.c falists.c hdr.c msgflags.c parsedate.c rfcmsg.c unpacker.c \
		  batchrd.c charset.c ftn.c nodelist.c pktname.c mangle.c \
		  charconv.c dostran.c ftnmsg.c mbfile.c nodelock.c rawio.c strcasestr.c \
		  charconv_hz.c execute.c expipe.c getheader.c mime.c noderecord.c rfcaddr.c strutil.c \
		  charconv_jp.c faddr.c gmtoffset.c packet.c rfcdate.c term.c 
COMMON_OBJS	= ftscprod.o attach.o charconv_utf.o falists.o hdr.o msgflags.o parsedate.o rfcmsg.o unpacker.o \
		  batchrd.o charset.o ftn.o nodelist.o pktname.o mangle.o \
		  charconv.o dostran.o ftnmsg.o mbfile.o nodelock.o rawio.o strcasestr.o \
		  charconv_hz.o execute.o expipe.o getheader.o mime.o noderecord.o rfcaddr.o strutil.o \
		  charconv_jp.o faddr.o gmtoffset.o packet.o rfcdate.o term.o
COMMON_HDRS	= common.h
DBASE_SRCS	= dbcfg.c dbdupe.c dbftn.c dbmsgs.c dbnode.c dbtic.c dbuser.c
DBASE_OBJS	= dbcfg.o dbdupe.o dbftn.o dbmsgs.o dbnode.o dbtic.o dbuser.o
DBASE_HDRS	= dbcfg.h dbdupe.h dbftn.h dbmsgs.h dbnode.h dbtic.h dbuser.h
MSGBASE_SRCS	= jammsg.c msg.c msgtext.c
MSGBASE_OBJS	= jammsg.o msg.o msgtext.o
MSGBASE_HDRS	= jam.h jammsg.h jamsys.h msg.h msgtext.h
MBINET_SRCS	= nntp.c pop3.c smtp.c
MBINET_OBJS	= nntp.o pop3.o smtp.o
MBINET_HDRS	= mbinet.h
DIESEL_SRCS	= diesel.c mbdiesel.c
DIESEL_HDRS	= diesel.h
DIESEL_OBJS	= diesel.o mbdiesel.o
MEMWATCH_SRCS	= memwatch.c
MEMWATCH_OBJS	= memwatch.o
MEMWATCH_HDRS	= memwatch.h
OTHER_HDRS	= ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h
SRCS		= ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \
		  ${DIESEL_SRCS} ${MEMWATCH_SRCS}
OBJS		= ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \
		  ${DIESEL_OBJS} ${MEMWATCH_OBJS}
HDRS		= ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \
		  ${DIESEL_HDRS} ${MEMWATCH_HDRS} ${OTHER_HDRS}
OTHER		= Makefile README ftscprod.006 mkprod.awk FAQ README.memwatch USING test.c \
		  memwatch.c.org README.diesel README.macro Diesel.doc
TARGET		= libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a libmemwatch.a

#############################################################################

.c.o:
		${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -c $<

all:		${TARGET}

ftscprod.c:	ftscprod.??? mkprod.awk
		${AWK} -F, -f mkprod.awk ftscprod.??? >ftscprod.c

libclcomm.a:	${CLCOMM_OBJS}
		ar r $@ $?
		${RANLIB} $@

libcommon.a:	${COMMON_OBJS}
		ar r $@ $?
		${RANLIB} $@

libdbase.a:	${DBASE_OBJS}
		ar r $@ $?
		${RANLIB} $@

libmsgbase.a:	${MSGBASE_OBJS}
		ar r $@ $?
		${RANLIB} $@

libmbinet.a:	${MBINET_OBJS}
		ar r $@ $?
		${RANLIB} $@

libdiesel.a:	${DIESEL_OBJS}
		ar r $@ $?
		${RANLIB} $@

libmemwatch.a:	${MEMWATCH_OBJS}
		ar r $@ $?
		${RANLIB} $@

install:	all

clean:
		rm -f ${TARGET} *.o *.h~ *.c~ ftscprod.c core filelist Makefile.bak

filelist:	Makefile
		BASE=`pwd`; \
		BASE=`basename $${BASE}`; \
		(for f in ${SRCS} ${HDRS} ${OTHER} ;do echo ${PACKAGE}-${VERSION}/$${BASE}/$$f; done) >filelist

depend:		ftscprod.c
		@rm -f Makefile.bak; \
		mv Makefile Makefile.bak; \
		sed -e '/^# DO NOT DELETE/,$$d' Makefile.bak >Makefile; \
		${ECHO} '# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT' >>Makefile; \
		${ECHO} '# Dependencies generated by make depend' >>Makefile; \
		for f in ${SRCS} ftscprod.c; \
		do \
			${ECHO} "Dependencies for $$f:\c"; \
			${ECHO} "`basename $$f .c`.o:\c" >>Makefile; \
			for h in `sed -n -e \
				's/^#[ 	]*include[ 	]*"\([^"]*\)".*/\1/p' $$f`; \
			do \
				${ECHO} " $$h\c"; \
				${ECHO} " $$h\c" >>Makefile; \
			done; \
			${ECHO} " done."; \
			${ECHO} "" >>Makefile; \
		done; \
		${ECHO} '# End of generated dependencies' >>Makefile

# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
clcomm.o: libs.h clcomm.h
client.o: libs.h clcomm.h
crc.o: libs.h clcomm.h
semafore.o: libs.h structs.h clcomm.h common.h
signame.o: libs.h clcomm.h
attach.o: libs.h structs.h users.h records.h clcomm.h common.h
charconv_utf.o: libs.h structs.h common.h
falists.o: libs.h structs.h clcomm.h common.h
hdr.o: libs.h structs.h common.h
msgflags.o: libs.h structs.h clcomm.h common.h
parsedate.o: libs.h structs.h common.h
rfcmsg.o: libs.h structs.h users.h records.h common.h clcomm.h
unpacker.o: libs.h structs.h users.h records.h clcomm.h common.h
batchrd.o: libs.h structs.h clcomm.h common.h
charset.o: libs.h structs.h common.h clcomm.h
ftn.o: libs.h structs.h users.h records.h clcomm.h dbftn.h common.h
nodelist.o: libs.h structs.h users.h records.h clcomm.h common.h
pktname.o: libs.h structs.h users.h records.h clcomm.h common.h
mangle.o: libs.h structs.h clcomm.h common.h
charconv.o: libs.h structs.h users.h records.h common.h clcomm.h
dostran.o: libs.h structs.h users.h records.h common.h
ftnmsg.o: libs.h structs.h common.h clcomm.h
mbfile.o: libs.h structs.h clcomm.h common.h
nodelock.o: libs.h structs.h clcomm.h common.h
rawio.o: libs.h structs.h common.h
strcasestr.o: libs.h
charconv_hz.o: libs.h structs.h common.h clcomm.h
execute.o: libs.h structs.h clcomm.h common.h
expipe.o: libs.h structs.h clcomm.h common.h
getheader.o: libs.h structs.h users.h records.h clcomm.h common.h
mime.o: libs.h structs.h clcomm.h common.h
noderecord.o: libs.h structs.h common.h users.h records.h dbnode.h common.h
rfcaddr.o: libs.h structs.h users.h records.h clcomm.h common.h
strutil.o: libs.h structs.h common.h
charconv_jp.o: libs.h structs.h common.h
faddr.o: libs.h structs.h common.h
gmtoffset.o: libs.h structs.h common.h
packet.o: libs.h structs.h users.h records.h clcomm.h common.h dbnode.h
rfcdate.o: libs.h structs.h common.h clcomm.h
term.o: libs.h structs.h users.h ansi.h records.h common.h
dbcfg.o: libs.h mbse.h structs.h users.h records.h dbcfg.h
dbdupe.o: libs.h structs.h clcomm.h dbdupe.h
dbftn.o: libs.h structs.h users.h records.h dbcfg.h dbftn.h
dbmsgs.o: libs.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h
dbnode.o: libs.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
dbtic.o: libs.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h
dbuser.o: libs.h structs.h users.h records.h dbcfg.h dbuser.h
jammsg.o: libs.h clcomm.h msgtext.h msg.h jam.h jammsg.h
msg.o: libs.h msgtext.h msg.h jammsg.h
msgtext.o: libs.h msgtext.h msg.h
nntp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
pop3.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
smtp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
diesel.o: libs.h diesel.h
mbdiesel.o: libs.h structs.h users.h records.h common.h clcomm.h diesel.h
memwatch.o: ../config.h ../config.h libs.h memwatch.h
ftscprod.o: libs.h structs.h common.h
# End of generated dependencies
