[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Refactor makefiles to keep list of internal libraries in one place.



commit b2346b12019c45288bbae3bd009fe0bafe80ff58
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Jun 21 10:34:29 2018 -0400

    Refactor makefiles to keep list of internal libraries in one place.
    
    This change makes it possible for us to change the list of libraries
    more easily, without changing every single linker line.
---
 Makefile.am              | 47 +++++++++++++++++++++++++++++++++++++++++++++
 src/or/include.am        | 10 ++--------
 src/test/fuzz/include.am | 18 ++---------------
 src/test/include.am      | 50 +++++++++++++++---------------------------------
 src/tools/include.am     | 25 +++++++++++-------------
 5 files changed, 77 insertions(+), 73 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 3c10c7f95..579b9a089 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,6 +37,53 @@ else
 rust_ldadd=
 endif
 
+# "Common" libraries used to link tor's utility code.
+TOR_UTIL_LIBS = \
+	src/common/libor.a \
+	src/common/libor-ctime.a
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_UTIL_TESTING_LIBS = \
+	src/common/libor-testing.a \
+	src/common/libor-ctime-testing.a
+
+# Internal crypto libraries used in Tor
+TOR_CRYPTO_LIBS = \
+	src/common/libor-crypto.a \
+	$(LIBKECCAK_TINY) \
+	$(LIBDONNA)
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_CRYPTO_TESTING_LIBS = \
+	src/common/libor-crypto-testing.a \
+	$(LIBKECCAK_TINY) \
+	$(LIBDONNA)
+
+# All static libraries used to link tor.
+TOR_INTERNAL_LIBS = \
+	src/or/libtor.a \
+	$(TOR_CRYPTO_LIBS) \
+	$(TOR_UTIL_LIBS) \
+	src/common/libor-event.a \
+	src/trunnel/libor-trunnel.a \
+	src/trace/libor-trace.a
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_INTERNAL_TESTING_LIBS = \
+	src/or/libtor-testing.a \
+	$(TOR_CRYPTO_TESTING_LIBS) \
+	$(TOR_UTIL_TESTING_LIBS) \
+	$(LIBKECCAK_TINY) \
+	$(LIBDONNA) \
+	src/common/libor-event-testing.a \
+	src/trunnel/libor-trunnel-testing.a \
+	src/trace/libor-trace.a
+
+# All libraries used to link tor-cov
+
 include src/include.am
 include doc/include.am
 include contrib/include.am
diff --git a/src/or/include.am b/src/or/include.am
index 19bcaec65..3c54551d7 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -159,10 +159,7 @@ src_or_libtor_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 
 
 src_or_tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
-src_or_tor_LDADD = src/or/libtor.a src/common/libor.a src/common/libor-ctime.a \
-	src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
-	src/common/libor-event.a src/trunnel/libor-trunnel.a \
-	src/trace/libor-trace.a \
+src_or_tor_LDADD = $(TOR_INTERNAL_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
 	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -174,10 +171,7 @@ src_or_tor_cov_SOURCES = src/or/tor_main.c
 src_or_tor_cov_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
 src_or_tor_cov_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 src_or_tor_cov_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
-src_or_tor_cov_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/common/libor-crypto-testing.a $(LIBKECCAK_TINY) $(LIBDONNA) \
-	src/common/libor-event-testing.a src/trunnel/libor-trunnel-testing.a \
+src_or_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
 	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
 	@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
diff --git a/src/test/fuzz/include.am b/src/test/fuzz/include.am
index cd16dc05b..46f74ee82 100644
--- a/src/test/fuzz/include.am
+++ b/src/test/fuzz/include.am
@@ -7,14 +7,7 @@ FUZZING_CFLAGS = \
 FUZZING_LDFLAG = \
 	@TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
 FUZZING_LIBS = \
-	src/or/libtor-testing.a \
-	src/common/libor-crypto-testing.a \
-	$(LIBKECCAK_TINY) \
-	$(LIBDONNA) \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/common/libor-event-testing.a \
-	src/trunnel/libor-trunnel-testing.a \
+	$(TOR_INTERNAL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
 	@TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
@@ -24,14 +17,7 @@ FUZZING_LIBS = \
 	@TOR_ZSTD_LIBS@
 
 oss-fuzz-prereqs: \
-	src/or/libtor-testing.a \
-	src/common/libor-crypto-testing.a \
-	$(LIBKECCAK_TINY) \
-	$(LIBDONNA) \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/common/libor-event-testing.a \
-	src/trunnel/libor-trunnel-testing.a
+        $(TOR_INTERNAL_TESTING_LIBS)
 
 noinst_HEADERS += \
 	src/test/fuzz/fuzzing.h
diff --git a/src/test/include.am b/src/test/include.am
index 41c7848fa..0f0dc6a7f 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -220,8 +220,7 @@ src_test_test_switch_id_CPPFLAGS= $(src_test_AM_CPPFLAGS)
 src_test_test_switch_id_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 src_test_test_switch_id_LDFLAGS = @TOR_LDFLAGS_zlib@
 src_test_test_switch_id_LDADD = \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
+	$(TOR_UTIL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
 	@TOR_LIB_WS32@ @TOR_LIB_USERENV@ \
@@ -229,15 +228,8 @@ src_test_test_switch_id_LDADD = \
 
 src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
-src_test_test_LDADD = src/or/libtor-testing.a \
-	src/common/libor-crypto-testing.a \
-	$(LIBKECCAK_TINY) \
-	$(LIBDONNA) \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/common/libor-event-testing.a \
-	src/trunnel/libor-trunnel-testing.a \
-	src/trace/libor-trace.a \
+src_test_test_LDADD = \
+        $(TOR_INTERNAL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -259,11 +251,8 @@ src_test_test_memwipe_LDFLAGS = $(src_test_test_LDFLAGS) @CFLAGS_BUGTRAP@
 
 src_test_bench_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
-src_test_bench_LDADD = src/or/libtor.a src/common/libor.a \
-	src/common/libor-ctime.a \
-	src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
-	src/common/libor-event.a src/trunnel/libor-trunnel.a \
-	src/trace/libor-trace.a \
+src_test_bench_LDADD = \
+        $(TOR_INTERNAL_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -272,12 +261,8 @@ src_test_bench_LDADD = src/or/libtor.a src/common/libor.a \
 
 src_test_test_workqueue_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
         @TOR_LDFLAGS_libevent@
-src_test_test_workqueue_LDADD = src/or/libtor-testing.a \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/common/libor-crypto-testing.a $(LIBKECCAK_TINY) $(LIBDONNA) \
-	src/common/libor-event-testing.a \
-	src/trace/libor-trace.a \
+src_test_test_workqueue_LDADD = \
+        $(TOR_INTERNAL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -287,10 +272,9 @@ src_test_test_workqueue_LDADD = src/or/libtor-testing.a \
 src_test_test_timers_CPPFLAGS = $(src_test_test_CPPFLAGS)
 src_test_test_timers_CFLAGS = $(src_test_test_CFLAGS)
 src_test_test_timers_LDADD = \
-	src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
 	src/common/libor-event-testing.a \
-	src/common/libor-crypto-testing.a $(LIBKECCAK_TINY) $(LIBDONNA) \
+	$(TOR_CRYPTO_TESTING_LIBS) \
+	$(TOR_UTIL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -319,10 +303,8 @@ noinst_PROGRAMS+= src/test/test-ntor-cl
 noinst_PROGRAMS+= src/test/test-hs-ntor-cl
 src_test_test_ntor_cl_SOURCES  = src/test/test_ntor_cl.c
 src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
-src_test_test_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
-	src/common/libor-ctime.a \
-	src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
-	src/trace/libor-trace.a \
+src_test_test_ntor_cl_LDADD = \
+        $(TOR_INTERNAL_LIBS) \
 	$(rust_ldadd) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -332,9 +314,8 @@ src_test_test_ntor_cl_AM_CPPFLAGS =	       \
 
 src_test_test_hs_ntor_cl_SOURCES  = src/test/test_hs_ntor_cl.c
 src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
-src_test_test_hs_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
-	src/common/libor-ctime.a \
-	src/common/libor-crypto.a $(LIBKECCAK_TINY) $(LIBDONNA) \
+src_test_test_hs_ntor_cl_LDADD = \
+	$(TOR_INTERNAL_LIBS) \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
 src_test_test_hs_ntor_cl_AM_CPPFLAGS =	       \
@@ -343,9 +324,8 @@ src_test_test_hs_ntor_cl_AM_CPPFLAGS =	       \
 
 noinst_PROGRAMS += src/test/test-bt-cl
 src_test_test_bt_cl_SOURCES = src/test/test_bt_cl.c
-src_test_test_bt_cl_LDADD = src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
-	src/trace/libor-trace.a \
+src_test_test_bt_cl_LDADD = \
+	$(TOR_UTIL_TESTING_LIBS) \
 	$(rust_ldadd) \
 	@TOR_LIB_MATH@ \
 	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@
diff --git a/src/tools/include.am b/src/tools/include.am
index 016cf3b12..bbccb6d18 100644
--- a/src/tools/include.am
+++ b/src/tools/include.am
@@ -6,26 +6,25 @@ endif
 
 src_tools_tor_resolve_SOURCES = src/tools/tor-resolve.c
 src_tools_tor_resolve_LDFLAGS =
-src_tools_tor_resolve_LDADD = src/common/libor.a \
-	src/common/libor-ctime.a \
+src_tools_tor_resolve_LDADD = \
+        $(TOR_UTIL_LIBS) \
 	$(rust_ldadd) \
-	@TOR_LIB_MATH@ @TOR_LIB_WS32@ @TOR_LIB_USERENV@ 
+	@TOR_LIB_MATH@ @TOR_LIB_WS32@ @TOR_LIB_USERENV@
 
 if COVERAGE_ENABLED
 src_tools_tor_cov_resolve_SOURCES = src/tools/tor-resolve.c
 src_tools_tor_cov_resolve_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
 src_tools_tor_cov_resolve_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
-src_tools_tor_cov_resolve_LDADD = src/common/libor-testing.a \
-	src/common/libor-ctime-testing.a \
+src_tools_tor_cov_resolve_LDADD = \
+        $(TOR_UTIL_TESTING_LIBS) \
 	@TOR_LIB_MATH@ @TOR_LIB_WS32@
 endif
 
 src_tools_tor_gencert_SOURCES = src/tools/tor-gencert.c
 src_tools_tor_gencert_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
-src_tools_tor_gencert_LDADD = src/common/libor.a src/common/libor-crypto.a \
-	src/common/libor-ctime.a \
-	$(LIBKECCAK_TINY) \
-	$(LIBDONNA) \
+src_tools_tor_gencert_LDADD = \
+        $(TOR_CRYPTO_LIBS) \
+        $(TOR_UTIL_LIBS) \
 	$(rust_ldadd) \
 	@TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ \
 	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@
@@ -35,11 +34,9 @@ src_tools_tor_cov_gencert_SOURCES = src/tools/tor-gencert.c
 src_tools_tor_cov_gencert_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
 src_tools_tor_cov_gencert_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 src_tools_tor_cov_gencert_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
-src_tools_tor_cov_gencert_LDADD = src/common/libor-testing.a \
-    src/common/libor-crypto-testing.a \
-    src/common/libor-ctime-testing.a \
-    $(LIBKECCAK_TINY) \
-    $(LIBDONNA) \
+src_tools_tor_cov_gencert_LDADD = \
+    $(TOR_CRYPTO_TESTING_LIBS) \
+    $(TOR_UTIL_TESTING_LIBS) \
     @TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ \
     @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
 endif



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits