#-----------------------------------------------------------------------------
# Copyright (c) 1994 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 responder makefile
#
#-----------------------------------------------------------------------------
LDAPSRC	= ../..
HDIR	= $(LDAPSRC)/include
LDIR	= $(LDAPSRC)/libraries
VERSIONFILE = $(LDAPSRC)/build/version

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

INCLUDES= -I$(HDIR)
DEFINES	= $(DEFS)
CFLAGS	= $(INCLUDES) $(DEFINES) $(ACFLAGS)
LIBS	= -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)

all:	rcpt500

rcpt500:	version.o
	$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o -L$(LDIR) $(LIBS)

version.c: $(OBJS) $(LDIR)/libldap.a
	$(RM) $@
	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
	-e "s|%VERSION%|$${v}|" \
	< Version.c > $@)

install:	rcpt500 rcpt500.help FORCE
	-$(MKDIR) -p $(ETCDIR)
	$(INSTALL) $(INSTALLFLAGS) -m 755 rcpt500 $(ETCDIR)
	$(INSTALL) $(INSTALLFLAGS) -m 644 rcpt500.help $(ETCDIR)

lint:	FORCE
	$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)

5lint:	FORCE
	$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)

clean:	FORCE
	$(RM) *.o core a.out version.c rcpt500

depend:	FORCE
	$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)

links:
	@$(LN) .src/README .src/*.[ch] .src/*.help .

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

main.o: main.c ../../include/portable.h ../../include/ldapconfig.h rcpt500.h
cmds.o: cmds.c rcpt500.h
help.o: help.c ../../include/portable.h ../../include/ldapconfig.h rcpt500.h
query.o: query.c ../../include/lber.h ../../include/ldap.h
query.o: ../../include/portable.h ../../include/ldapconfig.h
query.o: ../../include/disptmpl.h rcpt500.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
