Don't remove Makefile.in when doing maintainer-clean.
[ganeti-local] / man / Makefile.am
1 # Build man pages
2
3 man_MANS = ganeti.7 ganeti-os-interface.7 gnt-cluster.8 gnt-node.8 gnt-os.8 \
4            gnt-instance.8 ganeti-noded.8 ganeti-watcher.8 gnt-backup.8
5
6 maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
7
8 EXTRA_DIST = ganeti-os-interface.sgml gnt-cluster.sgml gnt-node.sgml \
9              ganeti-watcher.sgml ganeti.sgml gnt-instance.sgml gnt-os.sgml \
10              gnt-backup.sgml ganeti-noded.sgml \
11              footer.sgml $(maninput)
12 CLEANFILES = *.[78]
13 MAINTAINERCLEANFILES = $(maninput)
14
15 # Wrapper around docbook2man to control the output's filename
16 %.in: %.sgml footer.sgml
17         tmpdir=`mktemp -d "./manbuildXXXXXX"` && \
18         docbook2man -o "$$tmpdir" $< && \
19         ok= && \
20         for check in `basename $< .sgml`.{7,8}; do \
21                 if test -f "$$tmpdir/$$check"; then \
22                         mv "$$tmpdir/$$check" $@ && \
23                         ok=1 && \
24                         break; \
25                 fi; \
26         done; \
27         if test -z "$$ok"; then \
28                 echo "Building $@ failed."; \
29                 exit 1; \
30         fi; \
31         rm -rf "$$tmpdir"
32
33 %.7 %.8: %.in Makefile
34         sed -e 's#@LOCALSTATEDIR@#$(localstatedir)#g' < $< > $@