#-----------------------------------------------------------------------------
# Copyright (c) 1992 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 rcpt500 mail query server makefile
#
# add -DUOFM to ACFLAGS in ../Makefile to get U of M specific features,
#    such as the use of the multiLineDescription attribute.
#
#-----------------------------------------------------------------------------

SRCS= main.c cmds.c help.c query.c
OBJS= main.o cmds.o help.o query.o

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

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

all:	rcpt500

rcpt500:	version.o
	$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o \
		-L../libldap -L../liblber $(LIBS)

version.c: $(OBJS) ../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)/rcpt500 $(ETCDIR)/rcpt500.help

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

$(ETCDIR)/rcpt500.help:	rcpt500.help
	$(INSTALL) $(INSTALLFLAGS) -m 644 rcpt500.help $(ETCDIR)

lint:;
	lint $(SRCS)

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

clean:;
	rm -f *.o core a.out version.c rcpt500

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 rcpt500.h ../h/lber.h ../h/ldap.h
cmds.o: cmds.c rcpt500.h
help.o: help.c rcpt500.h
query.o: query.c rcpt500.h ../h/lber.h ../h/ldap.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
