automake
[Top][All Lists]
Advanced

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

Re: [RFC v2] new option: object-shortname


From: Thomas Martitz
Subject: Re: [RFC v2] new option: object-shortname
Date: Fri, 8 Jan 2016 16:47:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

Am 08.01.2016 um 16:03 schrieb Gavin Smith:
On 8 January 2016 at 14:33, Gavin Smith <address@hidden> wrote:
Failing that, it would be better for conditional SHORTNAME to work,
instead of adding a new option.

For example:

--- automake-orig       2016-01-08 14:54:04.000000000 +0000
+++ /home/g/local/bin/automake  2016-01-08 15:06:06.000000000 +0000
@@ -1749,11 +1749,18 @@
                 my $var = var ($derived . '_SHORTNAME');
                 if ($var)
                 {
-                   # FIXME: should use the same Condition as
-                   # the _SOURCES variable.  But this is really
-                   # silly overkill -- nobody should have
-                   # conditional shortnames.
-                   $dname = $var->variable_value;
+                    # Use the same Condition as the _SOURCES variable.
+                    my $sources_var = var ($derived . '_SOURCES');
+                    if ($sources_var) {
+                      my @conds = $sources_var->conditions->conds;
+                      if (@conds) {
+                        my $cond = $conds[0];
+                        my $def = $var->def($cond);
+                        if ($def) {
+                          $dname = $def->value;
+                        }
+                      }
+                    }
                 }
                 $object = $dname . '-' . $object;



What does Makefile.in look like with that? I found that _SHORTNAME is evaluated at automake-time which is probably the reason it's not supported in a conditional. I didn't think it would be feasible to make _SHORTNAME work (not for me anyway, I'm completely new to automake's source code).

I'd still prefer the option because it has the bonus of avoiding repetitions like the following all over the place:

bin_PROGRAMS += foo
foo_SHORTNAME = foo

Thank you anyway!



reply via email to

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