automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AM_CFLAGS and %reldir%


From: Thomas Martitz
Subject: AM_CFLAGS and %reldir%
Date: Fri, 5 May 2017 08:59:42 +0200

Hello,


when transitioning a project to non-recursive Automake, using %reldir%, you lose the ability to define per-directory AM_{CPP,C,CXX,LD}FLAGS.

With recursive Automake, you can simply set AM_CFLAGS in each Makefile.am. Attempting the same in a non-recursive setup would modify the single, global AM_CFLAGS, which may not be desirable.

The only solution seems to be to heavily expand the fragments:

AM_CFLAGS = -g

bin_PROGRAMS = foo bar baz

becomes

bin_PROGRAMS += %D%/foo %D%/bar %D%/baz

%C_foo_CFLAGS = -g

%C_bar_CFLAGS = -g

%C_baz_CFLAGS = -g

(repeat for AM_CPPFLAGS, AM_CXXFLAGS, AM_LDFLAGS).

This gets unwieldy in cases of many programs and libraries. As a side effect, Automake will emit explicit rules, making the Makefile even larger, though that's not much of a problem I think and is probably not avoidable.

Is there any other solution available? I have tried to define directory-level AM_CFLAGS, like

AM_%C%_CFLAGS = -g

(applying to all targets that start with %C% after expanding) but they are not used.


If there are no other solutions, would the above idea considered if someone posted a patch?

Best regards.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]