Touching README and co triggers rebuild of doxygen.
authorNicolas Despres <nicolas.despres@gmail.com>
Mon, 18 Apr 2011 19:31:13 +0000 (21:31 +0200)
committerNicolas Despres <nicolas.despres@gmail.com>
Mon, 18 Apr 2011 19:57:56 +0000 (21:57 +0200)
commit2ab66de40998fe61a834dcbd68aa8c1067c5fcc8
tree011172cee4458906ff46f21a714fc806b84159fb
parent99e0560bdc85fa62273ed82645fef64b3c20c6e6
Touching README and co triggers rebuild of doxygen.

Before the main page was an order-only dependency of the doxygen target.
Thus, modification in the README did not triggers rebuild of the doxygen
target as it ought to be.

We have several ways to fix this issue:

1) Make the '$builddir/doxygen_mainpage' target an explicit dependency:

build $builddir/doxygen_mainpage: doxygen_mainpage \
  README HACKING COPYING | $doxygen_mainpage_generator
build doxygen: doxygen doxygen.config $builddir/doxygen_mainpage

2) Duplicate the explicit dependencies of the '$builddir/doxygen_mainpage'
   target as implicit dependencies of the 'doxygen' target and keep the
   '$builddir/doxygen_mainpage' target as an order-only dependency:

build $builddir/doxygen_mainpage: doxygen_mainpage \
  README HACKING COPYING | $doxygen_mainpage_generator
build doxygen: doxygen doxygen.config \
  | README HACKING COPYING \
  || $builddir/doxygen_mainpage

I chose the first option since the doxygen executable only cares about its
first argument.  But it would not be the case for all commands.  So I
think introducing "slice" support for the $in and $out variables would be
great.  This way I could rewrite the 'doxygen' rule this way:

rule doxygen
  command = doxygen $in[0]
  description = DOXYGEN $in[0]

Note that using variables to avoid duplication does not work since the
three files are seen as a single one:

doxygen_deps = README HACKING COPYING

build $builddir/doxygen_mainpage: doxygen_mainpage \
  $doxygen_deps | $doxygen_mainpage_generator
build doxygen: doxygen doxygen.config \
  | $doxygen_deps \
  || $builddir/doxygen_mainpage

Maybe Ninja's philosophy expects the generators to generate the second
option.
build.ninja