#-----------------------------------------------------------------------------
# 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 mailer 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)
LDFLAGS	= -L$(LDIR)
LIBS	= -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)

all:	mail500

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

version.c: $(OBJS) $(LDIR)/libldap/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:	mail500 FORCE
	-$(MKDIR) -p $(LDAP_LIBEXECDIR)
	$(INSTALL) $(INSTALLFLAGS) -m 755 mail500 $(LDAP_LIBEXECDIR)

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

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

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

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

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

