Subject: Re: bug#33022: Generated Makefile builds PROGRAMS before LTLIBRARIES

From: Mathieu Lirzin <[email-masked]>
Date: Fri, 12 Oct 2018 08:56:07 +0200

Hello,

Mohamed Akram <[email-masked]> writes:

> automake’s behavior seems to have changed between 1.15.1 and 1.16.1: 
>
> 1.15.1:
>
> all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h
>
> 1.16.1:
>
> all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS) config.h
>
> This causes an automake file which builds a library and a program that uses that library to fail.
>
> An example can be seen here - https://github.com/codebrainz/morse/issues/1#issuecomment-429200053.

The fact that when running ‘make’ in serial, some prerequisites of a
make rule are built before other ones is undefined behavior.  Relying on
this when running ‘make’ in parallel mode is likely to result in a build
failure.

what needs to be done in ‘codebrainz’ is to add an explicit dependency
between programs and the libraries they depend on. See the following
example from the Automake manual:

     lib_LTLIBRARIES = libgettext.la
     libgettext_la_SOURCES = gettext.c ...

     bin_PROGRAMS = hello
     hello_SOURCES = hello.c ...
     hello_LDADD = libgettext.la

Does it help?

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37