On Sun, Jun 30, 2024, at 4:28 PM, Karl Berry wrote:
...
> introspection/%.h: introspection/%.c
>       $()
...
> As an aside, I'm curious as to why the $() is used. It seems
> a mysterious way to do nothing. Do you know?

I don't know why someone chose to do it this way, but I do know that
GCC's Makefiles do something similar with

# gen-foo generates both foo.h and foo.c at the same time
foo.c: gen-foo other files...
        $(builddir)gen-foo arguments...

# clue Make that gen-foo also updated foo.h whenever foo.c is new
foo.h: foo.c
        @:

If I had to guess, I would guess that someone thought Make would be more
likely to skip invoking a shell if the command was actually empty rather
than ":".  As it happens, GNU Make 4.4.1 appears to recognize ":" as a
no-op; using strace I see it issue the same number of forks for both
constructs.  But perhaps older versions of gnumake did not do this.
(This is clearly not a portable makefile to begin with, so questions of
what other implementations do are moot.)

zw

Reply via email to