Hello Brian,

* Brian J. Murrell wrote on Thu, Jun 03, 2010 at 08:10:26PM CEST:
> 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:

What do you need $(LD) or $(foo_LD) for?  It is not referenced by any
automake-generated rules really.

* Brian J. Murrell wrote on Thu, Jun 03, 2010 at 08:50:15PM CEST:
> On Thu, 2010-06-03 at 11:42 -0700, Christian Rössel wrote: 
> > I use a separate Makefile for MPI targets.
> 
> This is what I did last time around.  In fact I created a "mpi" subdir
> for my MPI sources.  I'm looking to avoid doing that again for this
> particular use case.

Yes, we do this too.  And currently don't use subdir-objects for this
reason.

> > But you need not to move your sources, though.
> 
> Hrm.  Interesting.  We did move the MPI sources into the separate subdir
> with the new Makefile.  How did you avoid moving the sources too?  Did
> you just prefix all of the filenames, etc. in your subdir/Makefile.am
> with "../"?  i.e.
> 
> foo_CFLAGS = $(PTHREAD_CFLAGS)
> foo_SOURCES = ../parser.c ../cfg.c ../foo.c ../parser.h ../platform.h

--- src/Makefile.common:
common_sources = \
        $(sdir)/a.c \
        $(sdir)/b.c \
        ...

--- src/Makefile.am:
sdir = .
include Makefile.common
foo_SOURCES = $(common_sources) ...

--- mpi/Makefile.am:
sdir = ../src
include ../src/Makefile.common
foo_mpi_SOURCES = $(common_sources) ...


Cheers,
Ralf

Reply via email to