tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

Makefile.am (22681B)


      1 # Copyright (c) 2001-2004, Roger Dingledine
      2 # Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
      3 # Copyright (c) 2007-2019, The Tor Project, Inc.
      4 # See LICENSE for licensing information
      5 
      6 ACLOCAL_AMFLAGS = -I m4
      7 
      8 noinst_LIBRARIES=
      9 EXTRA_DIST=
     10 noinst_HEADERS=
     11 bin_PROGRAMS=
     12 EXTRA_PROGRAMS=
     13 CLEANFILES=
     14 TESTS=
     15 noinst_PROGRAMS=
     16 DISTCLEANFILES=
     17 MOSTLYCLEANFILES=
     18 bin_SCRIPTS=
     19 AM_CPPFLAGS=\
     20 -I$(top_srcdir)/src \
     21 -I$(top_srcdir)/src/ext \
     22 -I$(top_srcdir)/src/ext/trunnel \
     23 -I$(top_srcdir)/src/trunnel
     24 
     25 AM_CFLAGS=					\
     26 @TOR_SYSTEMD_CFLAGS@			\
     27 @CFLAGS_BUGTRAP@			\
     28 @TOR_LZMA_CFLAGS@			\
     29 @TOR_ZSTD_CFLAGS@
     30 
     31 SHELL=@SHELL@
     32 
     33 if COVERAGE_ENABLED
     34 TESTING_TOR_BINARY=$(top_builddir)/src/app/tor-cov$(EXEEXT)
     35 else
     36 TESTING_TOR_BINARY=$(top_builddir)/src/app/tor$(EXEEXT)
     37 endif
     38 
     39 # "Common" libraries used to link tor's utility code.
     40 TOR_UTIL_LIBS = \
     41        src/lib/libtor-geoip.a \
     42 src/lib/libtor-process.a \
     43        src/lib/libtor-buf.a \
     44 src/lib/libtor-confmgt.a \
     45 src/lib/libtor-pubsub.a \
     46 src/lib/libtor-dispatch.a \
     47 src/lib/libtor-time.a \
     48 src/lib/libtor-fs.a \
     49 src/lib/libtor-encoding.a \
     50 src/lib/libtor-sandbox.a \
     51 src/lib/libtor-container.a \
     52 src/lib/libtor-net.a \
     53 src/lib/libtor-memarea.a \
     54 src/lib/libtor-math.a \
     55 src/lib/libtor-meminfo.a \
     56 src/lib/libtor-osinfo.a \
     57 src/lib/libtor-log.a \
     58 src/lib/libtor-thread.a \
     59 src/lib/libtor-lock.a \
     60 src/lib/libtor-fdio.a \
     61 src/lib/libtor-string.a \
     62 src/lib/libtor-term.a \
     63 src/lib/libtor-smartlist-core.a \
     64 src/lib/libtor-malloc.a \
     65 src/lib/libtor-wallclock.a \
     66 src/lib/libtor-err.a \
     67 src/lib/libtor-version.a \
     68 src/lib/libtor-llharden.a \
     69 src/lib/libtor-intmath.a \
     70 src/lib/libtor-ctime.a \
     71 src/lib/libtor-metrics.a
     72 
     73 # Variants of the above for linking the testing variant of tor (for coverage
     74 # and tests)
     75 if UNITTESTS_ENABLED
     76 TOR_UTIL_TESTING_LIBS = \
     77        src/lib/libtor-geoip-testing.a \
     78 src/lib/libtor-process-testing.a \
     79        src/lib/libtor-buf-testing.a \
     80 src/lib/libtor-confmgt-testing.a \
     81 src/lib/libtor-pubsub-testing.a \
     82 src/lib/libtor-dispatch-testing.a \
     83 src/lib/libtor-time-testing.a \
     84 src/lib/libtor-fs-testing.a \
     85 src/lib/libtor-encoding-testing.a \
     86 src/lib/libtor-sandbox-testing.a \
     87 src/lib/libtor-container-testing.a \
     88 src/lib/libtor-net-testing.a \
     89 src/lib/libtor-memarea-testing.a \
     90 src/lib/libtor-math-testing.a \
     91 src/lib/libtor-meminfo-testing.a \
     92 src/lib/libtor-osinfo-testing.a \
     93 src/lib/libtor-term-testing.a \
     94 src/lib/libtor-log-testing.a \
     95 src/lib/libtor-thread-testing.a \
     96 src/lib/libtor-lock-testing.a \
     97 src/lib/libtor-fdio-testing.a \
     98 src/lib/libtor-string-testing.a \
     99 src/lib/libtor-smartlist-core-testing.a \
    100 src/lib/libtor-malloc-testing.a \
    101 src/lib/libtor-wallclock-testing.a \
    102 src/lib/libtor-err-testing.a \
    103 src/lib/libtor-version-testing.a \
    104 src/lib/libtor-llharden-testing.a \
    105 src/lib/libtor-intmath.a \
    106 src/lib/libtor-ctime-testing.a \
    107 src/lib/libtor-metrics-testing.a
    108 endif
    109 
    110 # Internal crypto libraries used in Tor
    111 TOR_CRYPTO_LIBS = \
    112 src/lib/libtor-tls.a \
    113 src/lib/libtor-crypt-ops.a \
    114 $(LIBKECCAK_TINY) \
    115 $(LIBDONNA) \
    116        $(LIBPOLYVAL)
    117 
    118 if BUILD_MODULE_POW
    119 TOR_CRYPTO_LIBS += $(EQUIX_LIBS)
    120 endif
    121 
    122 # Variants of the above for linking the testing variant of tor (for coverage
    123 # and tests)
    124 if UNITTESTS_ENABLED
    125 TOR_CRYPTO_TESTING_LIBS = \
    126 src/lib/libtor-tls-testing.a \
    127 src/lib/libtor-crypt-ops-testing.a \
    128 $(LIBKECCAK_TINY) \
    129 $(LIBDONNA) \
    130        $(LIBPOLYVAL) \
    131 $(EQUIX_LIBS)
    132 endif
    133 
    134 # All static libraries used to link tor.
    135 TOR_INTERNAL_LIBS = \
    136 src/core/libtor-app.a \
    137 src/lib/libtor-compress.a \
    138 src/lib/libtor-evloop.a \
    139 $(TOR_CRYPTO_LIBS) \
    140 $(TOR_UTIL_LIBS) \
    141 src/trunnel/libor-trunnel.a \
    142 src/lib/libtor-trace.a
    143 
    144 libtor.a: $(TOR_INTERNAL_LIBS)
    145 $(AM_V_AR) export AR="$(AR)"; \
    146 export ARFLAGS="$(ARFLAGS)"; \
    147 export RANLIB="$(RANLIB)"; \
    148 $(top_srcdir)/scripts/build/combine_libs libtor.a $(TOR_INTERNAL_LIBS)
    149 
    150 MOSTLYCLEANFILES += libtor.a
    151 
    152 # Variants of the above for linking the testing variant of tor (for coverage
    153 # and tests)
    154 if UNITTESTS_ENABLED
    155 TOR_INTERNAL_TESTING_LIBS = \
    156 src/core/libtor-app-testing.a \
    157 src/lib/libtor-compress-testing.a \
    158 src/lib/libtor-evloop-testing.a \
    159 $(TOR_CRYPTO_TESTING_LIBS) \
    160 $(TOR_UTIL_TESTING_LIBS) \
    161 src/trunnel/libor-trunnel-testing.a \
    162 src/lib/libtor-trace.a
    163 
    164 src/test/libtor-testing.a: $(TOR_INTERNAL_TESTING_LIBS)
    165 $(AM_V_AR) export AR="$(AR)"; \
    166 export ARFLAGS="$(ARFLAGS)"; \
    167 export RANLIB="$(RANLIB)"; \
    168 $(top_srcdir)/scripts/build/combine_libs src/test/libtor-testing.a $(TOR_INTERNAL_TESTING_LIBS)
    169 
    170 MOSTLYCLEANFILES += src/test/libtor-testing.a
    171 endif
    172 
    173 TOR_LDFLAGS_CRYPTLIB=@TOR_LDFLAGS_openssl@
    174 TOR_LIBS_CRYPTLIB=@TOR_OPENSSL_LIBS@
    175 TOR_CFLAGS_CRYPTLIB=
    176 if USE_NSS
    177 TOR_CFLAGS_CRYPTLIB+=@NSS_CFLAGS@
    178 TOR_LIBS_CRYPTLIB+=@NSS_LIBS@
    179 endif
    180 
    181 # All libraries used to link tor-cov
    182 
    183 include src/include.am
    184 include doc/include.am
    185 include contrib/include.am
    186 
    187 manpages: $(nodist_man1_MANS)
    188 
    189 EXTRA_DIST+= \
    190 ChangeLog							\
    191 CONTRIBUTING							\
    192 CODE_OF_CONDUCT							\
    193 INSTALL								\
    194 LICENSE								\
    195 README.md								\
    196 ReleaseNotes							\
    197 scripts/build/combine_libs					\
    198 scripts/maint/checkIncludes.py					\
    199 scripts/maint/checkSpace.pl					\
    200 scripts/maint/checkSpaceTest.sh					\
    201 scripts/maint/checkspace_tests/dubious.c			\
    202 scripts/maint/checkspace_tests/dubious.h			\
    203 scripts/maint/checkspace_tests/expected.txt			\
    204 scripts/maint/checkspace_tests/good_guard.h			\
    205 scripts/maint/checkspace_tests/same_guard.h			\
    206 scripts/maint/checkspace_tests/subdir/dubious.c			\
    207 scripts/maint/checkShellScripts.sh				\
    208 scripts/maint/practracker/README				\
    209 scripts/maint/practracker/exceptions.txt			\
    210 scripts/maint/practracker/includes.py				\
    211 scripts/maint/practracker/metrics.py				\
    212 scripts/maint/practracker/practracker.py			\
    213 scripts/maint/practracker/practracker_tests.py			\
    214 scripts/maint/practracker/problem.py				\
    215 scripts/maint/practracker/testdata/.may_include			\
    216 scripts/maint/practracker/testdata/a.c				\
    217 scripts/maint/practracker/testdata/b.c				\
    218 scripts/maint/practracker/testdata/ex0-expected.txt		\
    219 scripts/maint/practracker/testdata/ex0.txt			\
    220 scripts/maint/practracker/testdata/ex1-expected.txt		\
    221 scripts/maint/practracker/testdata/ex1.txt			\
    222 scripts/maint/practracker/testdata/ex1-overbroad-expected.txt	\
    223 scripts/maint/practracker/testdata/ex1-regen-expected.txt	\
    224 scripts/maint/practracker/testdata/ex1-regen-overbroad-expected.txt \
    225 scripts/maint/practracker/testdata/ex.txt			\
    226 scripts/maint/practracker/testdata/header.h			\
    227 scripts/maint/practracker/testdata/not_c_file			\
    228 scripts/maint/practracker/test_practracker.sh			\
    229 scripts/maint/practracker/util.py				\
    230 scripts/coccinelle/apply.sh					\
    231 scripts/coccinelle/check_cocci_parse.sh				\
    232 scripts/coccinelle/exceptions.txt				\
    233 scripts/coccinelle/test-operator-cleanup			\
    234 scripts/coccinelle/tor-coccinelle.h				\
    235 scripts/coccinelle/try_parse.sh
    236 
    237 ## This tells etags how to find mockable function definitions.
    238 AM_ETAGSFLAGS=--regex='{c}/MOCK_IMPL([^,]+,\W*\([a-zA-Z0-9_]+\)\W*,/\1/s'
    239 
    240 if COVERAGE_ENABLED
    241 TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
    242 if DISABLE_ASSERTS_IN_UNIT_TESTS
    243 TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE -DDISABLE_ASSERTS_IN_UNIT_TESTS @TOR_MODULES_ALL_ENABLED@
    244 else
    245 TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE @TOR_MODULES_ALL_ENABLED@
    246 endif
    247 TEST_NETWORK_FLAGS=--coverage --hs-multi-client 1
    248 else
    249 TEST_CFLAGS=
    250 TEST_CPPFLAGS=-DTOR_UNIT_TESTS @TOR_MODULES_ALL_ENABLED@
    251 TEST_NETWORK_FLAGS=--hs-multi-client 1
    252 endif
    253 TEST_NETWORK_SHOW_WARNINGS_FOR_LAST_RUN_FLAGS=--quiet --only-warnings
    254 
    255 if LIBFUZZER_ENABLED
    256 TEST_CFLAGS += -fsanitize=fuzzer-no-link
    257 # not "edge"
    258 endif
    259 
    260 TEST_NETWORK_ALL_LOG_DIR=$(top_builddir)/test_network_log
    261 TEST_NETWORK_ALL_DRIVER_FLAGS=--color-tests yes
    262 
    263 #install-data-local:
    264 #	$(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor
    265 
    266 # Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
    267 # building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
    268 RPMBUILD ?= rpmbuild
    269 
    270 # Use automake's dist-gzip target to build the tarball
    271 dist-rpm: dist-gzip
    272 TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); 				\
    273 RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX");	\
    274 mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
    275 cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/;			\
    276 LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; 	\
    277 cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .;                           		\
    278 cp -fa "$$RPM_BUILD_DIR"/RPMS/* .;                            		\
    279 rm -rf "$$RPM_BUILD_DIR";						\
    280 echo "RPM build finished";						\
    281 #end of dist-rpm
    282 
    283 .PHONY: doxygen
    284 doxygen: Doxyfile
    285 mkdir -p doc/doxygen
    286 (cd "$(top_srcdir)" && doxygen "$(abs_top_builddir)/Doxyfile")
    287 
    288 test: all
    289 $(top_builddir)/src/test/test
    290 
    291 shellcheck:
    292 $(top_srcdir)/scripts/maint/checkShellScripts.sh
    293 
    294 check-local:					\
    295 check-spaces				\
    296 check-changes				\
    297 check-includes				\
    298 shellcheck
    299 
    300 # test-network requires a copy of Chutney in $CHUTNEY_PATH.
    301 # Chutney can be cloned from https://gitlab.torproject.org/tpo/core/chutney.git .
    302 .PHONY: need-chutney-path
    303 need-chutney-path:
    304 @if test ! -d "$$CHUTNEY_PATH"; then \
    305 	echo '$$CHUTNEY_PATH was not set.'; \
    306 	if test -d "$(top_srcdir)/../chutney" && \
    307 	   test -x "$(top_srcdir)/../chutney/chutney"; then \
    308 		echo "Assuming test-network.sh will find" \
    309 		  "$(top_srcdir)/../chutney"; \
    310 	else \
    311 		echo; \
    312 		echo "To run these tests," \
    313 		  "git clone" \
    314 		  "https://gitlab.torproject.org/tpo/core/chutney.git ;" \
    315 		  "export CHUTNEY_PATH=\`pwd\`/chutney"; \
    316 		exit 1; \
    317 	fi \
    318 fi
    319 
    320 # Run some basic tests using automake's test-driver
    321 .PHONY: test-network
    322 # Hide directory path logs from submakes using $(MAKE) -s
    323 test-network:
    324 @$(MAKE) -s test-network-mkdir
    325 @$(MAKE) -s test-network-clean
    326 @$(MAKE) -s test-network-run \
    327   ipv4_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK)" \
    328   ipv6_flavors="$(TEST_CHUTNEY_FLAVOR_QUICK_IPV6)"
    329 @$(MAKE) -s test-network-results
    330 
    331 # Run all available tests using automake's test-driver
    332 .PHONY: test-network-all
    333 # Hide directory path logs from submakes using $(MAKE) -s
    334 test-network-all:
    335 @$(MAKE) -s test-network-mkdir
    336 @$(MAKE) -s test-network-clean
    337 @$(MAKE) -s test-network-run \
    338   ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \
    339   mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)" \
    340   ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \
    341   ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)"
    342 @$(MAKE) -s test-network-results
    343 
    344 # Run IPv4 and mixed tests using automake's test-driver
    345 .PHONY: test-network-ipv4
    346 # Hide directory path logs from submakes using $(MAKE) -s
    347 test-network-ipv4:
    348 @$(MAKE) -s test-network-mkdir
    349 @$(MAKE) -s test-network-clean
    350 @$(MAKE) -s test-network-run \
    351   ipv4_flavors="$(TEST_CHUTNEY_FLAVORS)" \
    352   mixed_flavors="$(TEST_CHUTNEY_FLAVORS_MIXED)"
    353 @$(MAKE) -s test-network-results
    354 
    355 # Run IPv6 tests using automake's test-driver
    356 .PHONY: test-network-ipv6
    357 # Hide directory path logs from submakes using $(MAKE) -s
    358 test-network-ipv6:
    359 @$(MAKE) -s test-network-mkdir
    360 @$(MAKE) -s test-network-clean
    361 @$(MAKE) -s test-network-run \
    362   ipv6_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6)" \
    363   ipv6_mixed_flavors="$(TEST_CHUTNEY_FLAVORS_IPV6_MIXED)"
    364 @$(MAKE) -s test-network-results
    365 
    366 # Make the test network log directory, if it does not exist
    367 .PHONY: test-network-mkdir
    368 test-network-mkdir:
    369 @mkdir -p "$(TEST_NETWORK_ALL_LOG_DIR)"
    370 
    371 # Clean the test network log directory
    372 .PHONY: test-network-clean
    373 # We need to remove all matching files, so we can't quote the glob part of the
    374 # rm arguments
    375 test-network-clean:
    376 rm -f "$(TEST_NETWORK_ALL_LOG_DIR)"/*.log \
    377       "$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs
    378 
    379 # Run tests using automake's test-driver
    380 # When checking if a set of test can be run, log the type of test, and the
    381 # list of tests that will be run (or skipped).
    382 #
    383 # Run the IPv4 tests in $(ipv4_flavors), unconditionally
    384 #   - tor relays and directory authorities require IPv4.
    385 # Run the IPv6 tests in $(ipv6_flavors), unconditionally
    386 #   - clients don't technically require IPv6, but it's not worth
    387 #     supporting running this test suite on such systems.
    388 #   - some IPv6 tests may fail without an IPv6 DNS server
    389 #     (see #16971 and #17011)
    390 # Run the mixed tests in $(mixed_flavors), if a tor-stable binary is available
    391 #   - only run mixed tests if we have a tor-stable binary
    392 # Run the IPv6 mixed tests in $(ipv6_mixed_flavors), if IPv6 and mixed are run
    393 #   - see above for details about IPv6 and mixed
    394 .PHONY: test-network-run
    395 # We need the word splitting in the "for" lines, so we can't quote
    396 # $(skip_flavors) or $(flavors)
    397 test-network-run: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/tor-gencert
    398 @flavors=""; \
    399 skip_flavors=""; \
    400 if test -n "$(ipv4_flavors)"; then \
    401 	echo "Running IPv4 flavors: $(ipv4_flavors)."; \
    402 	flavors="$$flavors $(ipv4_flavors)"; \
    403 fi; \
    404 if test -n "$(ipv6_flavors)"; then \
    405 	echo "Running IPv6 flavors: $(ipv6_flavors)."; \
    406 	flavors="$$flavors $(ipv6_flavors)"; \
    407 fi; \
    408 test_network_mixed=false; \
    409 if test -n "$(mixed_flavors)" || \
    410    test -n "$(ipv6_mixed_flavors)"; then \
    411 	if command -v tor-stable >/dev/null 2>&1; then \
    412 		test_network_mixed=true; \
    413 	fi; \
    414 fi; \
    415 if test -n "$(mixed_flavors)"; then \
    416 	if test "$$test_network_mixed" = "true"; then \
    417 		echo "tor-stable found, running mixed flavors:" \
    418 		  "$(mixed_flavors)."; \
    419 		flavors="$$flavors $(mixed_flavors)"; \
    420 	else \
    421 		echo "tor-stable not found, skipping mixed flavors:" \
    422 		  "$(mixed_flavors)."; \
    423 		skip_flavors="$$skip_flavors $(mixed_flavors)"; \
    424 	fi; \
    425 fi; \
    426 if test -n "$(ipv6_mixed_flavors)"; then \
    427 	if test "$$test_network_mixed" = "true"; then \
    428 		echo "Running IPv6 mixed flavors:" \
    429 		  "$(ipv6_mixed_flavors)."; \
    430 		flavors="$$flavors $(ipv6_mixed_flavors)"; \
    431 	else \
    432 		echo "Skipping IPv6 mixed flavors:" \
    433 		  "$(ipv6_mixed_flavors)."; \
    434 		skip_flavors="$$skip_flavors $(ipv6_mixed_flavors)"; \
    435 	fi; \
    436 fi; \
    437 for f in $$skip_flavors; do \
    438 	echo "SKIP: $$f"; \
    439 done; \
    440 for f in $$flavors; do \
    441 	$(SHELL) "$(top_srcdir)/test-driver" --test-name "$$f" \
    442 	  --log-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.log" \
    443 	  --trs-file "$(TEST_NETWORK_ALL_LOG_DIR)/$$f.trs" \
    444 	  $(TEST_NETWORK_ALL_DRIVER_FLAGS) \
    445 	  "$(top_srcdir)/src/test/test-network.sh" \
    446 	    --flavor "$$f" $(TEST_NETWORK_FLAGS); \
    447 	"$(top_srcdir)/src/test/test-network.sh" \
    448 	  $(TEST_NETWORK_SHOW_WARNINGS_FOR_LAST_RUN_FLAGS); \
    449 done
    450 
    451 # Print the results from automake's test-driver
    452 #   - show tor warnings on the console after each network run
    453 #     (otherwise, warnings go to the logs, and people don't see them unless
    454 #     there is a network failure)
    455 .PHONY: test-network-results
    456 # We need to grep all matching files, so we can't quote the glob part of the
    457 # grep arguments
    458 test-network-results:
    459 @echo \
    460   "Log and result files are available in $(TEST_NETWORK_ALL_LOG_DIR)."
    461 @! grep -q FAIL "$(TEST_NETWORK_ALL_LOG_DIR)"/*.trs
    462 
    463 need-stem-path:
    464 @if test ! -d "$$STEM_SOURCE_DIR"; then \
    465 	echo '$$STEM_SOURCE_DIR was not set.'; echo; \
    466 	echo "To run these tests, git clone https://gitlab.torproject.org/tpo/network-health/stem ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \
    467 	exit 1; \
    468 fi
    469 
    470 test-stem: need-stem-path $(TESTING_TOR_BINARY)
    471 @$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor "$(TESTING_TOR_BINARY)" --integ --test control.controller --test control.base_controller --test process --log notice;
    472 
    473 test-stem-full: need-stem-path $(TESTING_TOR_BINARY)
    474 @$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor "$(TESTING_TOR_BINARY)" --all --log notice --target RUN_ALL,ONLINE -v;
    475 
    476 test-full:					\
    477 need-stem-path				\
    478 need-chutney-path			\
    479 check					\
    480 test-network				\
    481 test-stem
    482 
    483 test-full-online:				\
    484 need-stem-path				\
    485 need-chutney-path			\
    486 check					\
    487 test-network				\
    488 test-stem-full
    489 
    490 # We can't delete the gcno files, because they are created when tor is compiled
    491 reset-gcov:
    492 rm -f $(top_builddir)/src/*/*.gcda $(top_builddir)/src/*/*/*.gcda \
    493       $(top_builddir)/src/*/*.gcov $(top_builddir)/src/*/*/*.gcov
    494 
    495 HTML_COVER_DIR=$(top_builddir)/coverage_html
    496 coverage-html: all
    497 if COVERAGE_ENABLED
    498 test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
    499 test -d "$(HTML_COVER_DIR)" || $(MKDIR_P) "$(HTML_COVER_DIR)"
    500 lcov --rc lcov_branch_coverage=1 --directory $(top_builddir)/src --zerocounters
    501 $(MAKE) reset-gcov
    502 $(MAKE) check
    503 lcov --capture --rc lcov_branch_coverage=1 --no-external --directory $(top_builddir) --base-directory $(top_srcdir) --output-file "$(HTML_COVER_DIR)/lcov.tmp"
    504 lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
    505 genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
    506 else
    507 @printf "Not configured with --enable-coverage, run ./configure --enable-coverage\n"
    508 endif
    509 
    510 coverage-html-full: all
    511 test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
    512 test -d "$(HTML_COVER_DIR)" || mkdir -p "$(HTML_COVER_DIR)"
    513 lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters
    514 $(MAKE) reset-gcov
    515 $(MAKE) check
    516 $(MAKE) test-stem-full
    517 CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh
    518 CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh --flavor hs
    519 lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp"
    520 lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
    521 genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
    522 
    523 # For scripts: avoid src/ext and src/trunnel.
    524 # Keep these lists consistent:
    525 #   - OWNED_TOR_C_FILES in Makefile.am
    526 #   - CHECK_FILES in pre-commit.git-hook and pre-push.git-hook
    527 #   - try_parse in check_cocci_parse.sh
    528 OWNED_TOR_C_FILES=\
    529 	$(top_srcdir)/src/lib/*/*.[ch] \
    530 	$(top_srcdir)/src/core/*/*.[ch] \
    531 	$(top_srcdir)/src/feature/*/*.[ch] \
    532 	$(top_srcdir)/src/app/*/*.[ch] \
    533 	$(top_srcdir)/src/test/*.[ch] \
    534 	$(top_srcdir)/src/test/*/*.[ch] \
    535 	$(top_srcdir)/src/tools/*.[ch]
    536 
    537 check-spaces:
    538 if USE_PERL
    539 $(PERL) $(top_srcdir)/scripts/maint/checkSpace.pl -C \
    540 	$(OWNED_TOR_C_FILES)
    541 endif
    542 
    543 check-includes:
    544 if USEPYTHON
    545 $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py $(top_srcdir)
    546 endif
    547 
    548 check-best-practices:
    549 if USEPYTHON
    550 @$(PYTHON) $(top_srcdir)/scripts/maint/practracker/practracker.py $(top_srcdir) $(TOR_PRACTRACKER_OPTIONS)
    551 endif
    552 
    553 check-cocci:
    554 VERBOSE=1 $(top_srcdir)/scripts/coccinelle/check_cocci_parse.sh $(OWNED_TOR_C_FILES)
    555 
    556 practracker-regen:
    557 $(PYTHON) $(top_srcdir)/scripts/maint/practracker/practracker.py --regen $(top_srcdir)
    558 
    559 check-docs: all
    560 $(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
    561 
    562 check-logs:
    563 $(top_srcdir)/scripts/maint/checkLogs.pl \
    564 	$(top_srcdir)/src/*/*.[ch] | sort -n
    565 
    566 .PHONY: check-typos
    567 check-typos:
    568 @if test -x "`which misspell 2>&1;true`"; then \
    569 	echo "Checking for Typos ..."; \
    570 	(misspell \
    571 		$(top_srcdir)/src/[^e]*/*.[ch] \
    572 		$(top_srcdir)/doc \
    573 		$(top_srcdir)/contrib \
    574 		$(top_srcdir)/scripts \
    575 		$(top_srcdir)/README.md \
    576 		$(top_srcdir)/ChangeLog \
    577 		$(top_srcdir)/INSTALL \
    578 		$(top_srcdir)/ReleaseNotes \
    579 		$(top_srcdir)/LICENSE); \
    580 else \
    581 	echo "Tor can use misspell to check for typos."; \
    582 	echo "It seems that you don't have misspell installed."; \
    583 	echo "You can install the latest version of misspell here: https://github.com/client9/misspell#install"; \
    584 fi
    585 
    586 .PHONY: check-changes
    587 check-changes:
    588 if USEPYTHON
    589 @if test -d "$(top_srcdir)/changes"; then \
    590 	PACKAGE_VERSION=$(PACKAGE_VERSION) $(PYTHON) $(top_srcdir)/scripts/maint/lintChanges.py $(top_srcdir)/changes; \
    591 	fi
    592 endif
    593 
    594 .PHONY: update-versions
    595 update-versions:
    596 abs_top_srcdir="$(abs_top_srcdir)" $(PYTHON) $(top_srcdir)/scripts/maint/update_versions.py
    597 
    598 .PHONY: callgraph
    599 callgraph:
    600 cd $(top_builddir); $(abs_top_srcdir)/scripts/maint/run_calltool.sh
    601 
    602 version:
    603 @echo "Tor @VERSION@"
    604 @if test -d "$(top_srcdir)/.git" && test -x "`which git 2>&1;true`"; then \
    605    echo -n "git: " ;\
    606    (cd "$(top_srcdir)" && git rev-parse --short=16 HEAD); \
    607 fi
    608 
    609 .PHONY: autostyle-ifdefs
    610 autostyle-ifdefs:
    611 $(PYTHON) $(top_srcdir)/scripts/maint/annotate_ifdef_directives.py $(OWNED_TOR_C_FILES)
    612 
    613 .PHONY: autostyle-ifdefs
    614 autostyle-operators:
    615 $(PERL) $(top_srcdir)/scripts/coccinelle/test-operator-cleanup $(OWNED_TOR_C_FILES)
    616 
    617 .PHONY: rectify-includes
    618 rectify-includes:
    619 cd $(top_srcdir); $(PYTHON) $(abs_top_srcdir)/scripts/maint/rectify_include_paths.py
    620 
    621 .PHONY: update-copyright
    622 update-copyright:
    623 $(PERL) $(top_srcdir)/scripts/maint/updateCopyright.pl $(OWNED_TOR_C_FILES)
    624 
    625 .PHONY: autostyle
    626 autostyle: update-versions autostyle-ifdefs rectify-includes
    627 
    628 mostlyclean-local:
    629 rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
    630 rm -rf $(HTML_COVER_DIR)
    631 rm -rf $(top_builddir)/doc/doxygen
    632 rm -rf $(TEST_NETWORK_ALL_LOG_DIR)
    633 
    634 # This relies on some internal details of how automake implements
    635 # distcheck.  We check two directories because automake-1.15 changed
    636 # from $(distdir)/_build to $(distdir)/_build/sub.
    637 show-distdir-testlog:
    638 @if test -d "$(distdir)/_build/sub"; then \
    639   cat $(distdir)/_build/sub/$(TEST_SUITE_LOG); \
    640 else \
    641   cat $(distdir)/_build/$(TEST_SUITE_LOG); fi
    642 
    643 # Similarly, this relies on automake internals to run file on an
    644 # intermittent core file whose provenance is not known to us.  See
    645 # ticket 26787.
    646 show-distdir-core:
    647 @if test -d "$(distdir)/_build/sub"; then \
    648   file $(distdir)/_build/sub/core ; \
    649 else \
    650   file $(distdir)/_build/core; fi
    651 
    652 show-libs:
    653 @echo libtor.a
    654 
    655 show-testing-libs:
    656 @echo src/test/libtor-testing.a
    657 
    658 # Note here that we hardcode this -j2 because if the user would pass too many
    659 # cores, bear actually chockes and dies :S. For this to work, a make clean
    660 # needs to be done else bear will miss some compile flags.
    661 lsp:
    662 @if test -x "`which bear 2>&1;true`"; then \
    663 	echo "Generating LSP compile_commands.json. Might take few minutes..."; \
    664 	$(MAKE) clean 2>&1 >/dev/null; \
    665 	bear >/dev/null 2>&1 -- $(MAKE) -j2 2>&1 >/dev/null; \
    666 	echo "Generating .ccls file..."; \
    667 	./scripts/maint/gen_ccls_file.sh \
    668 else \
    669 	echo "No bear command found. On debian, apt install bear"; \
    670 fi
    671 
    672 # Reproducible tarball. We change the tar options for this.
    673 dist-reprod:
    674 $(MAKE) dist am__tar="$${TAR-tar} --format=gnu --owner=root --group=root --sort=name --mtime=\"`git show --no-patch --format='%ci'`\" -chof - $(distdir)"