help-make
[Top][All Lists]
Advanced

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

Re: Dealing with commands that generate more than one target with -j


From: Boris Kolpackov
Subject: Re: Dealing with commands that generate more than one target with -j
Date: Tue, 9 Aug 2005 13:32:05 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Dale King <address@hidden> writes:

> I'm wondering if there is a better way to handle the case where multiple
> files get built by the same command. One example, might be the link step
> which generates both the executable and a map file, but it could be any
> program that generates more than one file.
>
> Let's take as a hypothetical example a command foo that given a file a
> in some language that produces a C header and source file. One might
> think you would design a rule like this:
>
> a.h a.c : a
>     foo a
>
> This is of course, the multiple targets for one rule and does not say
> that both will be generated by executing the command. The above is the
> equivalent of
>
> a.h : a
>     foo a
>
> a.c : a
>     foo a
>
> Which says nothing about the joint nature of the two targets.
>
> ...
>
> So is there a good way out of this puzzle?

The only way I know is to use implicit pattern rules:

%.h %.c: %
        foo $<

This tells make that something.h and something.c are build together
by single execution of the command.

hth,
-boris





reply via email to

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