Subject: Re: make(1) :M / :N doesn't deal with sets
To: Masao Uebayashi <uebayasi@gmail.com>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-userlevel
Date: 12/30/2007 11:31:09
>I think make(1) :M / :N modifiers should deal with sets as arguments.

This would a/ be complex, and b/ probably break lots of makefiles.
It also isn't really necessary - see below.


>--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<
>INPUT=	a b c
>WANTED=	a b
>OUTPUT=	${INPUT:M${WANTED}}

OUTPUT= ${WANTED:@m@${INPUT:M$m}@}

or if you want to skip ${WANTED}

OUTPUT= ${a b:L:@m@${INPUT:M$m}@}

Any list can be easily turned into a set of :N modifiers 
I use this a lot:

M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,

NOT_WANTED=c d e f

OUTPUD= ${INPUT:${NOT_WANTED:${M_ListToSkip}}}

Note that the above use of variables as modifier lists requires 
a recent version of make (but then so would any change in behavior
of :M or :N).

Enjoy
--sjg