GNU bug report logs - #13104
Extending automake rules w.r.t dependencies

Previous Next

Package: automake;

Reported by: "Theophile Ranquet" <ranquet <at> lrde.epita.fr>

Date: Thu, 6 Dec 2012 17:07:02 UTC

Severity: wishlist

Full log


Message #14 received at 13104 <at> debbugs.gnu.org (full text, mbox):

From: "Theophile Ranquet" <ranquet <at> lrde.epita.fr>
To: "Nick Bowler" <nbowler <at> elliptictech.com>
Cc: Theophile Ranquet <ranquet <at> lrde.epita.fr>, 13104 <at> debbugs.gnu.org
Subject: Re: bug#13104: Extending automake rules w.r.t dependencies
Date: Fri, 7 Dec 2012 10:46:01 +0100 (CET)
> Hello,

Hi,

> The usual workaround to add prerequisites to an automake-generated
> rule is to use a one-off make variable for the target name.  For
> example,
>
>   doc_bison_dvi = doc/bison.dvi
>   $(doc_bison_dvi): $(FIGS_DOT:.dot=.eps)
>
> and so on.  Automake does a simple string comparison of the target name
> to decide whether or the generated rule is overridden, so using a
> variable will hide the "real" target name from this check.  Note that
> this is only appropriate for rules with no commands.

We did something similar, with a little tweak because using three
variables seemed a bit of an overkill:

commit 476af12837af129d36b302e30789c549c85fdadb
Author: Theophile Ranquet <ranquet <at> lrde.epita.fr>
Date:   Tue Dec 4 16:09:24 2012 +0100

    doc: fix build dependencies

    * doc/local.mk: Avoid overwriting Automake's rules.

diff --git a/doc/local.mk b/doc/local.mk
index aaea996..cef4448 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -20,7 +20,14 @@ doc_bison_TEXINFOS =                            \
   doc/fdl.texi                                  \
   doc/gpl-3.0.texi

-TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d
+# Cannot express dependencies directly on file names because of Automake.
+# Obfuscate with a variable.
+doc_bison = doc/bison
+$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps)
+$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf)
+$(doc_bison).html: $(FIGS_DOT:.dot=.html)
+
+TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
 CLEANDIRS = doc/bison.t2d
 clean-local:
 	rm -rf $(CLEANDIRS)
@@ -123,10 +130,6 @@ EXTRA_DIST +=								\
   $(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
 SUFFIXES += .dot .eps .pdf .png

-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



> Hope that helps,

It did, thanks!





This bug report was last modified 4 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.