help-make
[Top][All Lists]
Advanced

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

Re: Make .o withe the same rule for both C and C++ files (newbie questio


From: Ken Smith
Subject: Re: Make .o withe the same rule for both C and C++ files (newbie question)
Date: Wed, 5 Oct 2005 16:19:23 -0400
User-agent: Mutt/1.5.10i

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




reply via email to

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