Browse Source

Use output variables instead of relative paths.

Fixes the following rules in out-of-tree builds;
- check-spaces
- check-docs
- check-logs
- Doxygen
- coverage-html

And cleans up additional directories;
- coverage_html
- doc/doxygen
cypherpunks 5 years ago
parent
commit
17cbc4350f
5 changed files with 35 additions and 31 deletions
  1. 3 3
      Doxyfile.in
  2. 20 17
      Makefile.am
  3. 2 2
      doc/include.am
  4. 5 4
      src/or/include.am
  5. 5 5
      src/test/include.am

+ 3 - 3
Doxyfile.in

@@ -38,7 +38,7 @@ PROJECT_NUMBER         = @VERSION@
 # If a relative path is entered, it will be relative to the location 
 # where doxygen was started. If left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       = ./doc/doxygen
+OUTPUT_DIRECTORY       = @top_builddir@/doc/doxygen
 
 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
 # 4096 sub-directories (in 2 levels) under the output directory of each output 
@@ -534,8 +534,8 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = src/common \
-                         src/or
+INPUT                  = @top_srcdir@/src/common \
+                         @top_srcdir@/src/or
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 20 - 17
Makefile.am

@@ -20,6 +20,7 @@ DISTCLEANFILES=
 bin_SCRIPTS=
 AM_CPPFLAGS=
 AM_CFLAGS = @TOR_SYSTEMD_CFLAGS@
+SHELL = @SHELL@
 include src/include.am
 include doc/include.am
 include contrib/include.am
@@ -64,12 +65,12 @@ doxygen:
 	doxygen && cd doc/doxygen/latex && make
 
 test: all
-	./src/test/test
+	$(top_builddir)/src/test/test
 
 # Note that test-network requires a copy of Chutney in $CHUTNEY_PATH.
 # Chutney can be cloned from https://git.torproject.org/chutney.git .
 test-network: all
-	./src/test/test-network.sh
+	$(top_srcdir)/src/test/test-network.sh
 
 test-stem: $(TESTING_TOR_BINARY)
 	@if test -d "$$STEM_SOURCE_DIR"; then \
@@ -81,35 +82,35 @@ test-stem: $(TESTING_TOR_BINARY)
 
 
 reset-gcov:
-	rm -f src/*/*.gcda src/*/*/*.gcda
+	rm -f $(top_builddir)/src/*/*.gcda $(top_builddir)/src/*/*/*.gcda
 
-HTML_COVER_DIR=./coverage_html
+HTML_COVER_DIR=$(top_builddir)/coverage_html
 coverage-html: all
 	test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
-	test -d "$(HTML_COVER_DIR)" || mkdir -p "$(HTML_COVER_DIR)"
-	lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters
+	test -d "$(HTML_COVER_DIR)" || $(MKDIR_P) "$(HTML_COVER_DIR)"
+	lcov --rc lcov_branch_coverage=1 --directory $(top_builddir)/src --zerocounters
 	$(MAKE) reset-gcov
 	$(MAKE) check
-	lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp"
+	lcov --capture --rc lcov_branch_coverage=1 --no-external --directory $(top_builddir) --base-directory $(top_srcdir) --output-file "$(HTML_COVER_DIR)/lcov.tmp"
 	lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
 	genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
 
 # Avoid strlcpy.c, strlcat.c, aes.c, OpenBSD_malloc_Linux.c, sha256.c,
 # eventdns.[hc], tinytest*.[ch]
 check-spaces:
-	./scripts/maint/checkSpace.pl -C              \
-		src/common/*.[ch]		      \
-		src/or/*.[ch]			      \
-		src/test/*.[ch]			      \
-		src/tools/*.[ch]		      \
-		src/tools/tor-fw-helper/*.[ch]
+	$(top_srcdir)/scripts/maint/checkSpace.pl -C \
+		$(top_srcdir)/src/common/*.[ch] \
+		$(top_srcdir)/src/or/*.[ch] \
+		$(top_srcdir)/src/test/*.[ch] \
+		$(top_srcdir)/src/tools/*.[ch] \
+		$(top_srcdir)/src/tools/tor-fw-helper/*.[ch]
 
 check-docs:
-	./scripts/maint/checkOptionDocs.pl
+	$(top_srcdir)/scripts/maint/checkOptionDocs.pl
 
 check-logs:
-	./scripts/maint/checkLogs.pl                  \
-		src/*/*.[ch] | sort -n
+	$(top_srcdir)/scripts/maint/checkLogs.pl \
+		$(top_srcdir)/src/*/*.[ch] | sort -n
 
 .PHONY: check-changes
 check-changes:
@@ -125,4 +126,6 @@ version:
 	fi
 
 mostlyclean-local:
-	rm -f src/*/*.gc{da,no} src/*/*/*.gc{da,no}
+	rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
+	rm -rf $(HTML_COVER_DIR)
+	rm -rf $(top_builddir)/doc/doxygen

