On Sat, Jul 15, 2006 at 12:40:54PM -0400, Robert Connolly wrote:
> On July 15, 2006 12:26 pm, Randy McMurchy wrote:
> > Robert Connolly wrote these words on 07/15/06 11:13 CST:
> > [EMAIL PROTECTED]: ~/build > sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' tf
> > stuff
> > XCFLAGS = -g -O2
> > more stuff
> The sed above is the one from the book, it should be working.
> 
> 
> $ grep -e '^XCFLAGS' gcc/Makefile.in
> XCFLAGS =

OK, I think there's some crossed wires here.

The sed in the book is designed to match what appears in
gcc/Makefile.in, which is the line with only
XCFLAGS =
on. It will _not_ match any other line. This is fine, because that's
exactly what is in the file.

It will not for example, match
XCFLAGS = -g -O2
The reason is obvious: there is no end-of-line after the =, which is
what $ matches.

All the examples ("^XCFLAGS =$", "^XCFLAGS =", "^XCFLAGS") will get the
line required in the file. The first will not get any other line, while
the second two will get anywhere XCFLAGS is set.

Now we've got that sorted:

I think Robert's intention was to make the sed adaptable by the user to
set other variables, which may or may not already have values. If FOO
was set to -blah at some point the Makefile.in, "^FOO =$" would not
match it, but "^FOO =" would.

Personally, I would think that this is a decidedly dodgy reason to
change the sed. If the user knows sed (or, at least, the substitute
command) this should not be a problem for them. If they don't, changing
random variables using adapted seds is dangerous. If you don't know how
to use a swiss army knife, it's quite easy to end up cutting yourself.

Hope that helped...

Alex :-)

-- 
Pippin
Computer Monkey to the Pelican
www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk
Internal: 30741, external: 0870 2760741

Attachment: pgpX6Ijc8HuSb.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to