Switch to non-recursive makefiles

This approach should let Make work better, let libevent build faster
(especially when using a parallelized build), and basically make the
Makefiles easier to maintain.

See http://miller.emu.id.au/pmiller/books/rmch/ for more info on why
you'd want to do this.

This is due to an idea from Zack Weinberg; the patch is my own.
This commit is contained in:
Nick Mathewson 2012-08-28 15:58:18 -04:00
parent 7b18e5c633
commit 7092f3b677
6 changed files with 163 additions and 157 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@
# Autotools stuff
.deps
.dirstamp
Makefile
Makefile.in

View File

@ -125,7 +125,15 @@ else
noinst_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
endif
SUBDIRS = . include sample test
EXTRA_SOURCE=
noinst_HEADERS=
noinst_PROGRAMS=
EXTRA_PROGRAMS=
CLEANFILES=
BUILT_SOURCES =
include include/Makefile.am
include sample/Makefile.am
include test/Makefile.am
if BUILD_WIN32
@ -164,7 +172,7 @@ if SIGNAL_SUPPORT
SYS_SRC += signal.c
endif
BUILT_SOURCES = include/event2/event-config.h
BUILT_SOURCES += include/event2/event-config.h
include/event2/event-config.h: config.h make-event-config.sed
test -d include/event2 || $(MKDIR_P) include/event2
@ -189,7 +197,7 @@ CORE_SRC = \
strlcpy.c \
$(SYS_SRC)
EXTRA_SRC = \
EXTRAS_SRC = \
evdns.c \
event_tagging.c \
evrpc.c \
@ -205,7 +213,7 @@ endif
GENERIC_LDFLAGS = -version-info $(VERSION_INFO) $(RELEASE) $(NO_UNDEFINED)
libevent_la_SOURCES = $(CORE_SRC) $(EXTRA_SRC)
libevent_la_SOURCES = $(CORE_SRC) $(EXTRAS_SRC)
libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
libevent_la_LDFLAGS = $(GENERIC_LDFLAGS)
@ -219,7 +227,7 @@ libevent_pthreads_la_LIBADD = $(MAYBE_CORE)
libevent_pthreads_la_LDFLAGS = $(GENERIC_LDFLAGS)
endif
libevent_extra_la_SOURCES = $(EXTRA_SRC)
libevent_extra_la_SOURCES = $(EXTRAS_SRC)
libevent_extra_la_LIBADD = $(MAYBE_CORE) $(SYS_LIBS)
libevent_extra_la_LDFLAGS = $(GENERIC_LDFLAGS)
@ -230,7 +238,7 @@ libevent_openssl_la_LDFLAGS = $(GENERIC_LDFLAGS)
libevent_openssl_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_INCS)
endif
noinst_HEADERS = \
noinst_HEADERS += \
WIN32-Code/evconfig-private.h \
WIN32-Code/event2/event-config.h \
WIN32-Code/tree.h \

View File

@ -886,4 +886,4 @@ AC_SUBST([LIBEVENT_GC_SECTIONS])
AM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"])
AC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] )
AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile)
AC_OUTPUT(Makefile)

View File

@ -4,44 +4,42 @@
#
# See LICENSE for copying information.
AUTOMAKE_OPTIONS = foreign
include_event2dir = $(includedir)/event2
EVENT2_EXPORT = \
event2/buffer.h \
event2/buffer_compat.h \
event2/bufferevent.h \
event2/bufferevent_compat.h \
event2/bufferevent_ssl.h \
event2/bufferevent_struct.h \
event2/dns.h \
event2/dns_compat.h \
event2/dns_struct.h \
event2/event.h \
event2/event_compat.h \
event2/event_struct.h \
event2/http.h \
event2/http_compat.h \
event2/http_struct.h \
event2/keyvalq_struct.h \
event2/listener.h \
event2/rpc.h \
event2/rpc_compat.h \
event2/rpc_struct.h \
event2/tag.h \
event2/tag_compat.h \
event2/thread.h \
event2/util.h
include/event2/buffer.h \
include/event2/buffer_compat.h \
include/event2/bufferevent.h \
include/event2/bufferevent_compat.h \
include/event2/bufferevent_ssl.h \
include/event2/bufferevent_struct.h \
include/event2/dns.h \
include/event2/dns_compat.h \
include/event2/dns_struct.h \
include/event2/event.h \
include/event2/event_compat.h \
include/event2/event_struct.h \
include/event2/http.h \
include/event2/http_compat.h \
include/event2/http_struct.h \
include/event2/keyvalq_struct.h \
include/event2/listener.h \
include/event2/rpc.h \
include/event2/rpc_compat.h \
include/event2/rpc_struct.h \
include/event2/tag.h \
include/event2/tag_compat.h \
include/event2/thread.h \
include/event2/util.h
EXTRA_SRC = $(EVENT2_EXPORT)
## Without the nobase_ prefixing, Automake would strip "event2/" from
## Without the nobase_ prefixing, Automake would strip "include/event2/" from
## the source header filename to derive the installed header filename.
## With nobase_ the installed path is $(includedir)/event2/ev*.h.
## With nobase_ the installed path is $(includedir)/include/event2/ev*.h.
if INSTALL_LIBEVENT
nobase_include_HEADERS = $(EVENT2_EXPORT)
nobase_nodist_include_HEADERS = ./event2/event-config.h
include_event2_HEADERS = $(EVENT2_EXPORT)
nodist_include_event2_HEADERS = include/event2/event-config.h
else
noinst_HEADERS = $(EVENT2_EXPORT)
nodist_noinst_HEADERS = ./event2/event-config.h
noinst_HEADERS += $(EVENT2_EXPORT)
nodist_noinst_HEADERS = include/event2/event-config.h
endif

