automake
[Top][All Lists]
Advanced

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

Re: _SHORTNAME in conditional


From: Thomas Martitz
Subject: Re: _SHORTNAME in conditional
Date: Wed, 6 Jan 2016 08:31:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

Am 05.01.2016 um 22:05 schrieb Thomas Martitz:
Hello,

Given this fragment:

bin_PROGRAMS = false true
true_SOURCES = false.c
true_CFLAGS = -DAM_TRUE
true_SHORTNAME = t
if FOO
false_SOURCES = false.c
false_CFLAGS = -DAM_FALSE
false_SHORTNAME = f
endif

I receive a warning for false_SHORTNAME:
Makefile.am:9: warning: automake does not support false_SHORTNAME being defined conditionally

What does that mean? Why is it unsupported? Other variables work just fine.

This is a problem for me, because I'm trying to construct the following:

root/Makefile.am:
if ENABLE_FOO
include foo/Makefile.inc
endif

root/foo/Makefile.inc
bin_PROGRAMS = foo
foo_SOURCES = foo.c
foo_SHORTNAME = foo

As of now, there is no way to achieve that as the warning also appears for foo_SHORTNAME. The workaround to move the conditional into root/foo/Makefile.inc is ugly and breaks modularization of the project.

Automake source code is a myth to me, I wasn't able to find the code that implements this limitation (only the place where the warning is printed (variable_value() => $self->check_defined_unconditionally in Variable.pm)

To give some more context: the root issue I'm trying to resolve is that object filenames are constructed from the paths leading to it, even for subdir-objects.

I.e.
in a sub-Makefile.am
bin_PROGRAMS += %D%/foo
%C%_foo_SOURCES = foo.c

The object file will be called path_to_foo-foo.o. I do not want this, I want the file to be just called foo-foo.o. I ensure via subdir-objects that everything is unique.

Why do I want to avoid the standard object filename? I also construct a Makefile in the foo subdirectory. This is so that I can run make in the root directory and also in root/foo. In both make invocations, the same object file shall be created. This only works if the object filename does not include the path that leads to the object file.

This scheme works fine with %C%_foo_SHORTNAME unless I want to conditionally build the foo subdirectory in which case the warning.

I guess this means there is another viable solution to my root problem. Instead of having to use _SHORTNAME I could envision an automake option that surpresses the object filename construction like above and only uses the foo part of %C%_foo_SOURCES.

PS: Please don't suggest recursive automake, this is what I'm actually trying to get away from.

Best regards.



reply via email to

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