From e4240d67de8cc77c290fb40c3fa773ec5c910f49 Mon Sep 17 00:00:00 2001 From: Robert Greig Date: Tue, 17 Oct 2006 20:45:52 +0000 Subject: Merge from trunk up to revision 465005 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/new_persistence@465038 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/Makefile | 125 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 104 insertions(+), 21 deletions(-) (limited to 'cpp/Makefile') diff --git a/cpp/Makefile b/cpp/Makefile index 529ac1568f..ce65a150b2 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -13,37 +13,120 @@ # See the License for the specific language governing permissions and # limitations under the License. +# ---------------------------------------------------------------- # -# Master make file for c++ Qpid project (AMQP) +# Makefile for Qpid C++ project. +# +# Build system principles +# * Single Makefile (see http://www.apache.org/licenses/LICENSE-2.0) +# * Build from directories, no explicit source lists in Makefile. +# * Corresponding .cpp and .h files in same directory for easy editing. +# * Source directory structure mirrors C++ namespaces. # -# Calls the makefiles in the various subdirectories in order to -# build them in the correct sequence. +# Source directories: +# * src/ - .h and .cpp source files, directories mirror namespaces. +# * test/ +# * unit/ - unit tests (cppunit plugins), directories mirror namespaces. +# * include/ - .h files used by tests +# * client/ - sources for client test executables. +# * etc/ - Non-c++ resources, e.g. stylesheets. +# * gen/ - generated code # +# Output directories: +# * gen/ - (created by make) generated code +# * bin/ lib/ - exes & libraries. +# +# NOTE: always use := rather than = unless you have a specific need +# for delayed evaluation. See the link for details. +# + +include options.mk + +.PHONY: test all all-nogen generate unittest pythontest + +test: all unittest pythontest + +# Must run this as two separate make processes to pick up generated files. +all: + $(MAKE) generate + $(MAKE) all-nogen + +## Generaged code + +SPEC := $(CURDIR)/../specs/amqp-8.0.xml +XSL := code_gen.xsl framing.xsl +STYLESHEETS := $(XSL:%=$(CURDIR)/etc/stylesheets/%) +TRANSFORM := java -jar $(CURDIR)/tools/saxon8.jar -o results.out $(SPEC) +generate: gen/timestamp +gen/timestamp: $(wildcard etc/stylesheets/*.xsl) $(SPEC) + mkdir -p gen/qpid/framing + echo > gen/timestamp + cd gen/qpid/framing && for s in $(STYLESHEETS) ; do $(TRANSFORM) $$s ; done +gen $(wildcard gen/qpid/framing/*.cpp): gen/timestamp -UNITTESTS=$(wildcard common/*/test/*.so broker/test/*.so) -SUBDIRS=common broker qpidd client +## Libraries -.PHONY: all test unittest pythontest runtests clean doxygen +# Library command, late evaluated for $@ +LIB_CMD = $(CXX) -shared -o $@ $(LDFLAGS) $(CXXFLAGS) -lapr-1 -test: all runtests +# Common library. +COMMON_LIB := lib/libqpid_common.so.1.0 +COMMON_DIRS := qpid/concurrent qpid/framing qpid/io qpid +COMMON_SRC := $(wildcard gen/qpid/framing/*.cpp $(COMMON_DIRS:%=src/%/*.cpp)) +$(COMMON_LIB): gen/timestamp $(COMMON_SRC:.cpp=.o) + $(LIB_CMD) $(COMMON_SRC:.cpp=.o) +all-nogen: $(COMMON_LIB) +UNITTESTS := $(UNITTESTS) $(wildcard $(COMMON_DIRS:%=test/unit/%/*Test.cpp)) -unittest: - DllPlugInTester -c -b $(UNITTESTS) +# Client library. +CLIENT_LIB := lib/libqpid_client.so.1.0 +CLIENT_SRC := $(wildcard src/qpid/client/*.cpp) +$(CLIENT_LIB): $(CLIENT_SRC:.cpp=.o) + $(LIB_CMD) $^ $(CURDIR)/$(COMMON_LIB) +all-nogen: $(CLIENT_LIB) +UNITTESTS := $(UNITTESTS) $(wildcard $(COMMON_DIRS:%=test/unit/%/*Test.cpp)) -pythontest: - bin/qpidd >> qpidd.log & +# Broker library. +BROKER_LIB := lib/libqpid_broker.so.1.0 +BROKER_SRC := $(wildcard src/qpid/broker/*.cpp) +$(BROKER_LIB): $(BROKER_SRC:.cpp=.o) + $(LIB_CMD) $^ $(CURDIR)/$(COMMON_LIB) +all-nogen: $(BROKER_LIB) +UNITTESTS := $(UNITTESTS) $(wildcard test/unit/qpid/broker/*Test.cpp) + +# Implicit rule for unit test plugin libraries. +%Test.so: %Test.cpp + $(CXX) -shared -o $@ $< $($(LIB)_FLAGS) -Itest/include $(CXXFLAGS) $(LDFLAGS) -lapr-1 -lcppunit $(CURDIR)/$(COMMON_LIB) $(CURDIR)/$(BROKER_LIB) + +## Client tests + +all-nogen: $(wildcard test/client/*.cpp:.cpp=) +test/client/%: test/client/%.cpp + $(CXX) -o $@ $< $($(LIB)_FLAGS) -Itest/include $(CXXFLAGS) $(LDFLAGS) -lapr-1 $(LINK_WITH_$(LIB)) $(LINK_WITH_$(LIB)_DEPS) + +## Daemon executable + +bin/qpidd: src/qpidd.o $(CURDIR)/$(COMMON_LIB) + $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -lapr-1 $^ $(CURDIR)/$(BROKER_LIB) +all-nogen: bin/qpidd + +## Run unit tests. +unittest: $(UNITTESTS:.cpp=.so) + DllPlugInTester -c -b $(UNITTESTS:.cpp=.so) + +## Run python tests +pythontest: bin/qpidd + bin/qpidd > qpidd.log & cd ../python ; ./run-tests -v -I cpp_failing.txt -runtests: - $(MAKE) -k unittest pythontest +## Doxygen documentation. +doxygen: doxygen/doxygen.cfg $(SOURCES) + cd doxygen && doxygen doxygen.cfg -all: - @for DIR in $(SUBDIRS) ; do $(MAKE) -C $$DIR all ; done +## Cleanup +clean:: + rm -f bin/* lib/* qpidd.log + rm -rf gen + rm -f `find src test -name '*.o' -o -name '*.d' -o -name '*.so'` -clean: - @for DIR in $(SUBDIRS) ; do $(MAKE) -C $$DIR clean ; done - @$(MAKE) -C doxygen clean - -@rm qpidd.log -doxygen: - @$(MAKE) -C doxygen all -- cgit v1.2.1