[tor-commits] [tor/master] Simplify AM_CPPFLAGS include setup

nickm at torproject.org nickm at torproject.org
Wed Jun 20 13:49:47 UTC 2018


commit 257b28077676f6d8a3c0d2beef37a9414c747de9
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jun 20 09:25:50 2018 -0400

    Simplify AM_CPPFLAGS include setup
    
    We had accumulated a bunch of cruft here.  Now let's only include
    src and src/ext.  (exception: src/trunnel is autogenerated code, and
    need to include src/trunnel.)
    
    This commit will break the build hard.  The next commit will fix it.
---
 Makefile.am            |  6 +++++-
 configure.ac           | 10 ----------
 src/common/include.am  |  4 ----
 src/or/include.am      |  1 -
 src/test/include.am    | 12 +++++-------
 src/trace/include.am   |  3 ---
 src/trunnel/include.am |  6 ++----
 7 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 744021367..cc89c7264 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,11 @@ TESTS=
 noinst_PROGRAMS=
 DISTCLEANFILES=
 bin_SCRIPTS=
-AM_CPPFLAGS=
+AM_CPPFLAGS=\
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/src/ext \
+	-I$(top_srcdir)/src/ext/trunnel
+
 AM_CFLAGS=@TOR_SYSTEMD_CFLAGS@ @CFLAGS_BUGTRAP@ @TOR_LZMA_CFLAGS@ @TOR_ZSTD_CFLAGS@
 SHELL=@SHELL@
 
diff --git a/configure.ac b/configure.ac
index ebdda284f..8a0d135c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,16 +21,6 @@ AC_CANONICAL_HOST
 
 PKG_PROG_PKG_CONFIG
 
-if test -f "/etc/redhat-release"; then
-  if test -f "/usr/kerberos/include"; then
-    CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
-  fi
-fi
-
-# Not a no-op; we want to make sure that CPPFLAGS is set before we use
-# the += operator on it in src/or/Makefile.am
-CPPFLAGS="$CPPFLAGS -I\${top_srcdir}/src/common"
-
 AC_ARG_ENABLE(openbsd-malloc,
    AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD.  Linux only]))
 AC_ARG_ENABLE(static-openssl,
diff --git a/src/common/include.am b/src/common/include.am
index 5f96aa9f9..724473c14 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -15,9 +15,6 @@ endif
 
 EXTRA_DIST += src/common/Makefile.nmake
 
-#CFLAGS  = -Wall -Wpointer-arith -O2
-AM_CPPFLAGS += -I$(srcdir)/src/common -Isrc/common -I$(srcdir)/src/ext/trunnel -I$(srcdir)/src/trunnel
-
 if USE_OPENBSD_MALLOC
 libor_extra_source=src/ext/OpenBSD_malloc_Linux.c
 else
@@ -214,4 +211,3 @@ COMMONHEADERS = \
   src/common/workqueue.h
 
 noinst_HEADERS+= $(COMMONHEADERS)
-
diff --git a/src/or/include.am b/src/or/include.am
index 11e1a7c86..19bcaec65 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -142,7 +142,6 @@ src_or_libtor_testing_a_SOURCES =
 endif
 
 src_or_tor_SOURCES = src/or/tor_main.c
-AM_CPPFLAGS += -I$(srcdir)/src/or -Isrc/or
 
 src/or/tor_main.$(OBJEXT) \
   src/or/src_or_tor_cov-tor_main.$(OBJEXT): micro-revision.i
diff --git a/src/test/include.am b/src/test/include.am
index 2ae598b22..d7f2d573a 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -71,10 +71,8 @@ endif
 src_test_AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
         -DLOCALSTATEDIR="\"$(localstatedir)\"" \
         -DBINDIR="\"$(bindir)\""	       \
-	-I"$(top_srcdir)/src/or" -I"$(top_srcdir)/src/ext" \
-	-I"$(top_srcdir)/src/trunnel" \
-	-I"$(top_srcdir)/src/ext/trunnel" \
-	-DTOR_UNIT_TESTS
+	-DTOR_UNIT_TESTS                       \
+	$(AM_CPPFLAGS)
 
 # -L flags need to go in LDFLAGS. -l flags need to go in LDADD.
 # This seems to matter nowhere but on Windows, but I assure you that it
@@ -327,7 +325,7 @@ src_test_test_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
 	@TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
 	@CURVE25519_LIBS@ @TOR_LZMA_LIBS@
 src_test_test_ntor_cl_AM_CPPFLAGS =	       \
-	-I"$(top_srcdir)/src/or"
+	$(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@
@@ -337,7 +335,7 @@ src_test_test_hs_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \
 	@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 =	       \
-	-I"$(top_srcdir)/src/or"
+	$(AM_CPPFLAGS)
 
 
 noinst_PROGRAMS += src/test/test-bt-cl
@@ -347,7 +345,7 @@ src_test_test_bt_cl_LDADD = src/common/libor-testing.a \
 	src/trace/libor-trace.a \
 	$(rust_ldadd) \
 	@TOR_LIB_MATH@ \
-	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ 
+	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@
 src_test_test_bt_cl_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
 src_test_test_bt_cl_CPPFLAGS= $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS)
 
diff --git a/src/trace/include.am b/src/trace/include.am
index 3285b04de..5e5eaaf9b 100644
--- a/src/trace/include.am
+++ b/src/trace/include.am
@@ -1,6 +1,3 @@
-# Include the src/ so we can use the trace/events.h statement when including
-# any file in that directory.
-AM_CPPFLAGS += -I$(srcdir)/src
 
 noinst_LIBRARIES += \
 	src/trace/libor-trace.a
diff --git a/src/trunnel/include.am b/src/trunnel/include.am
index b249fb302..5a0a79c3a 100644
--- a/src/trunnel/include.am
+++ b/src/trunnel/include.am
@@ -6,8 +6,6 @@ noinst_LIBRARIES += \
 	src/trunnel/libor-trunnel-testing.a
 endif
 
-AM_CPPFLAGS += -I$(srcdir)/src/ext/trunnel -I$(srcdir)/src/trunnel
-
 TRUNNELINPUTS = \
 	src/trunnel/ed25519_cert.trunnel \
 	src/trunnel/link_handshake.trunnel \
@@ -39,7 +37,8 @@ TRUNNELHEADERS = \
 	src/trunnel/channelpadding_negotiation.h
 
 src_trunnel_libor_trunnel_a_SOURCES = $(TRUNNELSOURCES)
-src_trunnel_libor_trunnel_a_CPPFLAGS = -DTRUNNEL_LOCAL_H $(AM_CPPFLAGS)
+src_trunnel_libor_trunnel_a_CPPFLAGS = \
+	-DTRUNNEL_LOCAL_H $(AM_CPPFLAGS) -I$(top_srcdir)/src/trunnel
 
 if UNITTESTS_ENABLED
 src_trunnel_libor_trunnel_testing_a_SOURCES = $(TRUNNELSOURCES)
@@ -54,4 +53,3 @@ noinst_HEADERS+= $(TRUNNELHEADERS)
 
 EXTRA_DIST += \
 	src/trunnel/README
-





More information about the tor-commits mailing list