automake
[Top][All Lists]
Advanced

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

pattern rules in an automake file?


From: tom fogal
Subject: pattern rules in an automake file?
Date: Thu, 06 Mar 2014 13:21:23 +0100

I'm converting a pre-existing codebase to automake and friends from raw
GNU make.

The existing setup needed a mix of MPI and non-MPI code.  For those not
familiar, (generally) one compiles MPI code using a special frontend,
e.g. 'mpicc', which then forwards to the system compiler.  To work with
this, I named any file in my tree that needed MPI as "whatever.mpi.c"
instead of simple "whatever.c".  Then I defined a custom pattern rule:

  %.mpi.o: %.mpi.c
    $(MPICC) -c $(CFLAGS) $^ -o $@

I unfortunately cannot replicate this setup with automake.  It seems
the generated makefile does not know of the rule if I included it as-is
in my .am file.  I get:

  make: *** No rule to make target `netz.mpi.lo', needed by `libnetz.la'.  Stop.

(I am using libtool as well; this is a pkglib_LTLIBRAR...y) I can't
get a suffix rule to work as-is, perhaps due to all the '.'s.  I tried
changing it to a '-' and using:

  SUFFIXES = -mpi.o
  -mpi.o.c:
    $(MPICC) -c $(CFLAGS) $^ -o $@

to no avail.

I have seen a variety of solutions in the archives that involve
undesirable solutions such as multiple configure scripts.  Could anyone
see how to achieve the above solution?  If it helps, I am perfectly
okay with requiring GNU make.

Thanks,

-tom



reply via email to

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