Re: [RFC PATCH] Add a 'minimal tree install' target
From: Oleg Verych
Date: Thu Sep 13 2007 - 16:02:22 EST
Hallo.
On Thu, Sep 13, 2007 at 09:19:38PM +0200, Sam Ravnborg wrote:
[]
> >
> > sed -n "s/^ALTARCH[[:space:]]:=[[:space:]]\(.*$\)\+/\1/p"
> >
> > (i'm sure there is a better way though)
>
> Oleg (added to mail) - you are quite confident in sed et al.
> Let us know if there is a simpler way.
>
> (We want to pick i386 from include/asm-x86_64/Kbuild
> and similar for the architectures that uses ARCHDEF).
That particular one-line `ALTARCH := i386' of course can be matched
simpler, because there's only *one* (as written above) whitespace and no
make's assignment variations, like (?=,=). I wonder, if there can be more
options, than i386 and more occurrences of `ALTARCH' actually :) Also,
make can have lead whitespace on line start, as well as near assignment
sign, if that matters.
So, to match *one* line with *one* `ALTARCH' followed by `i386'
sed -n '/ALTARCH/{/i386/{p ; q}}'
is fine by me. If there are dis-assignments, so to speak, or comments
with i386 this will not work obviously. But it's fast and must work
with variety of make syntax. Check is "for non empty output".
Also, please take a look on man isspace(). It matches much more
characters, than necessary for ordinary syntax whitespace. Using
[:blank:] (i.e. tab and space, with no options) is OK. Last thing: i'm not
sure, what that `+' is. I stick to BRE in sed, as it should be, so just
don't know what it does.
Hope that helps.
____
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/