[gmx-developers] bad sed expression in share/template/Makefile.am

Mark Abraham Mark.Abraham at anu.edu.au
Sat Nov 14 02:29:00 CET 2009


Ake Sandgren wrote:
> On Sat, 2009-11-14 at 09:46 +1100, Mark Abraham wrote:
>> Ake Sandgren wrote:
>>> On Fri, 2009-11-13 at 11:31 +1100, Mark Abraham wrote:
>>>> Ake Sandgren wrote:
>>>>> Hi!
>>>>>
>>>>> The sed in share/template/Makefile.am uses "," as separator. This is bad
>>>>> since LDFLAGS and others might contains things like -Wl,-rpath and other
>>>>> things with "," in them. "#" is usually a better choice.
>>>> Using "," as a sed separator seems to be standard practice with the 
>>>> autotools. From autoconf docs:
>>>>
>>>> "When using sed, don't use -e except for indenting purpose. With the s 
>>>> command, the preferred separator is `/' unless `/' itself is used in the 
>>>> command, in which case you should use `,'. "
>>>>
>>>> Wouldn't "#" get interpreted as a Makefile comment?
>>> Nope, it's within single-quotes.
>> True... but on the converse, many's the time I've been playing with 
>> xxFLAGS arguments and just commented out the last bunch to see the 
>> effect... that'll break the sed line as well.
> 
> Nope, because the comment will not be part of the variable.
> As can be seen in this small makefile snippet (if this is what you meant
> by commenting out the last bunch)
> =========
> xxFLAG=-O1 -g -Wl,-rpath,/some-path # -someflag
> 
> all:
> 	@echo "xxFLAG=@xxFLAG@" | sed 's#@xxFLAG@#$(xxFLAG)#'
> =========

Ah yes... the variable assignment creates an interpreted replacement (so 
the comment is stripped), not a textual replacement. Too much 
Tcl-thinking, sorry!

Mark




More information about the gromacs.org_gmx-developers mailing list