+ 2 - 2
doc/include.am

@@ -64,14 +64,14 @@ doc/tor-gencert.html.in: doc/tor-gencert.1.txt
 doc/tor-resolve.html.in: doc/tor-resolve.1.txt
 doc/tor-fw-helper.html.in: doc/tor-fw-helper.1.txt
 
-# use ../config.status to swap all machine-specific magic strings
+# use config.status to swap all machine-specific magic strings
 # in the asciidoc with their replacements.
 $(asciidoc_product) :
 	$(AM_V_GEN)$(MKDIR_P) $(@D)
 	$(AM_V_at)if test -e $(top_srcdir)/$@.in && ! test -e $@.in ; then \
 		cp $(top_srcdir)/$@.in $@; \
 	fi
-	$(AM_V_at)./config.status -q --file=$@;
+	$(AM_V_at)$(top_builddir)/config.status -q --file=$@;
 
 doc/tor.html: doc/tor.html.in
 doc/tor-gencert.html: doc/tor-gencert.html.in

+ 5 - 4
src/or/include.am

@@ -85,8 +85,9 @@ LIBTOR_A_SOURCES = \
 src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES)
 src_or_libtor_testing_a_SOURCES = $(LIBTOR_A_SOURCES)
 
-#libtor_a_LIBADD = ../common/libor.a ../common/libor-crypto.a \
-#	../common/libor-event.a
+#libtor_a_LIBADD = $(top_builddir)/common/libor.a \
+#    $(top_builddir)/common/libor-crypto.a \
+#    $(top_builddir)/common/libor-event.a
 
 
 src_or_tor_SOURCES = src/or/tor_main.c
@@ -123,9 +124,9 @@ src_or_tor_cov_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \
 	src/common/libor-event-testing.a \
 	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
 	@TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@
-TESTING_TOR_BINARY = ./src/or/tor-cov
+TESTING_TOR_BINARY = $(top_builddir)/src/or/tor-cov
 else
-TESTING_TOR_BINARY = ./src/or/tor
+TESTING_TOR_BINARY = $(top_builddir)/src/or/tor
 endif
 
 ORHEADERS = \

+ 5 - 5
src/test/include.am

@@ -140,9 +140,9 @@ src_test_test_ntor_cl_AM_CPPFLAGS =	       \
 NTOR_TEST_DEPS=src/test/test-ntor-cl
 
 if COVERAGE_ENABLED
-CMDLINE_TEST_TOR = ./src/or/tor-cov
+CMDLINE_TEST_TOR = $(top_builddir)/src/or/tor-cov
 else
-CMDLINE_TEST_TOR = ./src/or/tor
+CMDLINE_TEST_TOR = $(top_builddir)/src/or/tor
 endif
 
 noinst_PROGRAMS += src/test/test-bt-cl
@@ -158,10 +158,10 @@ check-local: $(NTOR_TEST_DEPS) $(CMDLINE_TEST_TOR)
 if USEPYTHON
 	$(PYTHON) $(top_srcdir)/src/test/ntor_ref.py test-tor
 	$(PYTHON) $(top_srcdir)/src/test/ntor_ref.py self-test
-	./src/test/test-bt-cl assert | $(PYTHON) $(top_srcdir)/src/test/bt_test.py
-	./src/test/test-bt-cl crash | $(PYTHON) $(top_srcdir)/src/test/bt_test.py
+	$(top_builddir)/src/test/test-bt-cl assert | $(PYTHON) $(top_srcdir)/src/test/bt_test.py
+	$(top_builddir)/src/test/test-bt-cl crash | $(PYTHON) $(top_srcdir)/src/test/bt_test.py
 endif
-	$(top_srcdir)/src/test/zero_length_keys.sh
+	$(SHELL) $(top_srcdir)/src/test/zero_length_keys.sh
 
 EXTRA_DIST += \
 	src/test/bt_test.py \