#-----------------------------------------------------------------------------
# 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.
#
#       LDAP server daemon makefile
#
#-----------------------------------------------------------------------------

SRCS	= main.c detach.c setproctitle.c request.c bind.c result.c error.c \
	search.c util.c compare.c message.c add.c delete.c modrdn.c modify.c \
	abandon.c syntax.c association.c kerberos.c
OBJS	= main.o detach.o setproctitle.o request.o bind.o result.o error.o \
	search.o util.o compare.o message.o add.o delete.o modrdn.o modify.o \
	abandon.o syntax.o association.o kerberos.o

CFLAGS	= $(ACFLAGS) -I. -I../h $(ISODEINCLUDEFLAG) $(KRBINCLUDEFLAG)
LDFLAGS	= -L../liblber $(ISODELIBFLAG) $(KRBLIBFLAG)
LIBS	= -llber $(ISODELIBS) $(KRBLIBS)

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

all:	ldapd

ldapd:	version.o
	$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o $(LDFLAGS) $(LIBS)
#	purify $(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o $(LDFLAGS) $(LIBS)

sldapd:	version.o
	$(CC) $(ALDFLAGS) -Bstatic -o $@ $(OBJS) version.o $(LDFLAGS) $(LIBS)

version.c: $(OBJS) ../liblber/liblber.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)/ldapd

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

lint:;
	lint -I../h -I/usr/include/isode $(SRCS)

5lint:;
	/usr/5bin/lint -I../h -I/usr/local/isode/include $(SRCS)

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

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
detach.o: detach.c
setproctitle.o: setproctitle.c
request.o: request.c ../h/lber.h ../h/ldap.h
bind.o: bind.c ../h/lber.h ../h/ldap.h
result.o: result.c ../h/lber.h ../h/ldap.h
error.o: error.c ../h/lber.h ../h/ldap.h
search.o: search.c ../h/lber.h ../h/ldap.h
util.o: util.c ../h/lber.h ../h/ldap.h
compare.o: compare.c ../h/lber.h ../h/ldap.h
message.o: message.c ../h/lber.h ../h/ldap.h
add.o: add.c ../h/lber.h ../h/ldap.h
delete.o: delete.c ../h/lber.h ../h/ldap.h
modrdn.o: modrdn.c ../h/lber.h ../h/ldap.h
modify.o: modify.c ../h/lber.h ../h/ldap.h
abandon.o: abandon.c ../h/lber.h ../h/ldap.h
syntax.o: syntax.c ../h/lber.h ../h/ldap.h
association.o: association.c ../h/lber.h ../h/ldap.h
kerberos.o: kerberos.c ../h/lber.h ../h/ldap.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
