[U-Boot] GNU specific sed argument in rules.mk

Wolfgang Denk wd at denx.de
Wed Jun 29 21:38:00 CEST 2011


Dear Jeroen Hofstee,

In message <4E0B8F82.4000600 at myspectrum.nl> you wrote:
> 
> rules.mk uses the GNU specific sed \w leading to not directly obvious 
> Make / _depend errors in the build process, like circular dependencies 

You should probably mention when such errors result - I have never seen
any of these.

> Current command (gsed = GNU sed, sed = FreeBSD takes \w as w). The first 
> command is not the intention.
> [jeroen at blue ~]$ echo some/example/test.c | sed -e 's/\(.*\)\.\w/\1.o/';
> some/example/test.c
> [jeroen at blue ~]$ echo some/example/test.c | gsed -e 's/\(.*\)\.\w/\1.o/';
> some/example/test.o
> [jeroen at blue ~]$ echo some/example/test.w | sed -e 's/\(.*\)\.\w/\1.o/';
> some/example/test.o
> [jeroen at blue ~]$ echo some/example/test.w | gsed -e 's/\(.*\)\.\w/\1.o/';
> some/example/test.o
> 
> None GNU specific as per GNU docs (fine):
> [jeroen at blue ~]$ echo some/example/test.c | sed -e 
> 's/\(.*\)\.[[:alnum:]_]/\1.o/';
> some/example/test.o
> [jeroen at blue ~]$ echo some/example/test.c | gsed -e 
> 's/\(.*\)\.[[:alnum:]_]/\1.o/';
> some/example/test.o
> 
> or shorter (regex are greedy):
> [jeroen at blue ~]$ echo some/example/test.c | sed -e 's/\(.*\)\..*/\1.o/';
> some/example/test.o
> [jeroen at blue ~]$ echo some/example/test.c | gsed -e 's/\(.*\)\..*/\1.o/';
> some/example/test.o

I don't think this last version is equivalent to the original code.
With GNU sed:

-> echo foo/bar-baz.frob-nitz | sed -e 's/\(.*\)\.\w/\1.o/'
foo/bar-baz.orob-nitz
-> echo foo/bar-baz.frob-nitz | sed -e 's/\(.*\)\..*/\1.o/'
foo/bar-baz.o


> Would you accept a patch for this?

Yes, of course - if the resultinmg code works, and if you follow
patch submission rules (like SoB: line etc.).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Computers are not intelligent.  They only think they are.


More information about the U-Boot mailing list