Commit 942d6128 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

build: Turn dot into a "proper" maintainer program

The --enable-maintainer-mode option has been used in autogen.des for a
while now and it has allowed automatic reconfiguration and hot reload of
makefiles.

For the next step, we can turn certain programs into maintainer programs
and only require them when they are absolutely needed. This is what we
currently do with SVG files generated from dot files, checked in git and
optionally required, with an error message when rebuild is not possible.

It turns out we only need 3 lines in configure.ac to implement all that,
with the following differences:

- no more `./configure --with-dot[=...]` option
  - use `./configure DOT=...` to override the default `dot` command
  - or alternatively run configure with `DOT=...` in the environment
- generic missing error message (but referencing dot) from make
- no need to reconfigure once `dot` is in the PATH

The DOT override is actually documented in `./configure --help` like the
`--with-dot[=...]` option was.

While dot is our most emblematic maintainer tool, with its build targets
checked in all the way in the git repository, this could be applied to
other maintainer programs like sphinx-build and rst2man that should not
be required when building from a dist archive.
parent 8f2cfe92
...@@ -85,19 +85,8 @@ witness.dot: all ...@@ -85,19 +85,8 @@ witness.dot: all
lib/libvmod_*/ lib/libvmod_*/
.dot.svg: .dot.svg:
if ! HAVE_DOT
@echo ==================================================
@echo You need graphviz installed to generate svg output
@echo ==================================================
@false
else
$(AM_V_GEN) $(DOT) -Tsvg $< >$@ $(AM_V_GEN) $(DOT) -Tsvg $< >$@
endif
if HAVE_DOT
witness: witness.svg witness: witness.svg
else
witness: witness.dot
endif
.PHONY: cscope witness.dot .PHONY: cscope witness.dot
...@@ -79,16 +79,9 @@ if test "x$RST2HTML" = "xno"; then ...@@ -79,16 +79,9 @@ if test "x$RST2HTML" = "xno"; then
[rst2html not found - (Weird, we found rst2man?!)]) [rst2html not found - (Weird, we found rst2man?!)])
fi fi
AC_ARG_WITH([dot], AC_ARG_VAR([DOT], [The dot program from graphviz to build SVG graphics])
AS_HELP_STRING([--with-dot=PATH], AM_MISSING_PROG([DOT], [dot])
[Location of the dot tool from graphviz (auto)]), AC_CHECK_PROGS([DOT], [dot])
[DOT="$withval"],
[AC_CHECK_PROGS(DOT, [dot], [no])
if test "x$DOT" = "xno"; then
AC_MSG_WARN(
[dot not found - build will fail if svg files are out of date.])
fi])
AM_CONDITIONAL(HAVE_DOT,[test "x$DOT" != "xno"])
# Define VMOD flags # Define VMOD flags
_VARNISH_VMOD_LDFLAGS _VARNISH_VMOD_LDFLAGS
......
...@@ -35,10 +35,8 @@ SVGS = \ ...@@ -35,10 +35,8 @@ SVGS = \
cache_req_fsm.svg \ cache_req_fsm.svg \
cache_fetch.svg cache_fetch.svg
if HAVE_DOT
CLEANFILES = \ CLEANFILES = \
$(PDFS) $(PDFS)
endif
pdf: $(PDFS) pdf: $(PDFS)
...@@ -46,31 +44,10 @@ html: $(SVGS) link_srcdir ...@@ -46,31 +44,10 @@ html: $(SVGS) link_srcdir
# XXX does not fit onto a4 unless in landscape # XXX does not fit onto a4 unless in landscape
cache_fetch.pdf: cache_fetch.dot cache_fetch.pdf: cache_fetch.dot
if ! HAVE_DOT $(AM_V_GEN) $(DOT) -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@
@echo ==================================================
@echo You need graphviz installed to generate pdf output
@echo ==================================================
@false
else
@DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@
endif
.dot.pdf: .dot.pdf:
if ! HAVE_DOT $(AM_V_GEN) $(DOT) -Tpdf -Gsize=$(SIZE) $< >$@
@echo ==================================================
@echo You need graphviz installed to generate pdf output
@echo ==================================================
@false
else
@DOT@ -Tpdf -Gsize=$(SIZE) $< >$@
endif
.dot.svg: .dot.svg:
if ! HAVE_DOT $(AM_V_GEN) $(DOT) -Tsvg $< >$@
@echo ==================================================
@echo You need graphviz installed to generate svg output
@echo ==================================================
@false
else
@DOT@ -Tsvg $< >$@
endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment