help-make
[Top][All Lists]
Advanced

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

Re: -j 2 exposes problem with pattern rule


From: Paul Smith
Subject: Re: -j 2 exposes problem with pattern rule
Date: Thu, 20 Aug 2009 21:18:11 -0600
User-agent: Internet Messaging Program (IMP) H3 (4.1.6)

Quoting John Breitenbach <address@hidden>:
lf/% af/% nf/% pf/%:
   do_stuff()

My intent is to invoke the same function for any make target with one
of the 4 subdirs listed above.
There are dependencies between them.  e.g., lf/abc depends on af/abc
and nf/aaa.  af/abc
depends on pf/ppp while nf/aaa depends on pf/p1...  Thus there are
opportunities for parallel.

I'm not sure, from your email, if you're aware of what the rule you're
writing actually means.  A pattern rule with multiple target patterns
means that one invocation of the recipe will build ALL the listed
targets.  So, if make decides to build lf/abc and it chooses this
pattern rule to do it, then it will expect that that single invocation
of do_stuff() will build not only lf/abc, but also af/abc, nf/abc,
and pf/abc.

If that's not what you want, then you'll have to define the rule
four times:

    lf/%:
            do_stuff()
    af/%:
            do_stuff()
    nf/%:
            do_stuff()
    pf/%:
            do_stuff()

Read about pattern rules in the GNU make manual.





reply via email to

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