]> git.sur5r.net Git - openldap/blob - build/man.mk
c2ecc5863f95d9e15c27d3733e2b14819e73fadf
[openldap] / build / man.mk
1 # $OpenLDAP$
2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
3 ##
4 ## Copyright 1998-2017 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
19 MANDIR=$(mandir)/man$(MANSECT)
20 TMP_SUFFIX=tmp
21
22 all-common:
23         PAGES=`cd $(srcdir); echo *.$(MANSECT)`; \
24         for page in $$PAGES; do \
25                 $(SED) -e "s%LDVERSION%$(VERSION)%" \
26                         -e 's%ETCDIR%$(sysconfdir)%g' \
27                         -e 's%LOCALSTATEDIR%$(localstatedir)%' \
28                         -e 's%SYSCONFDIR%$(sysconfdir)%' \
29                         -e 's%DATADIR%$(datadir)%' \
30                         -e 's%SBINDIR%$(sbindir)%' \
31                         -e 's%BINDIR%$(bindir)%' \
32                         -e 's%LIBDIR%$(libdir)%' \
33                         -e 's%LIBEXECDIR%$(libexecdir)%' \
34                         -e 's%MODULEDIR%$(moduledir)%' \
35                         -e 's%RELEASEDATE%$(RELEASEDATE)%' \
36                                 $(srcdir)/$$page \
37                         | (cd $(srcdir); $(SOELIM) -) > $$page.$(TMP_SUFFIX); \
38         done
39
40 install-common:
41         -$(MKDIR) $(DESTDIR)$(MANDIR)
42         PAGES=`cd $(srcdir); echo *.$(MANSECT)`; \
43         for page in $$PAGES; do \
44                 echo "installing $$page in $(DESTDIR)$(MANDIR)"; \
45                 $(RM) $(DESTDIR)$(MANDIR)/$$page; \
46                 $(INSTALL) $(INSTALLFLAGS) -m 644 $$page.$(TMP_SUFFIX) $(DESTDIR)$(MANDIR)/$$page; \
47                 if test -f "$(srcdir)/$$page.links" ; then \
48                         for link in `$(CAT) $(srcdir)/$$page.links`; do \
49                                 echo "installing $$link in $(DESTDIR)$(MANDIR) as link to $$page"; \
50                                 $(RM) $(DESTDIR)$(MANDIR)/$$link ; \
51                                 $(LN_S) $(DESTDIR)$(MANDIR)/$$page $(DESTDIR)$(MANDIR)/$$link; \
52                         done; \
53                 fi; \
54         done
55
56 clean-common:   FORCE
57         $(RM) *.tmp all-common
58
59 Makefile: $(top_srcdir)/build/man.mk