[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Autotools: compiling two C++ files with two compilers...
From: |
Federico Zenith |
Subject: |
Autotools: compiling two C++ files with two compilers... |
Date: |
Fri, 12 Jan 2007 02:07:36 +0100 |
User-agent: |
KNode/0.10.4 |
Hi all,
sorry if the question may be lame, but it's my first package with
Autotools...
In short, I have some C++ files that have to be compiled. One accepts g++,
the others have to use mkoctfile, that is a wrapper used by GNU Octave to
compile a dynamically-linked function that one can later use in Octave.
I have tried redefining the CXX variable (as it is done in a configure.base
file in Octave-Forge project: is that an old autoconf stuff?), and now I am
pretty much trying to add a GNU-Make rule (without the various autotools
magic). Yet, this really should not be this difficult: I want to compile a
file with a compiler and another file with another compiler. I must be
missing something big time!
The files are in a src/ dir; this is my current src/Makefile.am:
(don't worry about the libfuelcell.la thing, it's the only thing that works
like a charm)
-------------------
LDADD = ../lib/libfuelcell.la
AM_CPPFLAGS = -I$(srcdir)/../lib
noinst_PROGRAMS = polariser
if MKOCTFILE
noinst_PROGRAMS += correlationMatrix
endif
polariser_SOURCES = polariser.cpp
correlationMatrix_SOURCES = correlationMatrix.cpp
--------------------
Of course this crashes at build time, as correlationMatrix.cpp cannot be
built directly with g++.
My idea would be to compile polariser.cpp with g++ and correlationMatrix.cpp
with mkoctfile (the shell command is usually "mkoctfile
correlationMatrix.cpp, which generates a correlationMatrix.oct file).
Variable MKOCTFILE is defined in configure.ac with:
--------------------
AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile])
test -z "$MKOCTFILE" && AC_MSG_WARN([Dynamically linked functions need
Octave's mkoctfile to compile.])
AM_CONDITIONAL([MKOCTFILE], [test "$MKOCTFILE" = mkoctfile])
--------------------
Can anyone point me to how I define my own build rules in a Makefile.am? If
I try to define something like:
-------------------
correlationMatrix: correlationMatrix.cpp
mkoctfile $(srcdir)/correlationMatrix.cpp
-------------------
I get complaints from autoreconf --install about correlationMatrix
overriding correlationMatrix$(EXEEXT), and instructions to change the
target to the latter (which however does not change much, I still get the
error only written once instead of twice).
Thanks!
-Federico