[Top][All Lists]

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

Help with make rule

From: Bob Bell
Subject: Help with make rule
Date: Thu, 20 Jan 2011 14:23:47 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

What I'd really like to do is write a rule like this:

$(objdir)/%: | $(objdir)
$(objdir): ; mkdir $@

The goal here is that all build output goes into a separate directory 
$(objdir), and so I need to have all contents of the directory dependent 
on the creation of that directory.

I *could* bundle up all the contents of the directory and make them 
explictly depend on the directory.  But I'd prefer something simpler and 
less prone to oversight.

I presume the example above doesn't work because a pattern rule must be 
required to have % in both the target and the prerequisite.  However, in 
my case, I want to completely drop the stem.

I believe this is the case because the following simple test case 
doesn't work:
foo/bar: ; echo bar > foo/bar
foo/%: | foo
foo: ; mkdir foo

But the follow *does* work:
foo/bar: ; echo bar > foo/bar
foo/bar: | foo
foo: ; mkdir foo

Can anyone help?  Is it possible to do what I'd like?

-- Bob

reply via email to

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