Hi,
I am seeking advice for a workaround of what seems like a limitation
in Automake (1.12.2).
We have recently added figures to Bison's documentation. These figures
are included by our texinfo source by using "@image", which requires
different image formats depending on what we want to produce. For
convenience's sake, these figures are generated from Graphviz DOT
files, so we tried adding the following to our doc/local.mk:
doc/bison.dvi: $(FIGS_DOT:.dot=.eps)
doc/bison.html: $(FIGS_DOT:.dot=.png)
doc/bison.pdf: $(FIGS_DOT:.dot=.pdf)
However, these overwrite Automake's rules. This seems a bit similar,
in that regard, to the issue discussed here:
http://lists.gnu.org/archive/html/automake/2012-11/msg00015.html
(Note that in another branch we are using multiple Makefiles, and in
that branch adding the previous lines to our doc/Makefile.am has the
desired effect, though I am not sure why... is this a bug or a
feature?)
The best solution we could come up with was to add these to
doc_bison_TEXINFOS, as follows, but this is a bit troublesome as it
causes the regeneration of all three filetypes whenever a
documentation is built, even when none is actually required (e.g. for
'make info' which uses .txt versions):
doc_bison_TEXINFOS = \
$(CROSS_OPTIONS_TEXI) \
doc/fdl.texi \
- doc/gpl-3.0.texi
+ doc/gpl-3.0.texi \
+ $(FIGS_DOT:.dot=.eps) \
+ $(FIGS_DOT:.dot=.png) \
+ $(FIGS_DOT:.dot=.pdf)
If it is not possible to add custom dependencies to these Automake
rules, what whould you recommend doing?
FWIW, I have attached a diff showing the rules being overwritten by
the prior "solution".
Thanks!
--- /tmp/Makefile 2012-12-06 15:33:29.469105426 +0100
+++ _build/Makefile 2012-12-06 16:35:35.772540139 +0100
@@ -2223,7 +2223,10 @@
doc_bison_TEXINFOS = \
$(CROSS_OPTIONS_TEXI) \
doc/fdl.texi \
- doc/gpl-3.0.texi
+ doc/gpl-3.0.texi \
+ $(FIGS_DOT:.dot=.eps) \
+ $(FIGS_DOT:.dot=.png) \
+ $(FIGS_DOT:.dot=.pdf)
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d
CLEANDIRS = doc/bison.t2d doc/figs doc/html
@@ -3989,6 +3992,30 @@
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
rm -rf $$backupdir; exit $$rc
+
+doc/bison.dvi: doc/bison.texi $(srcdir)/doc/version.texi $(doc_bison_TEXINFOS) doc/$(am__dirstamp)
+ $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
+ $(TEXI2DVI) $(AM_V_texinfo) --clean -o $@ `test -f 'doc/bison.texi' || echo '$(srcdir)/'`doc/bison.texi $(AM_V_texidevnull)
+
+doc/bison.pdf: doc/bison.texi $(srcdir)/doc/version.texi $(doc_bison_TEXINFOS) doc/$(am__dirstamp)
+ $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
+ $(TEXI2PDF) $(AM_V_texinfo) --clean -o $@ `test -f 'doc/bison.texi' || echo '$(srcdir)/'`doc/bison.texi $(AM_V_texidevnull)
+
+doc/bison.html: doc/bison.texi $(srcdir)/doc/version.texi $(doc_bison_TEXINFOS) doc/$(am__dirstamp)
+ $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp)
+ $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
+ -o $(@:.html=.htp) `test -f 'doc/bison.texi' || echo '$(srcdir)/'`doc/bison.texi; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
$(srcdir)/doc/version.texi: $(srcdir)/doc/stamp-vti
$(srcdir)/doc/stamp-vti: doc/bison.texi $(top_srcdir)/configure
test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp)
@@ -5040,10 +5067,6 @@
fi
$(AM_V_at)rm -f $@*.t
-doc/bison.dvi: $(FIGS_DOT:.dot=.eps)
-doc/bison.html: $(FIGS_DOT:.dot=.png)
-doc/bison.pdf: $(FIGS_DOT:.dot=.pdf)
-
.dot.eps:
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp