Re: New make modifiers: :C///W, :tW, and :[]
Garance A Drosihn <[email protected]> Sat, 2 Aug 2003 22:12:42 -0400
| Newsgroups | gmane.os.bsd.api.general |
|---|---|
| Message-ID | <p052106b7bb5219d0426f@[128.113.24.47]> |
At 7:58 PM +0200 7/31/03, Alan Barrett wrote:
>I propose adding a new :[] modifier to make(1) in NetBSD,
>and possibly also adding some other modifiers.
>
>":[]" will allow you to extract a single word from a
>space-separated list, like this:
>
> CC= /usr/bin/gcc -Wall
> .if exists(${CC:[1]})
> ...
Of course, this assumes that the filename path does not have any
blanks in *it*... :-)
(yes, I have written some scripts for MacOS 10, why do you ask?)
The following are just my own opinions. I do not pretend
to be speaking for "the FreeBSD project"...
>Briefly, the proposals are
>
> :tW Set a flag that causes subsequent ...
>
> :tw Undo the effect of :tW.
I think we could skip with these two. Given the other proposed
options, all this gives us more stuff to document. (IMO)
> :C///W A "one big word" variant...
> :S///W A "one big word" variant...
These are also redundant, but I think they serve a useful
purpose in reminding people the significance of blanks
with the standard C/// and S///. Also, it's more intuitive
than having to reference ':[0]' before doing the C or S.
>
> :[N] Select the Nth word, where N is a positive
> integer. :[1] selects the first word.
> :[-N] Select the Nth word from the end. :[-1]
> selects the last word.
> :[0] Select the entire string, but treat it as
> one big word. (Equivalent to :tw.)
I expect that you mean ':tW' here!
> :[*] Select the entire string, treating it as a
> sequence of space-separated words. (Undoes
> the effects of :[0]; equivalent to :tw.)
Some of the replies to your message also suggested various
additional options. I liked the idea of ':[#]' to give the
number of words, and I liked the idea of having some way to
specify a range. If a person wants to do something special
with word #1, then they might also want to do something
special with word#2->last_word. I don't particularly care
what syntax is used for a range, though I would like it to
include a way to say "to the last word" without having to
dig up the # value. Probably just ':[N..-M]', with M==1
would include everything up to the last word.
If other freebsd developers do not object to the *idea* of
these changes, I would be willing to look at installing
similar changes to FreeBSD, after NetBSD has worked with
them for a little while.
--
Garance Alistair Drosehn = gad-AvF0vkkS99i66gPnRoyaY/[email protected]
Senior Systems Programmer or [email protected]
Rensselaer Polytechnic Institute or [email protected]
---------------------------------------------------------------------
The BSD APIs Discussion Mailing List
To unsubscribe:
send "unsubscribe bsd-api-discuss" to majordomo-of7zbby7T3pWk0Htik3J/[email protected]