help-make
[Top][All Lists]
Advanced

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

Re: Dealing with multiple pattern targets in a single rule


From: Boris Kolpackov
Subject: Re: Dealing with multiple pattern targets in a single rule
Date: Mon, 14 Nov 2005 18:44:19 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Josef Drexler <address@hidden> writes:

> While I could just copy the last rule for times for the four different
> types,

I believe that's the only way.


> in my actual Makefile, the commands are much more complex and the
> file would become unwieldy and harder to maintain if I had to make sure to
> make all changes to all versions of the same commands.

You can factor commands out into a single variable and then use it
from four different places:

define commands
gcc -DTYPE=$(TYPE) -c -o $@ $<
endef

%.ao: %.c
        $(commands)

hth,
-boris






reply via email to

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