1# $OpenLDAP$
2## This work is part of OpenLDAP Software <http://www.openldap.org/>.
3##
4## Copyright 1998-2011 The OpenLDAP Foundation.
5## All rights reserved.
6##
7## Redistribution and use in source and binary forms, with or without
8## modification, are permitted only as authorized by the OpenLDAP
9## Public License.
10##
11## A copy of this license is available in the file LICENSE in the
12## top-level directory of the distribution or, alternatively, at
13## <http://www.OpenLDAP.org/license.html>.
14##---------------------------------------------------------------------------
15#
16# Makefile Template for Manual Pages
17#
18
19MANDIR=$(mandir)/man$(MANSECT)
20TMP_SUFFIX=tmp
21
22all-common:
23	PAGES=`cd $(srcdir); echo *.$(MANSECT)`; \
24	for page in $$PAGES; do \
25		$(SED) -e "s%LDVERSION%$(VERSION)%" \
26			-e 's%ETCDIR%/etc/openldap%' \
27			-e 's%LOCALSTATEDIR%/var/db/openldap%' \
28			-e 's%SYSCONFDIR%/etc/openldap%' \
29			-e 's%DATADIR%$(datadir)%' \
30			-e 's%SBINDIR%/usr/sbin%' \
31			-e 's%BINDIR%$(bindir)%' \
32			-e 's%LIBDIR%$(libdir)%' \
33			-e 's%LIBEXECDIR%/usr/libexec%' \
34			-e 's%RELEASEDATE%$(RELEASEDATE)%' \
35				$(srcdir)/$$page \
36			| (cd $(srcdir); $(SOELIM) -) > $$page.$(TMP_SUFFIX); \
37	done
38
39install-common:
40	-$(MKDIR) $(DESTDIR)$(MANDIR)
41	PAGES=`cd $(srcdir); echo *.$(MANSECT)`; \
42	for page in $$PAGES; do \
43		echo "installing $$page in $(DESTDIR)$(MANDIR)"; \
44		$(RM) $(DESTDIR)$(MANDIR)/$$page; \
45		$(INSTALL) $(INSTALLFLAGS) -m 644 $$page.$(TMP_SUFFIX) $(DESTDIR)$(MANDIR)/$$page; \
46		if test -f "$(srcdir)/$$page.links" ; then \
47			for link in `$(CAT) $(srcdir)/$$page.links`; do \
48				echo "installing $$link in $(DESTDIR)$(MANDIR) as link to $$page"; \
49				$(RM) $(DESTDIR)$(MANDIR)/$$link ; \
50				$(LN_S) $(DESTDIR)$(MANDIR)/$$page $(DESTDIR)$(MANDIR)/$$link; \
51			done; \
52		fi; \
53	done
54
55clean-common:   FORCE
56	$(RM) *.tmp all-common
57
58Makefile: $(top_srcdir)/build/man.mk
59