#-----------------------------------------------------------------------------
# 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 finger daemon makefile
#
#-----------------------------------------------------------------------------

LDAPSRC	= ../..
HDIR	= $(LDAPSRC)/include
LDIR	= $(LDAPSRC)/libraries
VERSIONFILE = $(LDAPSRC)/build/version

SRCS	= main.c
OBJS	= main.o

INCLUDES=-I$(HDIR)
DEFINES	= $(DEFS)

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

all:	in.xfingerd

in.xfingerd:	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:	in.xfingerd FORCE
	-$(MKDIR) -p $(LDAP_LIBEXECDIR)
	$(INSTALL) $(INSTALLFLAGS) -m 755 in.xfingerd $(LDAP_LIBEXECDIR)

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

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

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

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

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

