automake
[Top][All Lists]
Advanced

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

Re: How does one compile in a "make check" test?


From: Alexandre Duret-Lutz
Subject: Re: How does one compile in a "make check" test?
Date: Mon, 26 Dec 2005 23:51:54 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

>>> "RW" == Ralf Wildenhues <address@hidden> writes:

 RW> I agree that it ought to work.  Cleaner, but a lot more to write, would
 RW> be something like
 RW> TESTS_ENVIRONMENT = CC="$(CC)" CFLAGS=... LIBTOOL=...

 RW> in the tests/Makefile.am, and just use
 RW> $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS ...

 RW> Depending on your needs, throw in AM_{C,CPP,..}FLAGS as well -- but
 RW> those should be under your control anyway.

Either that, or you could also AC_CONFIG_FILES([tests/defs])
and define COMPILE='@LIBTOOL@ --mode=link @CC@ ...' in defs.in.
(Maybe write it in a way that it uses $CC if its defined.)
I've used both.


Sometimes, I also find easier not to use `CHECK = ... ' tests,
and call your test case directly from a local rule.  For
instance I have a test case I like to run in my projects to
check that all installed headers files are self-contained (i.e.,
they include anything that needs to be included) and properly
guarded against multiple inclusions.  The check actually tries
to compile the header, so it needs $CXX and friends.  Also I
want to run it on the source tree during "make check" and on the
installed headers during "make installcheck"; so I used some
variable, $INCDIR, to specify the directory to check.

check-local:
        CXX='$(CXX)' \
        CPPFLAGS='$(AM_CPPFLAGS) $(CPPFLAGS)' \
        CXXFLAGS='$(AM_CXXFLAGS) $(CXXFLAGS)' \
        INCDIR='$(top_srcdir)/src' \
        $(SHELL) $(srcdir)/includes.test

installcheck-local:
        CXX='$(CXX)' \
        CPPFLAGS='-I$(includedir) -I$(pkgincludedir) $(LIBGSPN_CPPFLAGS) $(CPPF
LAGS)' \
        CXXFLAGS='$(AM_CXXFLAGS) $(CXXFLAGS)' \
        INCDIR='$(pkgincludedir)' \
        $(SHELL) $(srcdir)/includes.test

-- 
Alexandre Duret-Lutz

Shared books are happy books.     http://www.bookcrossing.com/friend/gadl





reply via email to

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