Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Aug 2003 13:15:29 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        arch@freebsd.org
Subject:   Fw: New make modifiers: :C///W, :tW, and :[]
Message-ID:  <20030802.131529.105115862.imp@bsdimp.com>

next in thread | raw e-mail | index | archive | help
----Next_Part(Sat_Aug__2_13:15:29_2003_848)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Comments?  If so, please forward them to the
bsd-api-discuss@metzdowd.com list.  Thanks.

Warner

----Next_Part(Sat_Aug__2_13:15:29_2003_848)--
Content-Type: Message/Rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Delivery-Date: Sat, 02 Aug 2003 13:08:59 -0600
Received: from rover.village.org (warner@rover2.village.org [10.0.0.1])
	by harmony.village.org (8.12.9/8.12.3) with ESMTP id h72J8pFL095103
	for <imp@harmony.village.org>; Sat, 2 Aug 2003 13:08:51 -0600 (MDT)
	owner-bsd-api-discuss+imp=harmony.village.org@metzdowd.com)
Received: from red.metdow.com (72.muf123.nycm.n54ny05r18.dsl.att.net
	[12.103.123.72])
	by rover.village.org (8.12.8/8.12.8) with ESMTP id h72J8m7L039645
	for <imp@harmony.village.org>; Sat, 2 Aug 2003 13:08:51 -0600 (MDT)
	owner-bsd-api-discuss+imp=harmony.village.org@metzdowd.com)
Received: by red.metdow.com (Postfix, from userid 1002)
	id E6080182F5D; Sat,  2 Aug 2003 19:08:19 +0000 (UTC)
X-Original-To: bsd-api-discuss@metzdowd.com
Delivered-To: bsd-api-discuss@metzdowd.com
Received: from snark.piermont.com (snark.piermont.com [166.84.151.72])
	by red.metdow.com (Postfix) with ESMTP id E8B00182F59
	for <bsd-api-discuss@metzdowd.com>;
	Sat,  2 Aug 2003 19:08:18 +0000 (UTC)
Received: by snark.piermont.com (Postfix, from userid 1000)
	id D0CBAD97C5; Sat,  2 Aug 2003 15:08:17 -0400 (EDT)
X-Original-To: bsd-api-discuss@metzdowd.com
Received: from citadel.cequrux.com (citadel.cequrux.com [192.96.22.18])
	by red.metdow.com (Postfix) with ESMTP id 127B0182F59
	for <bsd-api-discuss@metzdowd.com>;
	Thu, 31 Jul 2003 17:59:53 +0000 (UTC)
Received: (from nobody@localhost) by citadel.cequrux.com (8.8.8/8.6.9) id
	TAA02853 for <bsd-api-discuss@metzdowd.com>; Thu, 31 Jul 2003 19:59:41 +0200
	(SAST)
Received: by citadel.cequrux.com via recvmail id 2819;
	Thu, 31 Jul 2003 19:58:58 +0200 (SAST)
Date: Thu, 31 Jul 2003 19:58:56 +0200
From: Alan Barrett <apb@cequrux.com>
To: bsd-api-discuss@metzdowd.com
Subject: New make modifiers: :C///W, :tW, and :[]
Message-ID: <20030731175401.GE2078@apb.cequrux.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Sender: owner-bsd-api-discuss@metzdowd.com
Precedence: bulk
X-Spam-Status: No, hits=0.0 required=5.0
	tests=none
	version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)

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]})
        ...

See http://mail-index.netbsd.org/tech-userlevel/2003/07/31/0000.html
for a post to NetBSD's tech-userlevel list where I discusssed the
problem and several proposed solutions.  See other nearby messages
linked from http://mail-index.netbsd.org/tech-userlevel/2003/07/
for responses.

Briefly, the proposals are

        :tW     Set a flag that causes subsequent modifiers to treat the
                value as a single entity instead of as a space-separated
                list.

                Why ":tW"?  We already have :tu and :tl to convert to
                upper or lower case, so starting with "t" is natural.
                "tW" is supposed to suggest "convert to one big word".

        :tw     Undo the effect of :tW.  "tw" is supposed to suggest
                "convert to small words".

        :C///W  A "one big word" variant of the existing :C/// regular
                expression substitution modifier.  Unlike the usual
                :C/// (which works separately on each space-separated
                word), this would work on the entire string all at once,
                so it would be able to match teh spaces between words.

        :S///W  A "one big word" variant of the existing :S/// simple
                string substitution operator.

        :[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.)
        :[*]    Select the entire string, treating it as a sequence of
                space-separated words.  (Undoes the effects of :[0];
                equivalent to :tw.)


There seems to be support for adding :[] to NetBSD's make(1). :tW/:tw
and :C///W are not really necessary if you have :[0] and :[*], but they
might nevertheless be useful enough to add.

Would other BSDs be likely to pick up these features, or at least
not use the same modifier characters with incompatible meanings?

--apb (Alan Barrett)

---------------------------------------------------------------------
The BSD APIs Discussion Mailing List
To unsubscribe:
send "unsubscribe bsd-api-discuss" to majordomo@metzdowd.com


----Next_Part(Sat_Aug__2_13:15:29_2003_848)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030802.131529.105115862.imp>