how to manage make(1) dependencies on gnulib-generated header files (was: Missing makefile dependencies)

"G. Branden Robinson" <[email protected]> Tue, 28 Jul 2026 13:44:05 -0500
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.printing.groff.general
Message-ID <20260728184405.bbvkueldi6tllteq@illithid>
--5whi3wlvm54ra7mi
Content-Type: text/plain; protected-headers=v1; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: how to manage make(1) dependencies on gnulib-generated header files
 (was: Missing makefile dependencies)
MIME-Version: 1.0

Hi Richard,

I think you've encountered a few distinct problems.  One (the first you
raised), I know I need help with, so I'm adding bug-gnulib at gnu to
this message's distribution.

At 2026-07-28T14:15:12+0100, Richard Purdie wrote:
> I reported some build races a while ago. It appears there are still
> some issues left and they weren't an isolated problem. I tried to make
> a simple reproducer for the original problem I ran into but ran into
> further problems. To illustrate what I saw (on a fresh checkout of
> groff from git):
>=20
> $ make doc/groff-man-pages.pdf
>   CXX      src/preproc/soelim/soelim.o
>   CXX      src/libs/libgroff/libgroff_a-change_lf.o
>   CXX      src/libs/libgroff/libgroff_a-cmap.o
>   CXX      src/libs/libgroff/libgroff_a-color.o
>   CXX      src/libs/libgroff/libgroff_a-cset.o
>   CXX      src/libs/libgroff/libgroff_a-curtime.o
>   CXX      src/libs/libgroff/libgroff_a-device.o
>   CXX      src/libs/libgroff/libgroff_a-errarg.o
>   CXX      src/libs/libgroff/libgroff_a-error.o
>   CXX      src/libs/libgroff/libgroff_a-fatal.o
>   CXX      src/libs/libgroff/libgroff_a-filename.o
>   CXX      src/libs/libgroff/libgroff_a-font.o
> src/libs/libgroff/font.cpp:29:10: fatal error: stdcountof.h: No such file=
 or directory
>    29 | #include <stdcountof.h>
>       |          ^~~~~~~~~~~~~~
> compilation terminated.
> make: *** [Makefile:11167: src/libs/libgroff/libgroff_a-font.o] Error 1
>=20
>=20
> $ make lib/stdcountof.h
>   GEN      lib/stdcountof.h
>=20
>   CC       lib/libgnu_a-c32isalnum.o
> In file included from lib/c32isalnum.c:26:
> lib/c32is-impl.h:35:10: fatal error: unictype.h: No such file or
> directory
>    35 | #include "unictype.h"
>=20
> and so on. I couldn't work out the right way to add dependencies on
> lib/* to src/libs/libgroff.

Understood.  I don't know what the right answer here is, either; which
header files are prerequisites demanding generation is decided by parts
of the "configure" script that Gnulib produces after it has surveyed the
system checking for (in)adequate system headers.

I confess I haven't read more than occasional section of the Gnulib
manual, when some particular module interested me.

Is there an Automake variable I can add as a prerequisite of libgroff.a?

The moral equivalent of:

libgroff.a: $(AM_WHATEVER_HEADERS_GNULIB_BUILDS)

=2E..?

Or maybe libgnu.a should be already declaring this prerequisite, and for
some reason isn't.

Or maybe we need both, since a given groff module might depend either on
symbols in libgnu.a, or macro definitions in a standard C header file,
or both.

I'll address the rest of your questions in a separate message, as I
think they don't involve the Gnulib developers.

Regards,
Branden

--5whi3wlvm54ra7mi
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmpo+G0ACgkQ0Z6cfXEm
bc6QhA//XcN3uNzkEd25c7vWUkaWhrGhsZol9rIIIpcIKxY44OFl+Zd44Dx+cppT
xMQidnVnJsrELFzkOYjbGHEezpHyZVARAR5StXkwGdYxwDLUxuxg0uy5HeRwqRhz
yzSUvSoLk0L2qdVXNHmWwXjXYRiuA6G/dmjVW8ygXIGrnOT+bpJvjedfD46/Jqf6
s4EpogBUEuzblMypqLWlq1HGCOfrBnUktKeEe7rzJ9m/5CXHG8MKkEkAR3sL4YPi
+Tz5pDcPTQsf510GrLVbu6uqqJZW+UAOZo6tOIwNpZ5kuPdPWYxEasv5Mg9zMUZb
XWyk6FCUXMBO3IU2nnrBWzOTDQnhv0hwMAPaSISbfEudusGj0gW0KPFW+1a4MVBm
Dh1+0H8VTO/xwi5aM45kcRy1uFwmVf3Kc2QLqZOj40WKJO+u+8oCWKGY1SChUS67
UdZwUZTBdl3PeFmHulO3+FZMpcHJ1KErRS7tKKUDBp+tDnpHf/4W3XD5wsbbbsFb
GCCdCCVvBw88sFV+UznSLrXtsfEzAXLeMq4+w8iha5thKSuq68EJcybIaHlK/XXf
T/bWslb2tpNB+sA1TI0fTzRVKxbUZC0IhFS9mXxmWNjzCQyBLqQZVN6UftdtRgRv
erSxcWsUD6ANeCD+KtSM2hWXp11R6nICoAu+c8gFSTqJF0zkMj4=
=P923
-----END PGP SIGNATURE-----

--5whi3wlvm54ra7mi--