#-----------------------------------------------------------------------------
# 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 man1 makefile
#
#-----------------------------------------------------------------------------

LDAPSRC= ../../..
SECT=1
INSTDIR=$(LDAP_MANDIR)/man$(SECT)
VERSIONFILE = $(LDAPSRC)/build/version

all:	FORCE

install:	FORCE
	-$(MKDIR) -p $(INSTDIR)
	@TMPMAN=/tmp/ldapman.$$$$$(MANCOMPRESSSUFFIX); \
	VERSION=`$(CAT) $(VERSIONFILE)`; \
	for page in *.$(SECT); do \
	    $(SED) -e "s%LDVERSION%$$VERSION%" \
			-e 's%ETCDIR%$(LDAP_ETCDIR)%' \
			-e 's%SBINDIR%$(LDAP_SBINDIR)%' \
			-e 's%BINDIR%$(LDAP_BINDIR)%' \
			-e 's%LIBEXECDIR%$(LDAP_LIBEXECDIR)%' \
		    $$page | $(MANCOMPRESS) > $$TMPMAN; \
	    echo "installing $(INSTDIR)/$$page"; \
		$(RM) $(INSTDIR)/$$page $(INSTDIR)/$$page$(MANCOMPRESSSUFFIX); \
	    $(INSTALL) $(INSTALLFLAGS) -m 644 $$TMPMAN $(INSTDIR)/$$page$(MANCOMPRESSSUFFIX); \
	    if [ -f "$$page.links" ]; then \
		for link in `$(CAT) $$page.links`; do \
		    echo "installing $(INSTDIR)/$$link as link to $$page"; \
			$(RM) $(INSTDIR)/$$link $(INSTDIR)/$$link$(MANCOMPRESSSUFFIX); \
		    ln -sf $$page$(MANCOMPRESSSUFFIX) $(INSTDIR)/$$link$(MANCOMPRESSSUFFIX); \
		done; \
	    fi; \
	done; \
	$(RM) $$TMPMAN

clean:	FORCE

depend:	FORCE

lint:	FORCE

5lint:	FORCE

links:
	@$(LN) .src/*.$(SECT) .src/*links .
