Re: Is it possible to extend the built-in dependency tracking?

Jacob Bachmeyer <[email protected]> Mon, 28 Jul 2025 21:11:54 -0500
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <[email protected]>
On 7/28/25 17:28, Tomas Volf wrote:
> [...]
>
> 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.

You seem to be recording the names tried during a path search instead of 
the files that actually exist.  That will not work because make requires 
every listed dependency of a target to exist.

A crazy option occurs to me, but I think it only works in GNU make:  
$(wildcard ...) effectively filters a list of files to only those that 
actually exist.

> 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.

In this case, you probably need to list only the other .go files as 
dependencies and use this suffix rule to supply the further dependency 
on the corresponding .scm file.


Just my guesses towards a solution,


-- Jacob