On Wed, Oct 05, 2005 at 09:44:07PM +0200, Stefan Karlsson wrote:
> Hello all,
> 
> I want to use the same rule for compiling both C and C++ files. Since I 
> have a compiler with some peculiarities I cannot get away with just 
> changing some variables and rely on the default rules.
> 
> Basically, instead of writing
> 
>  %.o: %.c
>      <the-rule>
> 
>  %.o: %.cpp
>      <the-rule>
> 
> I want to write something like
> 
>  %.o: %.c
>  %.o: %.cpp
>      <the-rule>
> 
> 
> Is this possible? I'm a newbie, so please forgive me if this question is 
> ultra-stupid.

You could do something like this

define c-and-c++-rule
        <the-rule>
endef

%.o: %.c
        $(c-and-c++-rule)

%.o: %.cpp
        $(c-and-c++-rule) 


  Ken


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to