Re: Portable Use of Variables

2014-11-11 Thread fr33domlover
On 2014-10-27
Eric Blake ebl...@redhat.com wrote:

 On 10/27/2014 11:11 AM, Nick Bowler wrote:
  On 2014-10-26 22:15 +0200, fr33domlover wrote:
  I'm a bit confused about all the expressive features and ways to use
  makefile variables, so just to be sure -
 
  http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html
 
  Are these uses of variables portable, or should a portable Makefile.am use
  only the plain $(var) form without the tricks?
  
  The first form of expansion on that page, $(var:.a=.b), should be OK.
  They are standard in POSIX and work on all make implementations that I
  know of.
  
  The version with % characters is not portable.
 
 That said, POSIX is hoping to standardize it in the next few years:
 
 http://austingroupbugs.net/view.php?id=519
 

Hmmm I was sure it's portable because `make distcheck` doesn't complain about
the %s, and I'm using -Werror and -Wall automake flags. How bad is it? I
suppose it's not specific to just GNU make alone?


signature.asc
Description: PGP signature


Re: Portable Use of Variables

2014-11-11 Thread Eric Blake
On 11/11/2014 10:59 AM, fr33domlover wrote:

 The first form of expansion on that page, $(var:.a=.b), should be OK.
 They are standard in POSIX and work on all make implementations that I
 know of.

 The version with % characters is not portable.

 That said, POSIX is hoping to standardize it in the next few years:

 http://austingroupbugs.net/view.php?id=519

 
 Hmmm I was sure it's portable because `make distcheck` doesn't complain about
 the %s, and I'm using -Werror and -Wall automake flags. How bad is it? I
 suppose it's not specific to just GNU make alone?

automake can't warn about all non-portable aspects, although patches to
make it warn about more cases would be welcome.  And the fact that POSIX
is planning to standardize % substitutions in make is a sign that
existing implementations that already support it are in agreement (more
than just GNU make), so if you want to be on the leading edge of the
curve, you aren't excluding that many users.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: Portable Use of Variables

2014-10-27 Thread Nick Bowler
On 2014-10-26 22:15 +0200, fr33domlover wrote:
 I'm a bit confused about all the expressive features and ways to use makefile
 variables, so just to be sure -
 
 http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html
 
 Are these uses of variables portable, or should a portable Makefile.am use 
 only
 the plain $(var) form without the tricks?

The first form of expansion on that page, $(var:.a=.b), should be OK.
They are standard in POSIX and work on all make implementations that I
know of.

The version with % characters is not portable.

Hope that helps,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



Re: Portable Use of Variables

2014-10-27 Thread Eric Blake
On 10/27/2014 11:11 AM, Nick Bowler wrote:
 On 2014-10-26 22:15 +0200, fr33domlover wrote:
 I'm a bit confused about all the expressive features and ways to use makefile
 variables, so just to be sure -

 http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html

 Are these uses of variables portable, or should a portable Makefile.am use 
 only
 the plain $(var) form without the tricks?
 
 The first form of expansion on that page, $(var:.a=.b), should be OK.
 They are standard in POSIX and work on all make implementations that I
 know of.
 
 The version with % characters is not portable.

That said, POSIX is hoping to standardize it in the next few years:

http://austingroupbugs.net/view.php?id=519

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Portable Use of Variables

2014-10-26 Thread fr33domlover
Hello,


I'm a bit confused about all the expressive features and ways to use makefile
variables, so just to be sure -

http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html

Are these uses of variables portable, or should a portable Makefile.am use only
the plain $(var) form without the tricks?



I'm adapting the doxygen Makefile.am from gtkmm (GTK+ C++ binding) for my use,
but they use text functions and variable features a lot with -no-portability,
so I'm trying to make it work with -Wall -Werror. I hope it's worth the
effort :-) Just trying to have a clean makefile...



-- fr33