#-----------------------------------------------------------------------------
# Copyright (c) 1990 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#
#       X.500 ldap fax mailer makefile
#
#-----------------------------------------------------------------------------

SRCS	= rp500.c faxtotpc.c
OBJS	= rp500.o faxtotpc.o

CFLAGS	= -I../h $(ACFLAGS) -g
LIBS	= -lldap -llber $(KRBLIBFLAG) $(KRBLIBS)

default:
	(cd ../; make ldap-fax500)

all:	rp500 fax500

rp500:	rpversion.o
	$(CC) $(ALDFLAGS) -o $@ faxtotpc.o rp500.o rpversion.o \
		-L../libldap -L../liblber $(LIBS)

fax500:	fax5version.o
	$(CC) $(ALDFLAGS) -o $@ main.o fax5version.o faxtotpc.o \
		-L../libldap -L../liblber $(LIBS)

rpversion.c:	faxtotpc.o rp500.o ../libldap/libldap.a
	rm -f $@
	(u=$${USER-root} v=`cat ../version` d=`pwd` h=`hostname` t=`date`; \
	sed -e "s|%WHEN%|$${t}|" \
	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
	-e "s|%VERSION%|$${v}|" \
	< Versionrp.c > $@)

fax5version.c:	main.o faxtotpc.o ../libldap/libldap.a
	rm -f $@
	(u=$${USER-root} v=`cat ../version` d=`pwd` h=`hostname` t=`date`; \
	sed -e "s|%WHEN%|$${t}|" \
	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
	-e "s|%VERSION%|$${v}|" \
	< Version.c > $@ )

install:	$(ETCDIR)/rp500 $(BINDIR)/xrpcomp $(ETCDIR)/fax500

$(ETCDIR)/rp500:	rp500
	$(INSTALL) $(INSTALLFLAGS) -m 755 rp500 $(ETCDIR)

$(BINDIR)/xrpcomp:	xrpcomp
	sed -e 's%ETCDIR%$(ETCDIR)%' xrpcomp > /tmp/xrpcomp.tmp
	$(INSTALL) $(INSTALLFLAGS) -m 755 /tmp/xrpcomp.tmp $(BINDIR)/xrpcomp
	rm -f /tmp/xrpcomp.tmp

$(ETCDIR)/fax500:	fax500
	$(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(ETCDIR)

lint:;
	lint $(CFLAGS) $(SRCS)

5lint:;
	/usr/5bin/lint $(CFLAGS) $(SRCS)

clean:;
	rm -f *.o core a.out rpversion.c fax5version.c rp500 fax500

depend:;
	../mkdep $(CFLAGS) $(SRCS)

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

main.o: main.c ../h/lber.h ../h/ldap.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
