diff --git a/man/Makefile.am b/man/Makefile.am
index 4b6a410b9026d5733eb42fd604ada71ff5667887..accd08905f5c1bb9d57dfedc53d4e9d96287abc4 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -3,12 +3,33 @@
 man_MANS = ganeti.7 ganeti-os-interface.7 gnt-cluster.8 gnt-node.8 gnt-os.8 \
 	   gnt-instance.8 ganeti-noded.8 ganeti-watcher.8 gnt-backup.8
 
+maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
+
 EXTRA_DIST = ganeti-os-interface.sgml gnt-cluster.sgml gnt-node.sgml \
 	     ganeti-watcher.sgml ganeti.sgml gnt-instance.sgml gnt-os.sgml \
 	     gnt-backup.sgml ganeti-noded.sgml \
-	     footer.sgml $(man_MANS)
-MAINTAINERCLEANFILES = *.[78]
+	     footer.sgml $(maninput)
+CLEANFILES = *.[78]
+MAINTAINERCLEANFILES = *.in
+
+# Wrapper around docbook2man to control the output's filename
+%.in: %.sgml footer.sgml
+	tmpdir=`mktemp -d "./manbuildXXXXXX"` && \
+	mkdir "$$tmpdir" && \
+	docbook2man -o "$$tmpdir" $< && \
+	ok= && \
+	for check in `basename $< .sgml`.{7,8}; do \
+		if test -f "$$tmpdir/$$check"; then \
+			mv "$$tmpdir/$$check" $@ && \
+			ok=1 && \
+			break; \
+		fi; \
+	done; \
+	if test -z "$$ok"; then \
+		echo "Building $@ failed."; \
+		exit 1; \
+	fi; \
+	rm -rf "$$tmpdir"
 
-%.7 %.8: %.sgml footer.sgml
-	docbook2man $<
-	rm -f manpage.links manpage.refs
+%.7 %.8: %.in Makefile
+	sed -e 's#@LOCALSTATEDIR@#$(localstatedir)#g' < $< > $@
diff --git a/man/ganeti-watcher.sgml b/man/ganeti-watcher.sgml
index e5973e7e7afab6f04f76c8da0d03f629aaa50ddb..8c630d0ccd95e299586cc3c05f70cd5c6e52afcc 100644
--- a/man/ganeti-watcher.sgml
+++ b/man/ganeti-watcher.sgml
@@ -62,9 +62,9 @@
 
     <para>
       The command has a state file located at
-      <filename>/var/lib/ganeti/restart_state</filename> and a log
+      <filename>@LOCALSTATEDIR@/lib/ganeti/restart_state</filename> and a log
       file at
-      <filename>/var/log/ganeti/watcher.log</filename>. Removal of
+      <filename>@LOCALSTATEDIR@/log/ganeti/watcher.log</filename>. Removal of
       either file will not affect correct operation; the removal of
       the state file will just cause the restart counters for the
       instances to reset to zero.