Subject: bug#20894: make libgnu.a doesn't generate everything it requires

From: Paul Eggert <[email-masked]>
Date: Wed, 24 Jun 2015 23:39:26 -0700

> 'make libgnu.a' doesn't generate the lib/ version of fcntl.h, which is
> what defines O_BINARY.
>
> In contrast, 'make all' (in lib) does.

That's a known problem with Automake, when dependency checking is turned on. 
The short version is that it can't compute dependencies until it has the .h 
files, and it can't make the .h files until it knows the dependencies.  The 
usual workaround is BUILT_SOURCES, but as the Automake manual says in 
<http://www.gnu.org/software/automake/manual/html_node/Sources.html>:

=====
It might be important to emphasize that BUILT_SOURCES is honored only by ‘make 
all’, ‘make check’ and ‘make install’. This means you cannot build a specific 
target (e.g., ‘make foo’) in a clean tree if it depends on a built source. 
However it will succeed if you have run ‘make all’ earlier, because accurate 
dependencies are already available.
=====

Ways to work around this issue are described in 
<http://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html>. 
  They are all a bit of a pain, though, and the simplest thing is probably to 
say “don't try to make libgnu.a by hand without doing an ordinary make first”....

> (I would like 'make -C src emacs' to work).

*That* we can arrange.

> Perhaps it should call 'make -C lib all' instead (an Emacs issue);

Yes, that's an easy way to arrange things.  I installed that as part of commit 
319eeeb0fb154a0cd1d36ec33c68029ff9d6c290.  Good enough?