automake
[Top][All Lists]
Advanced

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

[SUGGESTION] Having 'make check' use AM_CPPFLAGS


From: Stephen Torri
Subject: [SUGGESTION] Having 'make check' use AM_CPPFLAGS
Date: Sat, 11 Oct 2003 22:23:47 -0500

When I do the normal build the Makefile variable AM_CPPFLAGS is honored
but it is not when I doing 'make check'. I am trying to compile a
testing file that uses the same include headers as the files which it is
suppose to test. For example:

------------ BEGIN EXAMPLE --------------
LT_LIBRARIES = libFoo.la

libFoo_la_SOURCES = foo.cpp

noinst_HEADERS = foo.h

TESTS = test_Foo

test_Foo_SOURCES = test_Foo.cpp

AM_CPPFLAGS =-I$(top_srcdir)/src/Bar

------------ END EXAMPLE ---------------

So when I do 'make' you will see that the include for Bar's directory is
there in the compile argument. If you do 'make check' you will find that
it is not and therefore test_Foo does not. The reason behind is in
foo.h.

------------ foo.h -----------------

#include <bar.h>

class Foo : public Bar {

};

------------------------------------

The location of bar.h is in the directory $(top_srcdir)/src/Bar. The
attempt to compile fails because bar.h cannot be found in path for basic
includes.

The fix for this was to do:

------------ BEGIN EXAMPLE --------------
LT_LIBRARIES = libFoo.la

noinst_PROGRAMS = test_Foo

libFoo_la_SOURCES = foo.cpp

noinst_HEADERS = foo.h

TESTS = test_Foo

test_Foo_SOURCES = test_Foo.cpp

AM_CPPFLAGS =-I$(top_srcdir)/src/Bar

------------ END EXAMPLE ---------------

By adding noinst_PROGRAMS the AM_CPPFLAGS was honored during 'make' and
because the binary test_Foo was there when doing 'make check' the test
was able to go ahead. I am not sure this is the best semantics to get
the job doing. I am curious to hear opinions on this?

Stephen
-- 
Stephen Torri
GPG Key: http://www.cs.wustl.edu/~storri/storri.asc

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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