automake
[Top][All Lists]
Advanced

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

Re: how to change $(CC) for just some targets


From: Christian Rössel
Subject: Re: how to change $(CC) for just some targets
Date: Thu, 03 Jun 2010 11:42:10 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4

Hi Brian,

Am 6/3/2010 11:10 AM, schrieb Brian J. Murrell:
> I have a Makefile.am with a number of targets in it.  Some of those
> targets need $(CC) and/or $(LD) to be reassigned to a particular value
> while others are fine with the default (or could be explicitly assigned
> gcc if need be).
> 
> I notice there is no CC/LD equivillent of the "prog_{C,F}LAGS" type
> variables.  i.e. ideally I would just do:
> 
> foo_CC = other_cc
> foo_LD = other_ld
> foo_CFLAGS = ...
> 
> bar_CC = other_cc
> bar_LD = other_ld
> bar_CFLAGS = ...
> 
> bat_CFLAGS = ...
> 
> boo_CFLAGS = ...
> 
> (because bat and boo should just use whatever CC was set to by the
> "make" caller).
> 
> The two specific cases I have for this are for compiling MPI programs
> and pthread programs in the same directory as regular .c sources.

I use a separate Makefile for MPI targets. The Makefile.am starts with

CC   = $(MPICC)
CXX  = $(MPICXX)
F77  = $(MPIF77)
FC   = $(MPIFC)
LIBS += $(MPILIBS)

where the MPI* variables are set by calls to AX_MPI
(http://www.gnu.org/software/autoconf-archive/ax_mpi.html). However,
this approach assumes that you use $CC etc. for compiling and linking.

For me, this approach works just fine. However, you need to put the MPI
Makefile.am into a separate directory as, afaik, there can be only one
Makefile.am per directory. But you need not to move your sources, though.

Best regards,
Christian



reply via email to

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