#-----------------------------------------------------------------------------
# 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.
#
#       LDAP include file makefile
#
#-----------------------------------------------------------------------------

LDAPSRC=..

all:	ldapconfig.h FORCE
	@if [ ! -z "$(SYSEXITSPATH)" -a ! -r sysexits.h ]; then \
	    echo "$(LN) $(SYSEXITSPATH) sysexits.h"; \
	    $(LN) $(SYSEXITSPATH) sysexits.h; \
	else \
	    exit 0; \
	fi

ldapconfig.h:	ldapconfig.h.edit Makefile
	@$(RM) $@
	@echo "/*" > $@;  \
        echo " * This file was automatically generated.  Do not edit it." >> $@; \
        echo " * Instead, edit the file ldapconfig.h.edit.  See the LDAP" >> $@; \
        echo " * INSTALL file for more information." >> $@; \
        echo " */ " >> $@; \
        echo "" >> $@; \
	$(SED) -e 's;%ETCDIR%;$(RUNTIMEETCDIR);' ldapconfig.h.edit >> $@; \
	$(CHMOD) 444 $@

install: all FORCE
		-$(MKDIR) -p $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 proto-lber.h $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 proto-ldap.h $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 disptmpl.h $(INCLUDEDIR)
		$(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(INCLUDEDIR)

depend:	FORCE

clean:	FORCE

veryclean:	clean
	$(RM) ldapconfig.h
	@if [ ! -z "$(SYSEXITSPATH)" ]; then \
	    echo "$(RM) sysexits.h"; \
	    $(RM) sysexits.h; \
	else \
	    exit 0; \
	fi

links:
	@echo "making links in `$(PWD)`
	@$(LN) .src/*.h .
	@cp .src/ldapconfig.h.edit .
	@-$(RM) ldapconfig.h
