qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Examples makefiles: I want to break your C++ builds ....
Date Fri, 27 Mar 2009 18:09:37 GMT
Jonathan Robie wrote:
> Gordon Sim wrote:
>> Jonathan Robie wrote:
>>> A couple of possible approaches:
>>> 1. Let the current examples Makefile generate the ./libs Makefile, 
>>> then use it to compile the examples.
>>> 2. Add a goal to '$ make check' that creates a new directory with 
>>> each example and Makefile and ensures that it still compiles.
>> One issue to consider is that the makefiles that will be bundled with 
>> the examples for distribution are intended to compile against 
>> installed versions of the headers and libs. By contrast the make check 
>> operates against a working directory.
> Hmmmm, good point.  I'm not sure how to get around that, our testing 
> model does not presume that you've done a '$ make install'.
> In my own environment, I now have shell scripts that install the 
> examples, compile them, and run them in each language. Maybe anyone 
> using the generated Makefiles will just have to do this. But I'd really 
> like to find a way to make this break upstream if there is an upstream 
> problem.

I think we can go back to simple hand-written makefiles and still handle 
platform differences and build vs. install by using make variables appropriately.

1. remove existing examples/*/Makefile.am

2. Generate examples/makefile.mk with platform-specific settings, e.g.

# makefile.mk

3. Hand-write simple examples/foo/Makefile like this:

# examples/foo/Makefile
include ../examples.mk
all: foo
foo: foo.cpp
	${CXX} ${CXXFLAGS} -lqpidclient -o $@ $<
	rm -f foo

4. The hand-written makefiles are designed to work as-is if qpid is installed. 
To build under automake we put something like this in examples/Makefile.am:

EXAMPLE_DIRS=direct pubsub ...
EXAMPLE_CXXFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/src/gen ...
	for e in ${EXAMPLE_DIRS} do ; cd $$e ; make CXXFLAGS=$(EXAMPLE_CXXFLAGS) ; done

Make sense?

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org

View raw message