1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
#
# Copyright (c) 2006 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See README for details.
#
include options.mk
.PHONY: test all all-nogen generate unittest pythontest doxygen
test: unittest pythontest
# Must run 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: $(GENDIR)/timestamp
$(GENDIR)/timestamp: $(wildcard etc/stylesheets/*.xsl) $(SPEC)
rm -rf $(GENDIR)
mkdir -p $(GENDIR)/qpid/framing
( cd $(GENDIR)/qpid/framing && for s in $(STYLESHEETS) ; do $(TRANSFORM) $$s ; done ) && echo > $(GENDIR)/timestamp
# Dependencies for existing generated files.
GENFILES:=$(wildcard $(GENDIR)/qpid/*/*.cpp $(GENDIR)/qpid/*/*.h)
ifdef GENFILES
$(GENFILES): $(GENDIR)/timestamp
endif
$(BUILDDIRS):
mkdir -p $(BUILDDIRS)
## Library rules
LIB_common := $(call LIBFILE,common,1.0)
$(LIB_common): $(call OBJECTS,qpid qpid/concurrent qpid/framing qpid/io)
$(LIB_COMMAND)
LIB_client :=$(call LIBFILE,client,1.0)
$(LIB_client): $(call OBJECTS,qpid/client) $(LIB_common)
$(LIB_COMMAND)
LIB_broker :=$(call LIBFILE,broker,1.0)
$(LIB_broker): $(call OBJECTS,qpid/broker) $(LIB_common)
$(LIB_COMMAND)
## Daemon executable
$(BINDIR)/qpidd: $(OBJDIR)/qpidd.o $(LIB_common) $(LIB_broker)
mkdir -p $(dir $@)
$(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -lapr-1 $^
all-nogen: $(BINDIR)/qpidd
## Unit tests.
UNITTEST_SRC:=$(shell find test/unit -name *Test.cpp)
UNITTESTS:=$(UNITTEST_SRC:test/unit/%.cpp=$(TESTDIR)/%.so)
unittest: all
DllPlugInTester -c -b $(UNITTESTS:.cpp=.so)
all-nogen: $(UNITTESTS)
## Run python tests
pythontest: all
$(BINDIR)/qpidd > qpidd.log 2>&1 &
cd ../python ; ./run-tests -v -I cpp_failing.txt
## Doxygen documentation.
doxygen: generate build/html
build/html: doxygen.cfg
doxygen doxygen.cfg
touch $@
## Implicit rules
# C++ compile
define CPPRULE
$(OBJDIR)/%.o: $1/%.cpp
@mkdir -p $$(dir $$@)
$(CXX) $(CXXFLAGS) -c -o $$@ $$<
endef
$(foreach dir,$(SRCDIRS),$(eval $(call CPPRULE,$(dir))))
# Unit test plugin libraries.
$(TESTDIR)/%Test.so: test/unit/%Test.cpp
mkdir -p $(dir $@)
$(CXX) -shared -o $@ $< $(CXXFLAGS) -Itest/include $(LDFLAGS) -lcppunit $(LIB_common) $(LIB_broker)
# Client test programs
$(TESTDIR)/%: test/client/%.cpp $(LIB_common) $(LIB_client)
mkdir -p $(dir $@)
$(CXX) -o $@ $(CXXFLAGS) -Itest/include $(LDFLAGS) $^
CLIENT_TEST_SRC := $(wildcard test/client/*.cpp)
CLIENT_TEST_EXE := $(CLIENT_TEST_SRC:test/client/%.cpp=$(TESTDIR)/%)
all-nogen: $(CLIENT_TEST_EXE)
## include dependencies
DEPFILES:=$(wildcard $(OBJDIR)/*.d $(OBJDIR)/*/*.d $(OBJDIR)/*/*/*.d)
ifdef DEPFILES
-include $(DEPFILES)
endif
## Clean up
# Just the current build.
clean:
rm -rf build/$(BUILD)
# Clean all builds
spotless:
rm -rf build
|