Karl Berry <k...@freefriends.org> writes:

> [..]
>
> You might like to peruse the second chapter in the automake-history manual:
>   
> https://www.gnu.org/software/automake/history/automake-history.html#Dependency-Tracking-Evolution
>
> The first chapter is automake release history (skip it), but the second
> chapter is all about the different approaches to dependency tracking
> taken in Automake over time.  The (make)Automatic Prerequisites node is
> specifically mentioned; that was the first approach of dependency
> tracking in automake, and it was abandoned, for reasons explained there.
>
> Extending to new languages is mentioned as a possible extension at
> the end of the chapter, but that's all there is, a bare mention.

So, after some more experimentation, I am currently stuck on the "the
tool should generate a dependency for each probe" recommendation in the
automake-history.  It might work for C, but for Guile I have no idea how
to do it.

Roughly speaking, each module in Guile usually has a single .scm file
(the source code) and single .go file (the compiled version).  During
compilation, the compiler reads the .scm file to compile and the .scm
files of all its dependencies.  For the dependencies, the matching .go
files are read as well, if they exist.  Here lies the problem.  Since I
am trying to track all probes the compiler does, the generated Makefile
looks roughly like this:

--8<---------------cut here---------------start------------->8---
dep-test.go: \
 /lib/guile/3.0/ccache/dep-test/a.go \
 /lib/guile/3.0/ccache/dep-test/b.go \
 /share/guile/site/3.0/dep-test/a.scm \
 /share/guile/site/3.0/dep-test/b.scm \
 /home/user/test/dep-test/a.go \
 /home/user/test/dep-test/b.go \
 /home/user/test/dep-test/a.scm \
 /home/user/test/dep-test/b.scm
 
/lib/guile/3.0/ccache/dep-test/a.go:
/lib/guile/3.0/ccache/dep-test/b.go:
/home/user/test/dep-test/a.go:
/home/user/test/dep-test/b.go:
--8<---------------cut here---------------end--------------->8---

However, when I try to run make, it tries to make the first .go file and
-- since /lib/guile/3.0/ccache/dep-test/a.scm does not exist -- fails to
do so.

That probably is due to

--8<---------------cut here---------------start------------->8---
.scm.go:
        ...
--8<---------------cut here---------------end--------------->8---

rule I have in my Makefile.am.  I need it, since creating the .go files
is the whole point.  But it seems the make tries to used it to create
all those .go files that were recorded as probes.

Now I am wondering if there is a reasonable way to solve this.  I
probably could drop the suffix rule, and instead generate a rule per the
.go file I actually want to compile.  However I cannot shake the feeling
I am over-engineering it a bit at this point.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Reply via email to