help-make
[Top][All Lists]
Advanced

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

how to prevent absolute path targets from matching my pattern rule meant


From: Mark Galeck (CW)
Subject: how to prevent absolute path targets from matching my pattern rule meant for current directory only
Date: Tue, 13 Dec 2011 19:53:20 -0800

Hello,

I have an implicit rule like this which is intended to be used in a directory 
"dir1" - in this example it just copies stuff over from another directory "dir0"

.SECONDEXPANSION:
foo%: $$(subst dir1,dir0,$$(abspath $$@))
        cp $< $@


This is a problem - by the algorithm of pattern rule matching, this rule target 
will also match its prerequisite (the absolute path) and there it will be a 
circular dependency.

I could put "::" here to prevent chaining, but then I have a different problem, 
by the algorithm, that "::" rule would take precedence over another one for a 
"partial path", like dir/foo%

------------------

Basically all I want really is to have two rules like:

foo%: ...
        ...

dir/foo%: ...
        ...

the first should match stuff in current directory only, the second, in a 
subdirectory "dir".  It seems difficult to accomplish, because the pattern 
matching algorithm does not just match patterns, but also splits into directory 
and file part and matches the file part separately.

Why is this so difficult? Am I missing something here? How do you get two such 
rules coexist?

Mark



reply via email to

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