Makefile.am 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Copyright (c) 2001-2004, Roger Dingledine
  2. # Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
  3. # Copyright (c) 2007-2015, The Tor Project, Inc.
  4. # See LICENSE for licensing information
  5. # "foreign" means we don't follow GNU package layout standards
  6. # 1.9 means we require automake vesion 1.9
  7. AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects
  8. ACLOCAL_AMFLAGS = -I m4
  9. noinst_LIBRARIES=
  10. EXTRA_DIST=
  11. noinst_HEADERS=
  12. bin_PROGRAMS=
  13. CLEANFILES=
  14. TESTS=
  15. noinst_PROGRAMS=
  16. DISTCLEANFILES=
  17. bin_SCRIPTS=
  18. AM_CPPFLAGS=
  19. AM_CFLAGS = @TOR_SYSTEMD_CFLAGS@
  20. SHELL = @SHELL@
  21. include src/include.am
  22. include doc/include.am
  23. include contrib/include.am
  24. EXTRA_DIST+= \
  25. ChangeLog \
  26. INSTALL \
  27. LICENSE \
  28. Makefile.nmake \
  29. README \
  30. ReleaseNotes
  31. if COVERAGE_ENABLED
  32. TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
  33. TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE
  34. TEST_NETWORK_FLAGS="--coverage"
  35. else
  36. TEST_CFLAGS=
  37. TEST_CPPFLAGS=-DTOR_UNIT_TESTS
  38. TEST_NETWORK_FLAGS=
  39. endif
  40. #install-data-local:
  41. # $(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor
  42. # Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
  43. # building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
  44. RPMBUILD ?= rpmbuild
  45. # Use automake's dist-gzip target to build the tarball
  46. dist-rpm: dist-gzip
  47. TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); \
  48. RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX"); \
  49. mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
  50. cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/; \
  51. LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
  52. cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .; \
  53. cp -fa "$$RPM_BUILD_DIR"/RPMS/* .; \
  54. rm -rf "$$RPM_BUILD_DIR"; \
  55. echo "RPM build finished"; \
  56. #end of dist-rpm
  57. dist: check
  58. doxygen:
  59. doxygen && cd doc/doxygen/latex && make
  60. test: all
  61. $(top_builddir)/src/test/test
  62. need-chutney-path:
  63. @if test ! -d "$$CHUTNEY_PATH"; then \
  64. echo '$$CHUTNEY_PATH was not set.'; \
  65. if test -d $(top_srcdir)/../chutney -a -x $(top_srcdir)/../chutney/chutney; then \
  66. echo "Assuming test-network.sh will find" $(top_srcdir)/../chutney; \
  67. else \
  68. echo; \
  69. echo "To run these tests, git clone https://git.torproject.org/chutney.git ; export CHUTNEY_PATH=\`pwd\`/chutney"; \
  70. exit 1; \
  71. fi \
  72. fi
  73. # Note that test-network requires a copy of Chutney in $CHUTNEY_PATH.
  74. # Chutney can be cloned from https://git.torproject.org/chutney.git .
  75. test-network: need-chutney-path all
  76. $(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_FLAGS)
  77. need-stem-path:
  78. @if test ! -d "$$STEM_SOURCE_DIR"; then \
  79. echo '$$STEM_SOURCE_DIR was not set.'; echo; \
  80. echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \
  81. exit 1; \
  82. fi
  83. test-stem: need-stem-path $(TESTING_TOR_BINARY)
  84. @$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL;
  85. test-stem-full: need-stem-path $(TESTING_TOR_BINARY)
  86. @$(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL,ONLINE -v;
  87. test-full: need-stem-path need-chutney-path check test-network test-stem
  88. test-full-online: need-stem-path need-chutney-path check test-network test-stem-full
  89. reset-gcov:
  90. rm -f $(top_builddir)/src/*/*.gcda $(top_builddir)/src/*/*/*.gcda
  91. HTML_COVER_DIR=$(top_builddir)/coverage_html
  92. coverage-html: all
  93. if COVERAGE_ENABLED
  94. test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
  95. test -d "$(HTML_COVER_DIR)" || $(MKDIR_P) "$(HTML_COVER_DIR)"
  96. lcov --rc lcov_branch_coverage=1 --directory $(top_builddir)/src --zerocounters
  97. $(MAKE) reset-gcov
  98. $(MAKE) check
  99. lcov --capture --rc lcov_branch_coverage=1 --no-external --directory $(top_builddir) --base-directory $(top_srcdir) --output-file "$(HTML_COVER_DIR)/lcov.tmp"
  100. lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
  101. genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
  102. else
  103. @printf "Not configured with --enable-coverage, run ./configure --enable-coverage\n"
  104. endif
  105. coverage-html-full: all
  106. test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
  107. test -d "$(HTML_COVER_DIR)" || mkdir -p "$(HTML_COVER_DIR)"
  108. lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters
  109. $(MAKE) reset-gcov
  110. $(MAKE) check
  111. $(MAKE) test-stem-full
  112. CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh
  113. CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh --flavor hs
  114. lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp"
  115. lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
  116. genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
  117. # Avoid strlcpy.c, strlcat.c, aes.c, OpenBSD_malloc_Linux.c, sha256.c,
  118. # eventdns.[hc], tinytest*.[ch]
  119. check-spaces:
  120. $(top_srcdir)/scripts/maint/checkSpace.pl -C \
  121. $(top_srcdir)/src/common/*.[ch] \
  122. $(top_srcdir)/src/or/*.[ch] \
  123. $(top_srcdir)/src/test/*.[ch] \
  124. $(top_srcdir)/src/tools/*.[ch]
  125. check-docs: all
  126. $(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
  127. check-logs:
  128. $(top_srcdir)/scripts/maint/checkLogs.pl \
  129. $(top_srcdir)/src/*/*.[ch] | sort -n
  130. .PHONY: check-changes
  131. check-changes:
  132. @if test -d "$(top_srcdir)/changes"; then \
  133. $(PYTHON) $(top_srcdir)/scripts/maint/lintChanges.py $(top_srcdir)/changes/*; \
  134. fi
  135. .PHONY: update-versions
  136. update-versions:
  137. $(PERL) $(top_builddir)/scripts/maint/updateVersions.pl
  138. version:
  139. @echo "Tor @VERSION@"
  140. @if test -d "$(top_srcdir)/.git" && test -x "`which git 2>&1;true`"; then \
  141. echo -n "git: " ;\
  142. (cd "$(top_srcdir)" && git rev-parse --short=16 HEAD); \
  143. fi
  144. mostlyclean-local:
  145. rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
  146. rm -rf $(HTML_COVER_DIR)
  147. rm -rf $(top_builddir)/doc/doxygen