[PATCH xorg-gtest] Fix build system.
Chase Douglas
chase.douglas at canonical.com
Wed Feb 1 11:39:04 PST 2012
On 02/01/2012 05:05 PM, Peter Hutterer wrote:
> On Wed, Feb 01, 2012 at 04:23:12PM +0200, Jussi Pakkanen wrote:
>> Currently the code builds only if the headers and libs happen
>> to be in the system paths already. Fix that.
>>
>> Signed-off-by: Jussi Pakkanen <jussi.pakkanen at canonical.com>
>> ---
>> Makefile.am | 13 ++++++++++++-
>> configure.ac | 2 +-
>> examples/Makefile.am | 29 -----------------------------
>> 3 files changed, 13 insertions(+), 31 deletions(-)
>> delete mode 100644 examples/Makefile.am
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index d10bca8..82496bf 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -1,4 +1,4 @@
>> -SUBDIRS = doc examples
>> +SUBDIRS = doc
>>
>> lib_LTLIBRARIES = libxorg-gtest.la libxorg-gtest_main.la
>>
>> @@ -38,6 +38,17 @@ ACLOCAL_AMFLAGS = -I m4
>>
>> AM_CXXFLAGS = -Iinclude
>>
>> +noinst_PROGRAMS = xorg-gtest-example
>> +
>> +xorg_gtest_example_SOURCES = examples/xorg-gtest.cpp
>
> shouldn't this use $(srcdir)/examples/xorg-gtest.cpp?
>
> aside from that, I think that's the wrong approach. instead of flattening the
> makefile tree, shouldn't we rather adjust the -I and -L paths so that the
> linking happens correctly?
I agree. There are people who would rather have one flat Makefile
per-project: http://miller.emu.id.au/pmiller/books/rmch/. However, I
think loss of speed with today's machines is a reasonable price to pay
if splitting things up into separate Makefiles helps maintainability and
comprehension.
In this particular case, I was hoping to have Makefile.am also be part
of the "example". It would show how to set up the build rules for an
xorg-gtest testsuite. However, that's not really possible since we need
to link against the libraries built in the package rather than assuming
the system libraries are present.
I think what we should do is adjust -I and -L paths as Peter mentioned,
but specify them separately and with a comment:
# These flags are necessary for building inside this source package.
# They should not be used in other contexts.
xorg_gtest_example_CPPFLAGS = -I../include
xorg_gtest_example_LDFLAGS = -L../src/.libs
XORG_GTEST_LDFLAGS = -lxorg-gtest
XORG_GTEST_MAIN_LDFLAGS = -lxorg-gtest_main
xorg_gtest_example_CPPFLAGS += \
$(AM_CPPFLAGS) \
$(GTEST_CPPFLAGS)
xorg_gtest_example_LDFLAGS += \
$(XORG_GTEST_LDFLAGS) \
$(GTEST_LDFLAGS) \
$(X11_LDFLAGS) \
$(XORG_GTEST_MAIN_LDFLAGS) \
-lpthread
Or something like that...
-- Chase
More information about the xorg-devel
mailing list