diff options
author | Michael Steinert <mike.steinert@gmail.com> | 2012-05-15 17:09:27 -0600 |
---|---|---|
committer | Michael Steinert <mike.steinert@gmail.com> | 2012-05-17 11:44:44 -0600 |
commit | fa9bf464a111549da2d6c7b51fc7eee321ebdc4c (patch) | |
tree | a498bbf9459b74fb8c38d3077cfc983a9a7ab484 | |
parent | b742300edabe34beb505139a818a000ef7767a91 (diff) | |
download | rabbitmq-c-github-ask-fa9bf464a111549da2d6c7b51fc7eee321ebdc4c.tar.gz |
Convert to non-recursive Automake
This change should speed up parallel builds considerably. It also
simplifies the structure of the build system making it possible to
properly track dependencies.
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
-rw-r--r-- | Makefile.am | 268 | ||||
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | examples/Makefile.am | 33 | ||||
-rw-r--r-- | librabbitmq/Makefile.am | 35 | ||||
-rw-r--r-- | tests/Makefile.am | 18 | ||||
-rw-r--r-- | tests/test_tables.c | 2 | ||||
-rw-r--r-- | tools/Makefile.am | 31 | ||||
-rw-r--r-- | tools/doc/Makefile.am | 42 | ||||
-rw-r--r-- | tools/doc/amqp-consume.xml (renamed from tools/doc/consume.xml) | 0 | ||||
-rw-r--r-- | tools/doc/amqp-declare-queue.xml (renamed from tools/doc/declare_queue.xml) | 0 | ||||
-rw-r--r-- | tools/doc/amqp-delete-queue.xml (renamed from tools/doc/delete_queue.xml) | 0 | ||||
-rw-r--r-- | tools/doc/amqp-get.xml (renamed from tools/doc/get.xml) | 0 | ||||
-rw-r--r-- | tools/doc/amqp-publish.xml (renamed from tools/doc/publish.xml) | 0 |
13 files changed, 264 insertions, 182 deletions
diff --git a/Makefile.am b/Makefile.am index a990faa..5a3d2dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,259 @@ +lib_LTLIBRARIES = librabbitmq/librabbitmq.la + +librabbitmq_librabbitmq_la_SOURCES = \ + librabbitmq/amqp_api.c \ + librabbitmq/amqp_connection.c \ + librabbitmq/amqp_framing.c \ + librabbitmq/amqp_mem.c \ + librabbitmq/amqp_private.h \ + librabbitmq/amqp_socket.c \ + librabbitmq/amqp_table.c \ + librabbitmq/amqp_url.c + +librabbitmq_librabbitmq_la_CFLAGS = \ + -I$(top_srcdir)/librabbitmq \ + -DBUILDING_LIBRABBITMQ + +if OS_UNIX +librabbitmq_librabbitmq_la_SOURCES += librabbitmq/unix/socket.c +librabbitmq_librabbitmq_la_SOURCES += librabbitmq/unix/socket.h +librabbitmq_librabbitmq_la_CFLAGS += -I$(top_srcdir)/librabbitmq/unix +endif + +if OS_WIN32 +librabbitmq_librabbitmq_la_SOURCES += librabbitmq/windows/socket.c +librabbitmq_librabbitmq_la_SOURCES += librabbitmq/windows/socket.h +librabbitmq_librabbitmq_la_CFLAGS += -I$(top_srcdir)/librabbitmq/windows +endif + +include_HEADERS = \ + librabbitmq/amqp.h \ + librabbitmq/amqp_framing.h + +BUILT_SOURCES = \ + librabbitmq/amqp_framing.h \ + librabbitmq/amqp_framing.c + +codegen_py = $(top_srcdir)/librabbitmq/codegen.py +amqp_codegen_json = $(top_srcdir)/codegen/amqp-rabbitmq-0.9.1.json + +librabbitmq/amqp_framing.h: $(amqp_codegen_json) $(codegen_py) + PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) header $< $@ + +librabbitmq/amqp_framing.c: $(amqp_codegen_json) $(codegen_py) + PYTHONPATH=$(top_srcdir)/codegen $(PYTHON) $(codegen_py) body $< $@ + +AM_CFLAGS = -I$(top_srcdir)/librabbitmq + +check_PROGRAMS = \ + tests/test_tables \ + tests/test_parse_url + +TESTS = $(check_PROGRAMS) + +tests_test_tables_SOURCES = tests/test_tables.c +tests_test_tables_LDADD = librabbitmq/librabbitmq.la + +tests_test_parse_url_SOURCES = tests/test_parse_url.c +tests_test_parse_url_LDADD = librabbitmq/librabbitmq.la + +noinst_LTLIBRARIES = examples/libutils.la + +examples_libutils_la_SOURCES = \ + examples/utils.c \ + examples/utils.h + +if OS_UNIX +examples_libutils_la_SOURCES += examples/unix/platform_utils.c +endif + +if OS_WIN32 +examples_libutils_la_SOURCES += examples/windows/platform_utils.c +endif + +noinst_PROGRAMS = \ + examples/amqp_bind \ + examples/amqp_consumer \ + examples/amqp_exchange_declare \ + examples/amqp_listen \ + examples/amqp_listenq \ + examples/amqp_producer \ + examples/amqp_sendstring \ + examples/amqp_unbind + +examples_amqp_sendstring_SOURCES = examples/amqp_sendstring.c +examples_amqp_sendstring_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_exchange_declare_SOURCES = examples/amqp_exchange_declare.c +examples_amqp_exchange_declare_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_listen_SOURCES = examples/amqp_listen.c +examples_amqp_listen_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_producer_SOURCES = examples/amqp_producer.c +examples_amqp_producer_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_consumer_SOURCES = examples/amqp_consumer.c +examples_amqp_consumer_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_unbind_SOURCES = examples/amqp_unbind.c +examples_amqp_unbind_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_bind_SOURCES = examples/amqp_bind.c +examples_amqp_bind_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + +examples_amqp_listenq_SOURCES = examples/amqp_listenq.c +examples_amqp_listenq_LDADD = \ + examples/libutils.la \ + librabbitmq/librabbitmq.la + if TOOLS -TOOLS_SUBDIR=tools -else -TOOLS_SUBDIR= +noinst_LTLIBRARIES += tools/libcommon.la + +tools_libcommon_la_SOURCES = \ + tools/common.c \ + tools/common.h +tools_libcommon_la_CFLAGS = \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools + +if OS_UNIX +tools_libcommon_la_SOURCES += tools/unix/process.c +tools_libcommon_la_SOURCES += tools/unix/process.h +tools_platform_CFLAGS = -I$(top_srcdir)/tools/unix endif -SUBDIRS=librabbitmq tests examples $(TOOLS_SUBDIR) +if OS_WIN32 +tools_libcommon_la_SOURCES += tools/windows/compat.c +tools_libcommon_la_SOURCES += tools/windows/compat.h +tools_libcommon_la_SOURCES += tools/windows/process.c +tools_libcommon_la_SOURCES += tools/windows/process.h +tools_platform_CFLAGS = -I$(top_srcdir)/tools/windows +endif + +bin_PROGRAMS = \ + tools/amqp-consume \ + tools/amqp-declare-queue \ + tools/amqp-delete-queue \ + tools/amqp-get \ + tools/amqp-publish + +tools_amqp_publish_SOURCES = tools/publish.c +tools_amqp_publish_CFLAGS = \ + $(POPT_CFLAGS) \ + $(tools_platform_CFLAGS) \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools +tools_amqp_publish_LDADD = \ + $(POPT_LIBS) \ + librabbitmq/librabbitmq.la \ + tools/libcommon.la + +tools_amqp_get_SOURCES = tools/get.c +tools_amqp_get_CFLAGS = \ + $(POPT_CFLAGS) \ + $(tools_platform_CFLAGS) \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools +tools_amqp_get_LDADD = \ + $(POPT_LIBS) \ + librabbitmq/librabbitmq.la \ + tools/libcommon.la + +tools_amqp_consume_SOURCES = tools/consume.c +tools_amqp_consume_CFLAGS = \ + $(POPT_CFLAGS) \ + $(tools_platform_CFLAGS) \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools +tools_amqp_consume_LDADD = \ + $(POPT_LIBS) \ + librabbitmq/librabbitmq.la \ + tools/libcommon.la + +tools_amqp_declare_queue_SOURCES = tools/declare_queue.c +tools_amqp_declare_queue_CFLAGS = \ + $(POPT_CFLAGS) \ + $(tools_platform_CFLAGS) \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools +tools_amqp_declare_queue_LDADD = \ + $(POPT_LIBS) \ + librabbitmq/librabbitmq.la \ + tools/libcommon.la + +tools_amqp_delete_queue_SOURCES = tools/delete_queue.c +tools_amqp_delete_queue_CFLAGS = \ + $(POPT_CFLAGS) \ + $(tools_platform_CFLAGS) \ + -I$(top_srcdir)/librabbitmq \ + -I$(top_srcdir)/tools +tools_amqp_delete_queue_LDADD = \ + $(POPT_LIBS) \ + librabbitmq/librabbitmq.la \ + tools/libcommon.la +if DOCS +man_MANS = \ + $(top_srcdir)/tools/doc/amqp-publish.1 \ + $(top_srcdir)/tools/doc/amqp-consume.1 \ + $(top_srcdir)/tools/doc/amqp-get.1 \ + $(top_srcdir)/tools/doc/amqp-declare-queue.1 \ + $(top_srcdir)/tools/doc/amqp-delete-queue.1 \ + $(top_srcdir)/tools/doc/librabbitmq-tools.7 + +# xmlto's --searchpath doesn't get passed through to xmllint, so we disable +# xmllint validation with --skip-validation for the benefit of build/source +# separation as required by distcheck, debian packaging etc. +XMLTO_FLAGS = \ + --skip-validation + +%.1: %.xml tools/doc/man-date.ent + $(XMLTO) $(XMLTO_FLAGS) -o $(top_srcdir)/tools/doc man $< + +%.7: %.xml tools/doc/man-date.ent + $(XMLTO) $(XMLTO_FLAGS) -o $(top_srcdir)/tools/doc man $< + +$(top_srcdir)/tools/doc/man-date.ent: + $(MKDIR_P) tools/doc + date +'%Y-%m-%d' > $@ +endif # DOCS +endif # TOOLS + +EXTRA_DIST = \ + $(man_MANS) \ + LICENSE-MIT \ + codegen \ + debian \ + librabbitmq/codegen.py \ + tests/test_tables.expected \ + tools/doc/amqp-consume.xml \ + tools/doc/amqp-declare-queue.xml \ + tools/doc/amqp-delete-queue.xml \ + tools/doc/amqp-get.xml \ + tools/doc/amqp-publish.xml \ + tools/doc/librabbitmq-tools.xml \ + tools/doc/man-date.ent -squeakyclean: maintainer-clean - rm -f Makefile.in librabbitmq/Makefile.in tests/Makefile.in examples/Makefile.in tools/Makefile.in - rm -f aclocal.m4 - rm -f config.guess config.h.in* config.sub configure - rm -f depcomp install-sh ltmain.sh missing - rm -rf codegen +MOSTLYCLEANFILES = \ + $(man_MANS) \ + tools/doc/man-date.ent -codegen: - mkdir -p $@ - cp -r "$(top_srcdir)/$(AMQP_CODEGEN_DIR)"/* $@ - $(MAKE) -C $@ clean +clean-local: + -$(MAKE) -C codegen clean -EXTRA_DIST=codegen debian LICENSE-MIT +distclean-local: + -$(MAKE) -C codegen distclean diff --git a/configure.ac b/configure.ac index e6aac32..aa0ae6d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([librabbitmq],[0.0.1],[support@rabbitmq.com]) AC_CONFIG_SRCDIR(librabbitmq/codegen.py) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([1.9 subdir-objects foreign -Wno-portability]) AC_CONFIG_HEADER([config.h]) @@ -54,6 +54,9 @@ if test "x$windows" = xyes ; then fi AC_SUBST(PLATFORM_DIR) +AM_CONDITIONAL([OS_UNIX], [test "x$windows" = "xno"]) +AM_CONDITIONAL([OS_WIN32], [test "x$windows" = "xyes"]) + dnl Enable -m64 if we were asked to do so AC_ARG_ENABLE(64-bit, [ --enable-64-bit produce 64-bit library], @@ -140,6 +143,11 @@ AS_IF([test "x$LIBPOPT" != "x"], [AC_MSG_FAILURE([You have libpopt, but could not find the popt.h header])]) ]) +POPT_CFLAGS= +POPT_LIBS=-lpopt +AC_SUBST([POPT_CFLAGS]) +AC_SUBST([POPT_LIBS]) + AM_CONDITIONAL(TOOLS, test "x$LIBPOPT" != "x") AC_ARG_WITH([xmlto], @@ -154,13 +162,8 @@ AS_IF([test "x$with_xmlto" != xno], AC_MSG_FAILURE([--with-xmlto was given, but xmlto not found]) fi]) -AM_CONDITIONAL(TOOLS_DOC, test "x$XMLTO" != "x") +AM_CONDITIONAL(DOCS, test "x$XMLTO" != "x") AC_OUTPUT( Makefile -librabbitmq/Makefile -tests/Makefile -examples/Makefile -tools/Makefile -tools/doc/Makefile ) diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index bde66bd..0000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -noinst_PROGRAMS = amqp_sendstring amqp_exchange_declare amqp_listen amqp_producer amqp_consumer amqp_unbind amqp_bind amqp_listenq - -# The -I to srcdir's librabbitmq is for the main amqp header -# files. The -I to builddir's librabbitmq is less obvious; it's for -# VPATH-based builds: the amqp_framing.h gets generated into the -# *build* directory, not the source directory. -AM_CFLAGS = -I$(top_srcdir)/librabbitmq -I$(top_builddir)/librabbitmq - -if GCC -# Because we want to build under Microsoft's C compiler (for which -# there is apparently no demand for C99 support), it's a good idea -# to have gcc tell us when we stray from the old standard. -AM_CFLAGS += -ansi -pedantic -endif - -if USE_MSINTTYPES -AM_CFLAGS += -I$(top_srcdir)/msinttypes -endif - -AM_LDFLAGS = $(top_builddir)/librabbitmq/librabbitmq.la - -noinst_HEADERS = utils.h - -COMMON_SOURCES = utils.c $(PLATFORM_DIR)/platform_utils.c - -amqp_sendstring_SOURCES = amqp_sendstring.c $(COMMON_SOURCES) -amqp_exchange_declare_SOURCES = amqp_exchange_declare.c $(COMMON_SOURCES) -amqp_listen_SOURCES = amqp_listen.c $(COMMON_SOURCES) -amqp_producer_SOURCES = amqp_producer.c $(COMMON_SOURCES) -amqp_consumer_SOURCES = amqp_consumer.c $(COMMON_SOURCES) -amqp_unbind_SOURCES = amqp_unbind.c $(COMMON_SOURCES) -amqp_bind_SOURCES = amqp_bind.c $(COMMON_SOURCES) -amqp_listenq_SOURCES = amqp_listenq.c $(COMMON_SOURCES) diff --git a/librabbitmq/Makefile.am b/librabbitmq/Makefile.am deleted file mode 100644 index f5908c3..0000000 --- a/librabbitmq/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -lib_LTLIBRARIES = librabbitmq.la - -AM_CFLAGS = -I$(srcdir)/$(PLATFORM_DIR) -DBUILDING_LIBRABBITMQ - -if GCC -# Because we want to build under Microsoft's C compiler (for which -# there is apparently no demand for C99 support), it's a good idea -# to have gcc tell us when we stray from the old standard. -AM_CFLAGS += -ansi -pedantic -endif - -if USE_MSINTTYPES -AM_CFLAGS += -I$(top_srcdir)/msinttypes -endif - -librabbitmq_la_SOURCES = amqp_mem.c amqp_table.c amqp_connection.c amqp_socket.c amqp_api.c amqp_url.c $(PLATFORM_DIR)/socket.c -librabbitmq_la_LDFLAGS = -no-undefined -librabbitmq_la_LIBADD = $(EXTRA_LIBS) -nodist_librabbitmq_la_SOURCES = amqp_framing.c -include_HEADERS = amqp_framing.h amqp.h -noinst_HEADERS = amqp_private.h $(PLATFORM_DIR)/socket.h -BUILT_SOURCES = amqp_framing.h amqp_framing.c -CLEANFILES = amqp_framing.h amqp_framing.c -EXTRA_DIST = \ - codegen.py \ - unix/socket.c unix/socket.h \ - windows/socket.c windows/socket.h - -CODEGEN_PY=$(srcdir)/codegen.py - -amqp_framing.h: $(top_srcdir)/$(AMQP_SPEC_JSON_PATH) $(CODEGEN_PY) - PYTHONPATH=$(top_srcdir)/$(AMQP_CODEGEN_DIR) $(PYTHON) $(CODEGEN_PY) header $< $@ - -amqp_framing.c: $(top_srcdir)/$(AMQP_SPEC_JSON_PATH) $(CODEGEN_PY) - PYTHONPATH=$(top_srcdir)/$(AMQP_CODEGEN_DIR) $(PYTHON) $(CODEGEN_PY) body $< $@ diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index ac694dc..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -check_PROGRAMS = test_tables test_parse_url -TESTS = $(check_PROGRAMS) -EXTRA_DIST = test_tables.expected - -AM_CFLAGS = -I$(top_srcdir)/librabbitmq - -if GCC -# Because we want to build under Microsoft's C compiler (for which -# there is apparently no demand for C99 support), it's a good idea -# to have gcc tell us when we stray from the old standard. -AM_CFLAGS += -ansi -pedantic -endif - -if USE_MSINTTYPES -AM_CFLAGS += -I$(top_srcdir)/msinttypes -endif - -AM_LDFLAGS = $(top_builddir)/librabbitmq/librabbitmq.la diff --git a/tests/test_tables.c b/tests/test_tables.c index 363b9f4..a01a9b0 100644 --- a/tests/test_tables.c +++ b/tests/test_tables.c @@ -438,7 +438,7 @@ static int compare_files(const char *f1, const char *f2) return res; } -const char *expected_file_name = "test_tables.expected"; +const char *expected_file_name = "tests/test_tables.expected"; int main(int argc, char **argv) { diff --git a/tools/Makefile.am b/tools/Makefile.am deleted file mode 100644 index 6fa1e4b..0000000 --- a/tools/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -SUBDIRS=doc - -bin_PROGRAMS = amqp-publish amqp-get amqp-consume amqp-declare-queue amqp-delete-queue - -# The -I to srcdir's librabbitmq is for the main amqp header -# files. The -I to builddir's librabbitmq is less obvious; it's for -# VPATH-based builds: the amqp_framing.h gets generated into the -# *build* directory, not the source directory. -AM_CFLAGS = -I$(top_srcdir)/librabbitmq -I$(srcdir)/$(PLATFORM_DIR) -I$(top_builddir)/librabbitmq -AM_LDFLAGS = $(top_builddir)/librabbitmq/librabbitmq.la - -LDADD=$(LIBPOPT) - -noinst_HEADERS = common.h $(PLATFORM_DIR)/process.h - -COMMON_SOURCES = common.c - -if WINDOWS -COMMON_SOURCES += windows/compat.c -endif - -amqp_publish_SOURCES = publish.c $(COMMON_SOURCES) -amqp_get_SOURCES = get.c $(COMMON_SOURCES) -amqp_consume_SOURCES = consume.c $(PLATFORM_DIR)/process.c $(COMMON_SOURCES) -amqp_declare_queue_SOURCES = declare_queue.c $(COMMON_SOURCES) -amqp_delete_queue_SOURCES = delete_queue.c $(COMMON_SOURCES) - -EXTRA_DIST = \ - unix/process.c unix/process.h \ - windows/process.c windows/process.h \ - windows/compat.c windows/compat.h diff --git a/tools/doc/Makefile.am b/tools/doc/Makefile.am deleted file mode 100644 index f482d94..0000000 --- a/tools/doc/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -EXTRA_DIST = \ - publish.xml \ - consume.xml \ - get.xml \ - declare_queue.xml \ - delete_queue.xml \ - librabbitmq-tools.xml - -if TOOLS_DOC -man_MANS = \ - amqp-publish.1 \ - amqp-consume.1 \ - amqp-get.1 \ - amqp-declare-queue.1 \ - amqp-delete-queue.1 \ - librabbitmq-tools.7 -MOSTLYCLEANFILES = man-date.ent $(man_MANS) - -# automake complains about % pattern rules, and suffix rules don't -# support multiple dependencies, so we have to expand all these out. -# -# Also, xmlto's --searchpath doesn't get passed through to xmllint, so -# we disable xmllint validation with --skip-validation for the benefit -# of build/source separation as required by distcheck, debian -# packaging etc. -amqp-publish.1: publish.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< -amqp-consume.1: consume.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< -amqp-get.1: get.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< -amqp-declare-queue.1: declare_queue.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< -amqp-delete-queue.1: delete_queue.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< -librabbitmq-tools.7: librabbitmq-tools.xml man-date.ent - $(XMLTO) --skip-validation --searchpath $(CURDIR) man $< - -man-date.ent: - date +'%Y-%m-%d' >$@ - -endif diff --git a/tools/doc/consume.xml b/tools/doc/amqp-consume.xml index b5f40d7..b5f40d7 100644 --- a/tools/doc/consume.xml +++ b/tools/doc/amqp-consume.xml diff --git a/tools/doc/declare_queue.xml b/tools/doc/amqp-declare-queue.xml index 0fc0440..0fc0440 100644 --- a/tools/doc/declare_queue.xml +++ b/tools/doc/amqp-declare-queue.xml diff --git a/tools/doc/delete_queue.xml b/tools/doc/amqp-delete-queue.xml index 040a384..040a384 100644 --- a/tools/doc/delete_queue.xml +++ b/tools/doc/amqp-delete-queue.xml diff --git a/tools/doc/get.xml b/tools/doc/amqp-get.xml index 08abe2b..08abe2b 100644 --- a/tools/doc/get.xml +++ b/tools/doc/amqp-get.xml diff --git a/tools/doc/publish.xml b/tools/doc/amqp-publish.xml index e609972..e609972 100644 --- a/tools/doc/publish.xml +++ b/tools/doc/amqp-publish.xml |