bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using "%: $(subst RCS/,,%)"


From: Marc MERLIN
Subject: Re: using "%: $(subst RCS/,,%)"
Date: Mon, 2 Oct 2000 16:49:01 -0700
User-agent: Mutt/1.2i

On Mon, Oct 02, 2000 at 06:33:17PM -0400, Paul D. Smith wrote:
> %% Marc MERLIN <address@hidden> writes:
> 
>   mm> %,v: $(subst RCS/,,%)
> 
> This can't work.  Variables and functions in target and prerequisite
> definitions are evaluated when the makefile is read in.  So, this is
> expanded at makefile read time, and the subst is expanded on the literal
> string "%", not on the results of the pattern substitution, which won't
> happen until make actually starts trying to evaluate rules.

I was afraid of that. Thank you for the confirmation
 
>   mm> The only fix I see right now is to get rid of the RCS directories,
>   mm> something which I'd like to avoid at the moment.
> 
> I really had a hard time following what you're trying to do.  Maybe you
> could provide a simple example with one file, describing the files that
> exist, what you know about them in the makefile, and the result you're
> trying to obtain?

Sure. Sorry I wasn't clear enough the first time.

I have 
path/file
path/RCS/file,v
and I'd like to autocheck in path/file if it's been modified


To do this, I did:
TORCSFILES=path1/file1 path2/file2 file3
TORCS=$(shell echo '$(TORCSFILES)' | sed -e 's/\/\([^/]*\) /\/RCS\/\1 /g'
-e 's/\<\([^/]*\) /RCS\/\1 /g' -e 's/RCS\/RCS/RCS/g' -e 's/  */,v /'g)

Which gives me:
TORCS=path1/RCS/file1,v path2/RCS/file2,v RCS/file3,v  # (path is optional)

I'd like to have something like this:
rcs:            $(TORCS)
        

RCS/%,v:        %
                ci -l $<
                touch $@

This works fine, but it stops working when I have path/RCS/file,v instead of
RCS/file,v
If I had real regexes, I could do:
\(.*\)RCS/\([^/]\),v:   \1\2

Does that make more sense? :-)

Thanks,
Marc
-- 
Microsoft is to software what McDonalds is to gourmet cooking
 
Home page: http://marc.merlins.org/ (friendly to non IE browsers)
Finger address@hidden for PGP key and other contact information



reply via email to

[Prev in Thread] Current Thread [Next in Thread]