diff options
author | Alan Conway <aconway@apache.org> | 2007-04-14 16:38:02 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-04-14 16:38:02 +0000 |
commit | 1b3168902f3e3c03288860e55ba02e5200606cff (patch) | |
tree | 1d7215ec8a0c762d86104df93acb62d18d8da0db /qpid | |
parent | f50d67546eda00e1b0ea875ea4043770405ce7b6 (diff) | |
download | qpid-python-1b3168902f3e3c03288860e55ba02e5200606cff.tar.gz |
* Moved code generation into top-level gen/ dir with own Makefile.am
to correctly install generated headers.
* Fixed gen-src.mk/Makefile dependency loop, bootstrap no longer needs
to pre-create gen-src.mk.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@528835 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r-- | qpid/cpp/Makefile.am | 2 | ||||
-rwxr-xr-x | qpid/cpp/bootstrap | 10 | ||||
-rw-r--r-- | qpid/cpp/configure.ac | 1 | ||||
-rw-r--r-- | qpid/cpp/docs/api/user.doxygen.in | 2 | ||||
-rw-r--r-- | qpid/cpp/gen/Makefile.am | 41 | ||||
-rwxr-xr-x | qpid/cpp/gen/gen-src-mk.sh | 36 | ||||
-rw-r--r-- | qpid/cpp/qpidc.spec.in | 1 | ||||
-rw-r--r-- | qpid/cpp/src/Makefile.am | 55 | ||||
-rwxr-xr-x | qpid/cpp/src/make-gen-src-mk.sh | 31 | ||||
-rw-r--r-- | qpid/cpp/src/qpidd.cpp | 4 | ||||
-rw-r--r-- | qpid/cpp/src/tests/Makefile.am | 2 |
11 files changed, 91 insertions, 94 deletions
diff --git a/qpid/cpp/Makefile.am b/qpid/cpp/Makefile.am index 1a7432ffe0..09c8b6d7c8 100644 --- a/qpid/cpp/Makefile.am +++ b/qpid/cpp/Makefile.am @@ -16,7 +16,7 @@ EXTRA_DIST = \ $(SPEC) $(SPEC).in $(PC) $(PC).in\ rpm/README.qpidd-devel -SUBDIRS = src docs/api docs/man +SUBDIRS = gen src docs/api docs/man # Update libtool, if needed. libtool: $(LIBTOOL_DEPS) diff --git a/qpid/cpp/bootstrap b/qpid/cpp/bootstrap index 55bb6152a1..d911a3bfd1 100755 --- a/qpid/cpp/bootstrap +++ b/qpid/cpp/bootstrap @@ -12,16 +12,6 @@ export JAVA JAVAC # If we're building in the qpid tree, we can generate # some Makefile snippets: -if test -d ../specs; then - # Transform gen/Makefile.am, removing automake-constructs and the - # contents of the sole automake-else clause (the warning), then - # use the result to run the rules that create gen-src.mk, a file - # that must be created before we run automake. - (cd src && rm -f gen/gen-src.mk - perl -ne '/warning:|^(if|else|endif|include)\b/ or print' Makefile.am \ - | make -f - srcdir=. gen/gen-src.mk > /dev/null ) -fi - # 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/qpid/cpp/configure.ac b/qpid/cpp/configure.ac index 715b28e2e3..b180559e40 100644 --- a/qpid/cpp/configure.ac +++ b/qpid/cpp/configure.ac @@ -142,6 +142,7 @@ AC_CONFIG_FILES([ qpidc.pc qpidc.spec Makefile + gen/Makefile src/Makefile src/tests/Makefile docs/man/Makefile diff --git a/qpid/cpp/docs/api/user.doxygen.in b/qpid/cpp/docs/api/user.doxygen.in index 5c390cc9c8..ea50311ce6 100644 --- a/qpid/cpp/docs/api/user.doxygen.in +++ b/qpid/cpp/docs/api/user.doxygen.in @@ -467,7 +467,7 @@ WARN_LOGFILE = doxygen.log # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = @abs_top_srcdir@/src +INPUT = @abs_top_srcdir@/src @abs_top_builddir@/gen # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/qpid/cpp/gen/Makefile.am b/qpid/cpp/gen/Makefile.am new file mode 100644 index 0000000000..de524374e1 --- /dev/null +++ b/qpid/cpp/gen/Makefile.am @@ -0,0 +1,41 @@ +# +# Generate code from AMQP XML specification. +# +-include gen-src.mk + +BUILT_SOURCES = gen-src.mk $(generated_cpp) $(generated_h) + +# Distribute the generated sources, since the code generator depends +# on tools that may not be available in the build environment. +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 + +qpid $(generated_cpp) $(generated_h): $(spec) $(java_sources) $(cxx_templates) + rm -rf qpid + 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 + +gen-src.mk: qpid gen-src-mk.sh + ./gen-src-mk.sh $(gentools_dir) $(gentools_srcdir) > $@-t + mv $@-t $@ + +endif + +maintainer-clean-local: + rm -rf qpid gen-src.mk $(gentools_srcdir)/*.class + diff --git a/qpid/cpp/gen/gen-src-mk.sh b/qpid/cpp/gen/gen-src-mk.sh new file mode 100755 index 0000000000..c17bc14307 --- /dev/null +++ b/qpid/cpp/gen/gen-src-mk.sh @@ -0,0 +1,36 @@ +#!/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/qpid/cpp/qpidc.spec.in b/qpid/cpp/qpidc.spec.in index 0e88ac4d7c..d0dba86011 100644 --- a/qpid/cpp/qpidc.spec.in +++ b/qpid/cpp/qpidc.spec.in @@ -102,7 +102,6 @@ make check %_includedir/qpid/*.h %_includedir/qpid/client %_includedir/qpid/framing -%_includedir/qpid/gen %_includedir/qpid/sys %_libdir/libqpidcommon.so %_libdir/libqpidclient.so diff --git a/qpid/cpp/src/Makefile.am b/qpid/cpp/src/Makefile.am index 5e713425af..d6f0c387fd 100644 --- a/qpid/cpp/src/Makefile.am +++ b/qpid/cpp/src/Makefile.am @@ -1,21 +1,16 @@ -include gen/gen-src.mk - -BUILT_SOURCES = $(generated_sources) $(generated_headers) - SUBDIRS = . tests AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) -gen = gen/qpid/framing +gen_framing = $(top_builddir)/gen/qpid/framing framing= qpid/framing broker = qpid/broker client = qpid/client apr = qpid/sys/apr posix = qpid/sys/posix - # -I top_builddir for config.h -INCLUDES = -I$(top_builddir) -I$(srcdir)/qpid -Igen +INCLUDES = -I$(top_builddir) -I$(top_builddir)/gen qpidd_LDADD = \ libqpidbroker.la \ @@ -95,10 +90,10 @@ libqpidcommon_la_SOURCES = \ $(framing)/Correlator.cpp \ $(framing)/Value.cpp \ $(framing)/Proxy.cpp \ - $(gen)/AMQP_ClientProxy.cpp \ - $(gen)/AMQP_HighestVersion.h \ - $(gen)/AMQP_MethodVersionMap.cpp \ - $(gen)/AMQP_ServerProxy.cpp \ + $(gen_framing)/AMQP_ClientProxy.cpp \ + $(gen_framing)/AMQP_HighestVersion.h \ + $(gen_framing)/AMQP_MethodVersionMap.cpp \ + $(gen_framing)/AMQP_ServerProxy.cpp \ qpid/Exception.cpp \ qpid/ExceptionHolder.cpp \ qpid/QpidError.cpp \ @@ -158,7 +153,6 @@ libqpidclient_la_SOURCES = \ $(client)/ResponseHandler.cpp \ $(client)/ReturnedMessageHandler.cpp -include_HEADERS = gen/qpid nobase_include_HEADERS = \ $(platform_hdr) \ $(broker)/AccumulatedAck.h \ @@ -284,38 +278,5 @@ nobase_include_HEADERS = \ qpid/SharedObject.h \ qpid/shared_ptr.h -# Distribute the generated sources, at least for now, since -# the generator code is in java. -EXTRA_DIST += $(BUILT_SOURCES) - -# 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 = $(srcdir)/../gentools -spec_dir = $(srcdir)/../../specs -spec = $(spec_dir)/amqp.0-9.xml $(spec_dir)/amqp-errata.0-9.xml -gentools_srcdir = $(gentools_dir)/src/org/apache/qpid/gentools - -$(BUILT_SOURCES) $(gen): $(spec) $(java_sources) $(cxx_templates) Makefile.am - rm -rf $(gen) - mkdir -p $(gen) - cd $(gentools_srcdir) && rm -f *.class && $(JAVAC) *.java - $(JAVA) -cp $(gentools_dir)/src org.apache.qpid.gentools.Main \ - -c -o $(gen) -t $(gentools_dir)/templ.cpp $(spec) - touch $(gen) - -gen/gen-src.mk: $(gen) - ./make-gen-src-mk.sh $(gentools_dir) $(gentools_srcdir) $(gen) > $@-t - mv $@-t $@ - -endif - -maintainer-clean: - rm -f $(gentools_srcdir)/*.class - rm -f $(gen) - -# Force build during dist phase so help2man will work. -dist-hook: $(lib_LTLIBRARIES) $(sbin_PROGRAMS) +# Force build of qpidd during dist phase so help2man will work. +dist-hook: qpidd diff --git a/qpid/cpp/src/make-gen-src-mk.sh b/qpid/cpp/src/make-gen-src-mk.sh deleted file mode 100755 index 21655e5512..0000000000 --- a/qpid/cpp/src/make-gen-src-mk.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# Generates the gen-src.mk makefile fragment, to stdout. -# Usage: <gentools_dir> <gentools_srcdir> - -gentools_dir=$1 -gentools_srcdir=$2 -gen=$3 - -wildcard() { echo `ls $* 2>/dev/null` ; } - -cat <<EOF -generated_sources = `wildcard $gen/*.cpp` - -generated_headers = `wildcard $gen/*.h` - -if CAN_GENERATE_CODE - -java_sources = `wildcard $gentools_srcdir/*.java` - -cxx_templates = `wildcard $gentools_dir/templ.cpp/*.tmpl` - -# Empty rules in case one of these files is removed, -# renamed or no longer generated. -\$(spec): -\$(java_sources): -\$(cxx_templates): -endif - -EOF - - diff --git a/qpid/cpp/src/qpidd.cpp b/qpid/cpp/src/qpidd.cpp index c00b0e5351..855dbb1f2f 100644 --- a/qpid/cpp/src/qpidd.cpp +++ b/qpid/cpp/src/qpidd.cpp @@ -18,8 +18,8 @@ * under the License. * */ -#include "broker/Broker.h" -#include "broker/Configuration.h" +#include "qpid/broker/Broker.h" +#include "qpid/broker/Configuration.h" #include <signal.h> #include <iostream> #include <memory> diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am index 388da8e9a9..34a513d583 100644 --- a/qpid/cpp/src/tests/Makefile.am +++ b/qpid/cpp/src/tests/Makefile.am @@ -1,5 +1,5 @@ AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS) -INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen +INCLUDES = -I$(srcdir)/.. -I$(top_builddir)/gen # Unit tests broker_unit_tests = \ |