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