automake
[Top][All Lists]
Advanced

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

Re: dashes in Makefile macro names


From: Stefano Lattarini
Subject: Re: dashes in Makefile macro names
Date: Fri, 28 Jan 2011 21:55:18 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

[dropping bug-autoconf]

Hello Ralf.

I like the proposed change (assuming the testsuite still passes ;-)

But there's a minor mistake in your testsuite addition, and I also
have a couple small unrelated nits/suggestions ...

> new file mode 100755
> index 0000000..3ba803f
> --- /dev/null
> +++ b/tests/minusvar.test
>
I know this is mostly bikeshedding, and that you're probably going to
disagree, but I have to ask: wouldn't a name like `varname-dash.test',
or even `varname-with-dash.test', be clearer?

> @@ -0,0 +1,58 @@
> +#!/bin/sh
> +# Copyright (C) 2011 Free Software Foundation, Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2, or (at your option)
> +# any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +# Ensure automake allows and understand '-' in variable names.
> +
> +required=cc
>
Here's the mistake: we don't have a meaningful 'cc' requirement yet :-(

> +. ./defs || Exit 1
> +
> +cat >>configure.in <<\END
> +AC_PROG_CC
> +AC_OUTPUT
> +END
> +
> +cat >Makefile.am <<\END
> +var- = 1
> +var2 = $(var-)
> +var-3 = 3
> +var4 = $(var-3)
> +three = 3
> +#var5 = $(var-$(three))
>
Did you deliberately omit testing also something like `$(-var)' here?
(Note: I'm really not sure whether that would make sense, just asking).

And, should maybe we also check for usages like:
  foo-bar = a-b
  foo_SOURCES = $(foo-bar:a-b=foo.c)
to ensure that the parser is not unduly confused?

> +prog-s = foo bar-s
> +bar_s_SOURCES = bar.c
> +bin_PROGRAMS = $(prog-s)
> +
> +test:
> +     @echo $(var-)$(var2)$(var-3)$(var4)$(var5)
> +END
> +
Why don't use simply:

  test:
        test x'$(var-)$(var2)$(var-3)$(var4)$(var5)' = x'11333'

here ...

> +cat >foo.c <<\END
> +int main (void) { return 0; }
> +END
> +cp foo.c bar.c
> +
> +$ACLOCAL
> +$AUTOMAKE
> +sed 's/^#//' Makefile.am > t
> +mv -f t Makefile.am
> +$AUTOMAKE -Wno-portability
> +$AUTOCONF
> +./configure
>
> +$MAKE test >stdout || { cat stdout; Exit 1; }
> +grep 11333 stdout
>
... so that this can become simply "$MAKE test"?

(Also, I'd declare the 'test' target in Makefile.am as `.PHONY',
but I'm being really really nitpicking with this suggestion, so
feel free to ignore it).

> +$MAKE
> +
> +:
> 
> 

Thanks,
  Stefano



reply via email to

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