Discussion:
%reldir% in gnulib's Makefile.am
Vivien Kraus
2018-02-18 15:10:54 UTC
Permalink
Hello,

I would like to use gnulib for my autotools-based project. However,
when I want to link the gnulib in my program:

SUBDIRS = lib
bin_PROGRAMS = test
test_LDADD = lib/libgnu.la

make cannot re-build lib/libgnu.la since it is defined in
lib/Makefile.am as the target "libgnu.la" and I have to use a recursive
make rule to rebuild it:

SUBDIRS = lib
    bin_PROGRAMS = test
    test_LDADD = lib/libgnu.la
lib/libgnu.la:
cd lib && $(MAKE) libgnu.la

When I do:

$ make -j 4

lib/libgnu.la is built twice in parallel (once because of SUBDIRS = lib
and once because of the recursive invocation) with some rare weird race
problems.

I have found that automake can include automakefiles in order to avoid
recursive make with %reldir% and %canon_reldir%. Is it possible to
tell gnulib-tool to prepend %reldir%/ and %canon_reldir%_ at the right
places so that I could write:

include lib/Makefile.am
    bin_PROGRAMS = test
    test_LDADD = lib/libgnu.la

Maybe this is an option of gnulib-tool but I could not find it.

So, is it possible to have %reldir%/ and %canon_reldir%_ in gnulib's
generated Makefile.am? How should I proceed otherwise?

Best regards

Vivien

Loading...