summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/Makefile.am2
-rwxr-xr-xcpp/bootstrap3
-rw-r--r--cpp/configure.ac15
-rw-r--r--cpp/gen/Makefile.am46
-rwxr-xr-xcpp/gen/gen-src-mk.sh36
-rw-r--r--cpp/src/Makefile.am43
-rwxr-xr-xcpp/src/generate.sh46
-rw-r--r--cpp/src/tests/Makefile.am21
8 files changed, 86 insertions, 126 deletions
diff --git a/cpp/Makefile.am b/cpp/Makefile.am
index 9d7a82c32e..460908ed7c 100644
--- a/cpp/Makefile.am
+++ b/cpp/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = \
$(SPEC) $(SPEC).in \
rpm/README.qpidd-devel
-SUBDIRS = gen src docs/api docs/man
+SUBDIRS = src docs/api docs/man
# Update libtool, if needed.
libtool: $(LIBTOOL_DEPS)
diff --git a/cpp/bootstrap b/cpp/bootstrap
index d911a3bfd1..c443112f30 100755
--- a/cpp/bootstrap
+++ b/cpp/bootstrap
@@ -9,9 +9,6 @@ libtoolize --automake
: ${JAVAC=javac}
export JAVA JAVAC
-# If we're building in the qpid tree, we can generate
-# some Makefile snippets:
-
# Generate (for automake) lots of repetitive parts of tests/Makefile.am.
(cd src/tests && rm -f gen.mk
perl -ne '/^include / or print' Makefile.am \
diff --git a/cpp/configure.ac b/cpp/configure.ac
index 748d15fe46..1901480a4b 100644
--- a/cpp/configure.ac
+++ b/cpp/configure.ac
@@ -15,7 +15,7 @@ AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
# Minimum Autoconf version required.
AC_PREREQ(2.59)
-AC_CONFIG_HEADERS([config.h:config.in])
+AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([qpidc.spec.in])
AC_PROG_CC_STDC
@@ -34,18 +34,6 @@ AC_ARG_ENABLE(warnings,
esac],
[enableval=yes])
-# Turn on this automake conditional if we are in a qpid
-# hierarchy (i.e. with gentools/ and specs/ sibling directories),
-# and if we have working java + javac.
-AC_CHECK_PROGS([JAVA], [java], [no])
-AC_CHECK_PROGS([JAVAC], [javac], [no])
-build=yes
-test x$JAVA = xno && build=no
-test x$JAVAC = xno && build=no
-test -d $srcdir/gentools || build=no
-test -d $srcdir/../specs || build=no
-AM_CONDITIONAL([CAN_GENERATE_CODE], [test x$build = xyes])
-
# Warnings: Enable as many as possible, keep the code clean. Please
# do not disable warnings or remove -Werror without discussing on
# qpid-dev list.
@@ -160,7 +148,6 @@ test -z "$missing" ||
AC_CONFIG_FILES([
qpidc.spec
Makefile
- gen/Makefile
src/Makefile
src/tests/Makefile
docs/man/Makefile
diff --git a/cpp/gen/Makefile.am b/cpp/gen/Makefile.am
deleted file mode 100644
index c1f27c8700..0000000000
--- a/cpp/gen/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Generate code from AMQP XML specification.
-#
--include gen-src.mk
-
-# Distribute the generated sources, since the code generator depends
-# on tools that may not be available in the build environment.
-GEN_SRC=$(generated_cpp) $(generated_h)
-BUILT_SOURCES = $(GEN_SRC) gen-src.mk
-EXTRA_DIST = $(BUILT_SOURCES)
-
-# Install generated headers
-nobase_include_HEADERS = $(generated_h)
-
-# Don't attempt to run the code generator unless configure has set
-# CAN_GENERATE_CODE, indicating that the amqp.xml and tools needed
-# to run the code generator are available.
-#
-if CAN_GENERATE_CODE
-gentools_dir = $(top_srcdir)/gentools
-gentools_srcdir = $(gentools_dir)/src/org/apache/qpid/gentools
-spec_dir = $(top_srcdir)/../specs
-spec = $(spec_dir)/amqp.0-9.xml $(spec_dir)/amqp-errata.0-9.xml
-
-$(GEN_SRC): $(spec) $(java_sources) $(cxx_templates)
- mkdir -p qpid/framing
- cd $(gentools_srcdir) && rm -f *.class && $(JAVAC) *.java
- $(JAVA) -cp $(gentools_dir)/src org.apache.qpid.gentools.Main \
- -c -o qpid/framing -t $(gentools_dir)/templ.cpp $(spec)
- touch qpid/timestamp
-
-gen-src.mk: $(BUILT_SOURCES) gen-src-mk.sh
- $(srcdir)/gen-src-mk.sh $(gentools_dir) $(gentools_srcdir) > $@-t
- mv $@-t $@
-
-else
-# No code generator, we must be in a distribution tree.
-# Copy gen-src.mk from the source dir as make does not look for
-# include files in the VPATH
-gen-src.mk: $(srcdir)/gen-src.mk
- cp $< $@
-DISTCLEANFILES=gen-src.mk
-endif
-
-maintainer-clean-local:
- rm -rf qpid gen-src.mk $(gentools_srcdir)/*.class
diff --git a/cpp/gen/gen-src-mk.sh b/cpp/gen/gen-src-mk.sh
deleted file mode 100755
index c17bc14307..0000000000
--- a/cpp/gen/gen-src-mk.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# Generates gen-src.mk makefile fragment, to stdout.
-# Usage: <gentools_dir> <gentools_srcdir>
-
-gentools_dir=$1
-gentools_srcdir=$2
-
-backslashify() {
- for x in $* ; do
- echo " \\"
- echo -n " $x"
- done
- echo ; echo
-}
-
-
-echo -n "generated_cpp = "
-backslashify `find * -name '*.cpp' -print`
-echo -n "generated_h = "
-backslashify `find * -name '*.h' -print`
-
-echo
-echo -n "java_sources ="
-backslashify `find $gentools_srcdir -name '*.java' -print`
-echo -n "cxx_templates ="
-backslashify `find $gentools_dir/templ.cpp -name '*.tmpl'`
-
-cat <<EOF
-# Empty rules in case one of these files is removed,
-# renamed or no longer generated.
-\$(spec):
-\$(java_sources):
-\$(cxx_templates):
-EOF
-
-
diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am
index 0d104c1470..f75b1c8ac9 100644
--- a/cpp/src/Makefile.am
+++ b/cpp/src/Makefile.am
@@ -1,9 +1,27 @@
SUBDIRS = . tests
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS)
+# Generated code
+-include generate.mk
+
+generate.mk $(generated_cpp) $(generated_h): generate.sh $(generator)
+ $(srcdir)/generate.sh
+
+# Empty rule in case a generator file is renamed/removed.
+$(generator):
+
+DISTCLEANFILES=generate.mk
+
+clean-gen:
+ rm -rf gen
-# -I top_builddir for config.h
-INCLUDES = -I$(top_builddir) -I$(top_srcdir)/gen
+maintainer-clean-local:
+ clean-gen
+
+EXTRA_DIST=generate.sh $(generated_cpp) $(generated_h) $(platform_dist)
+
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS)
+AM_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO_ARG)
+INCLUDES = -Igen
qpidd_LDADD = \
libqpidbroker.la \
@@ -43,11 +61,11 @@ posix_hdr = \
qpid/sys/posix/EventChannelThreads.h
if USE_APR
- EXTRA_DIST=$(posix_src) $(posix_hdr)
+ platform_dist=$(posix_src) $(posix_hdr)
platform_src = $(apr_src)
platform_hdr = $(apr_hdr)
else
- EXTRA_DIST=$(apr_src) $(apr_hdr)
+ platform_dist =$(apr_src) $(apr_hdr) $(generated_cpp) $(generated_h)
platform_src = $(posix_src)
platform_hdr = $(posix_hdr)
endif
@@ -59,11 +77,6 @@ libqpidcommon_la_LIBADD = \
$(APR_LIBS) \
$(LIB_DLOPEN) \
$(LIB_CLOCK_GETTIME)
-
-libqpidcommon_la_LDFLAGS = \
- -version-info \
- $(LIBTOOL_VERSION_INFO_ARG)
-
libqpidcommon_la_SOURCES = \
$(platform_src) \
qpid/framing/AMQBody.cpp \
@@ -90,10 +103,10 @@ libqpidcommon_la_SOURCES = \
qpid/framing/Correlator.cpp \
qpid/framing/Value.cpp \
qpid/framing/Proxy.cpp \
- ../gen/qpid/framing/AMQP_ClientProxy.cpp \
- ../gen/qpid/framing/AMQP_HighestVersion.h \
- ../gen/qpid/framing/AMQP_MethodVersionMap.cpp \
- ../gen/qpid/framing/AMQP_ServerProxy.cpp \
+ gen/qpid/framing/AMQP_ClientProxy.cpp \
+ gen/qpid/framing/AMQP_HighestVersion.h \
+ gen/qpid/framing/AMQP_MethodVersionMap.cpp \
+ gen/qpid/framing/AMQP_ServerProxy.cpp \
qpid/Exception.cpp \
qpid/ExceptionHolder.cpp \
qpid/QpidError.cpp \
@@ -104,7 +117,6 @@ libqpidcommon_la_SOURCES = \
libqpidbroker_la_LIBADD = libqpidcommon.la -ldaemon -lboost_filesystem
-libqpidbroker_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO_ARG)
libqpidbroker_la_SOURCES = \
qpid/broker/AccumulatedAck.cpp \
qpid/broker/AutoDelete.cpp \
@@ -145,7 +157,6 @@ libqpidbroker_la_SOURCES = \
qpid/broker/TxPublish.cpp
libqpidclient_la_LIBADD = libqpidcommon.la
-libqpidclient_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO_ARG)
libqpidclient_la_SOURCES = \
qpid/client/ClientConnection.cpp \
qpid/client/ClientChannel.cpp \
diff --git a/cpp/src/generate.sh b/cpp/src/generate.sh
new file mode 100755
index 0000000000..8614481ad0
--- /dev/null
+++ b/cpp/src/generate.sh
@@ -0,0 +1,46 @@
+# !/bin/sh
+# Generate code from AMQP specification.
+# srcdir must
+#
+srcdir=`dirname $0`
+set -e
+
+gentools_dir="$srcdir/../gentools"
+specs_dir="$srcdir/../../specs"
+specs="$specs_dir/amqp.0-9.xml $specs_dir/amqp-errata.0-9.xml"
+test -z "$JAVA" && JAVA=java ;
+test -z "$JAVAC" && JAVAC=javac ;
+
+# Can we generate code?
+if { test -d $gentools_dir && test -d $specs_dir && \
+ which $JAVA && which $JAVAC; } > /dev/null;
+then
+ echo "Generating code."
+ mkdir -p gen/qpid/framing
+ ( cd $gentools_dir/src && $JAVAC `find -name '*.java' -print` ; )
+ $JAVA -cp $gentools_dir/src org.apache.qpid.gentools.Main \
+ -c -o gen/qpid/framing -t $gentools_dir/templ.cpp $specs
+ GENERATED=yes
+fi
+
+# Print a Makefile variable assignment.
+make_assign() {
+ echo -n "$1 = "; shift
+ prefix=$1; shift
+ for f in $*; do echo "\\" ; echo -n " $prefix$f "; done
+ echo
+}
+
+# Generate a Makefile fragment
+(
+ make_assign "generated_cpp" "" `find gen -name '*.cpp' -print`
+ make_assign "generated_h" "" `find gen -name '*.h' -print`
+ if test x$GENERATED = xyes; then
+ make_assign "generator" "" $specs \
+ `find ../gentools \( -name '*.java' -o -name '*.tmpl' \) -print`
+ fi
+) > generate.mk-t
+mv generate.mk-t generate.mk
+
+
+
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index f9f241706f..0c08e0c6f7 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -59,16 +59,17 @@ TESTS_ENVIRONMENT = VALGRIND=$(VALGRIND) srcdir=$(srcdir)
CLIENT_TESTS = client_test quick_topictest
TESTS = run-unit-tests start_broker $(CLIENT_TESTS) python_tests kill_broker daemon_test
-EXTRA_DIST = \
- $(TESTS) \
- test_env \
- topictest \
- .valgrind.supp \
- .valgrindrc-default \
- InProcessBroker.h \
- MockChannel.h \
- MockConnectionInputHandler.h \
- TxMocks.h \
+EXTRA_DIST = \
+ test_env \
+ run-unit-tests start_broker python_tests kill_broker daemon_test \
+ quick_topictest \
+ topictest \
+ .valgrind.supp \
+ .valgrindrc-default \
+ InProcessBroker.h \
+ MockChannel.h \
+ MockConnectionInputHandler.h \
+ TxMocks.h \
qpid_test_plugin.h
include gen.mk