View File

@ -4,33 +4,37 @@
#
# See LICENSE for copying information.
AUTOMAKE_OPTIONS = foreign no-dependencies
LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include
noinst_PROGRAMS = \
dns-example \
event-read-fifo \
hello-world \
http-server \
signal-test \
time-test
event_read_fifo_SOURCES = event-read-fifo.c
time_test_SOURCES = time-test.c
signal_test_SOURCES = signal-test.c
dns_example_SOURCES = dns-example.c
hello_world_SOURCES = hello-world.c
http_server_SOURCES = http-server.c
SAMPLES = \
sample/dns-example \
sample/event-read-fifo \
sample/hello-world \
sample/http-server \
sample/signal-test \
sample/time-test
if OPENSSL
AM_CPPFLAGS += $(OPENSSL_INCS)
noinst_PROGRAMS += le-proxy
le_proxy_SOURCES = le-proxy.c
le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
SAMPLES += sample/le-proxy
sample_le_proxy_SOURCES = sample/le-proxy.c
sample_le_proxy_LDADD = libevent.la libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
sample_le_proxy_INCLUDES = $(OPENSSL_INCS)
endif
verify:
noinst_PROGRAMS += $(SAMPLES)
$(SAMPLES) : libevent.la
sample_event_read_fifo_SOURCES = sample/event-read-fifo.c
sample_event_read_fifo_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
sample_time_test_SOURCES = sample/time-test.c
sample_time_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
sample_signal_test_SOURCES = sample/signal-test.c
sample_signal_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
sample_dns_example_SOURCES = sample/dns-example.c
sample_dns_example_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
sample_hello_world_SOURCES = sample/hello-world.c
sample_hello_world_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
sample_http_server_SOURCES = sample/http-server.c
sample_http_server_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
DISTCLEANFILES = *~

View File

