#-----------------------------------------------------------------------------
# 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.
#
#       X.500 ldap mailer makefile
#
#-----------------------------------------------------------------------------

SRCS	= main.c
OBJS	= main.o

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

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

all:	mail500

mail500:	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)/mail500

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

lint:;
	lint $(CFLAGS) $(SRCS)

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

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

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

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
