[Top][All Lists]

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

Re: Help on multiple targets

From: Philip Guenther
Subject: Re: Help on multiple targets
Date: Tue, 22 Dec 2009 13:43:39 -0800

On Tue, Dec 22, 2009 at 2:55 AM, 袁野 <address@hidden> wrote:
> How to write this with maybe multiple targets and patterns?
> foo.o foo.h : foo.src
>         cmd foo.src -o foo.o -h foo.h
> bar.o bar.h : bar.src
>         cmd bar.src -o bar.o -h bar.h
> I have lots of *.src files.

I would do it with this:

%.o %.h: %.src
        cmd $< -o ${@:.h=.o} -h ${@:.o=.h}

The odd address@hidden bits are so that the proper files are generated
regardless of whether make hits this with, for example, "foo.o" as the
target or "foo.h" as the target.  Since it bases them off of $@ and
not $<, it'll also work properly with VPATH.

Philip Guenther

reply via email to

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