@ -4,124 +4,124 @@
#
# See LICENSE for copying information.
AUTOMAKE_OPTIONS = foreign
regress_CPPFLAGS = -DTINYTEST_LOCAL
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include -DTINYTEST_LOCAL
EXTRA_DIST+= \
test/check-dumpevents.py \
test/regress.gen.c \
test/regress.gen.h \
test/regress.rpc \
test/rpcgen_wrapper.sh \
test/test.sh
EXTRA_DIST = \
check-dumpevents.py \
regress.gen.c \
regress.gen.h \
regress.rpc \
rpcgen_wrapper.sh \
test.sh
TESTPROGRAMS = \
test/bench \
test/bench_cascade \
test/bench_http \
test/bench_httpclient \
test/test-changelist \
test/test-dumpevents \
test/test-eof \
test/test-fdleak \
test/test-init \
test/test-ratelim \
test/test-time \
test/test-weof \
test/regress
noinst_PROGRAMS = \
bench \
bench_cascade \
bench_http \
bench_httpclient \
test-changelist \
test-dumpevents \
test-eof \
test-fdleak \
test-init \
test-ratelim \
test-time \
test-weof
noinst_PROGRAMS += $(TESTPROGRAMS)
if BUILD_REGRESS
noinst_PROGRAMS += regress
noinst_PROGRAMS += test/regress
endif
EXTRA_PROGRAMS = regress
EXTRA_PROGRAMS+= test/regress
noinst_HEADERS = \
regress.h \
tinytest.h \
tinytest_local.h \
tinytest_macros.h
noinst_HEADERS+= \
test/regress.h \
test/tinytest.h \
test/tinytest_local.h \
test/tinytest_macros.h
TESTS = $(top_srcdir)/test/test.sh
BUILT_SOURCES =
if BUILD_REGRESS
BUILT_SOURCES += regress.gen.c regress.gen.h
BUILT_SOURCES += test/regress.gen.c test/regress.gen.h
endif
test_init_SOURCES = test-init.c
test_init_LDADD = ../libevent_core.la
test_dumpevents_SOURCES = test-dumpevents.c
test_dumpevents_LDADD = ../libevent_core.la
test_eof_SOURCES = test-eof.c
test_eof_LDADD = ../libevent_core.la
test_changelist_SOURCES = test-changelist.c
test_changelist_LDADD = ../libevent_core.la
test_weof_SOURCES = test-weof.c
test_weof_LDADD = ../libevent_core.la
test_time_SOURCES = test-time.c
test_time_LDADD = ../libevent_core.la
test_ratelim_SOURCES = test-ratelim.c
test_ratelim_LDADD = ../libevent_core.la -lm
test_fdleak_SOURCES = test-fdleak.c
test_fdleak_LDADD = ../libevent_core.la
test_test_init_SOURCES = test/test-init.c
test_test_init_LDADD = libevent_core.la
test_test_dumpevents_SOURCES = test/test-dumpevents.c
test_test_dumpevents_LDADD = libevent_core.la
test_test_eof_SOURCES = test/test-eof.c
test_test_eof_LDADD = libevent_core.la
test_test_changelist_SOURCES = test/test-changelist.c
test_test_changelist_LDADD = libevent_core.la
test_test_weof_SOURCES = test/test-weof.c
test_test_weof_LDADD = libevent_core.la
test_test_time_SOURCES = test/test-time.c
test_test_time_LDADD = libevent_core.la
test_test_ratelim_SOURCES = test/test-ratelim.c
test_test_ratelim_LDADD = libevent_core.la -lm
test_test_fdleak_SOURCES = test/test-fdleak.c
test_test_fdleak_LDADD = libevent_core.la
regress_SOURCES = \
regress.c \
regress.gen.c \
regress.gen.h \
regress_buffer.c \
regress_bufferevent.c \
regress_dns.c \
regress_et.c \
regress_http.c \
regress_listener.c \
regress_main.c \
regress_minheap.c \
regress_rpc.c \
regress_testutils.c \
regress_testutils.h \
regress_util.c \
tinytest.c \
test_regress_SOURCES = \
test/regress.c \
test/regress.gen.c \
test/regress.gen.h \
test/regress_buffer.c \
test/regress_bufferevent.c \
test/regress_dns.c \
test/regress_et.c \
test/regress_http.c \
test/regress_listener.c \
test/regress_main.c \
test/regress_minheap.c \
test/regress_rpc.c \
test/regress_testutils.c \
test/regress_testutils.h \
test/regress_util.c \
test/tinytest.c \
$(regress_thread_SOURCES) \
$(regress_zlib_SOURCES)
if PTHREADS
regress_thread_SOURCES = regress_thread.c
PTHREAD_LIBS += ../libevent_pthreads.la
regress_thread_SOURCES = test/regress_thread.c
PTHREAD_LIBS += libevent_pthreads.la
endif
if BUILD_WIN32
regress_thread_SOURCES = regress_thread.c
regress_thread_SOURCES = test/regress_thread.c
endif
if ZLIB_REGRESS
regress_zlib_SOURCES = regress_zlib.c
regress_zlib_SOURCES = test/regress_zlib.c
endif
if BUILD_WIN32
regress_SOURCES += regress_iocp.c
test_regress_SOURCES += test/regress_iocp.c
endif
regress_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
regress_LDFLAGS = $(PTHREAD_CFLAGS)
test_regress_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
test_regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
test_regress_LDFLAGS = $(PTHREAD_CFLAGS)
if OPENSSL
regress_SOURCES += regress_ssl.c
regress_LDADD += ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
test_regress_SOURCES += test/regress_ssl.c
test_regress_LDADD += libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
endif
bench_SOURCES = bench.c
bench_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
bench_cascade_SOURCES = bench_cascade.c
bench_cascade_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
bench_http_SOURCES = bench_http.c
bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
bench_httpclient_SOURCES = bench_httpclient.c
bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent_core.la
test_bench_SOURCES = test/bench.c
test_bench_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_cascade_SOURCES = test/bench_cascade.c
test_bench_cascade_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_http_SOURCES = test/bench_http.c
test_bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_httpclient_SOURCES = test/bench_httpclient.c
test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la
regress.gen.c regress.gen.h: rpcgen-attempted
test/regress.gen.c test/regress.gen.h: test/rpcgen-attempted
rpcgen-attempted: $(srcdir)/regress.rpc $(srcdir)/../event_rpcgen.py $(srcdir)/rpcgen_wrapper.sh
test/rpcgen-attempted: test/regress.rpc event_rpcgen.py test/rpcgen_wrapper.sh
date -u > $@
if $(srcdir)/rpcgen_wrapper.sh $(srcdir); then \
if $(srcdir)/test/rpcgen_wrapper.sh $(srcdir)/test; then \
echo "rpcgen okay"; \
else \
echo "No Python installed; stubbing out RPC test." >&2; \
@ -129,11 +129,6 @@ rpcgen-attempted: $(srcdir)/regress.rpc $(srcdir)/../event_rpcgen.py $(srcdir)/r
echo "#define NO_PYTHON_EXISTS" > regress.gen.h; \
fi
CLEANFILES = rpcgen-attempted
CLEANFILES += test/rpcgen-attempted
DISTCLEANFILES = *~
verify: check
bench test-init test-eof test-weof test-time test-changelist \
test-fdleak: ../libevent.la
$(TESTPROGRAMS) : libevent.la