Makefile.am 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. else
  35. TEST_CFLAGS=
  36. TEST_CPPFLAGS=-DTOR_UNIT_TESTS
  37. endif
  38. #install-data-local:
  39. # $(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor
  40. # Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
  41. # building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
  42. RPMBUILD ?= rpmbuild
  43. # Use automake's dist-gzip target to build the tarball
  44. dist-rpm: dist-gzip
  45. TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); \
  46. RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX"); \
  47. mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
  48. cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/; \
  49. LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
  50. cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .; \
  51. cp -fa "$$RPM_BUILD_DIR"/RPMS/* .; \
  52. rm -rf "$$RPM_BUILD_DIR"; \
  53. echo "RPM build finished"; \
  54. #end of dist-rpm
  55. dist: check
  56. doxygen:
  57. doxygen && cd doc/doxygen/latex && make
  58. test: all
  59. $(top_builddir)/src/test/test
  60. # Note that test-network requires a copy of Chutney in $CHUTNEY_PATH.
  61. # Chutney can be cloned from https://git.torproject.org/chutney.git .
  62. test-network: all
  63. $(top_srcdir)/src/test/test-network.sh
  64. test-stem: $(TESTING_TOR_BINARY)
  65. @if test -d "$$STEM_SOURCE_DIR"; then \
  66. $(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL; \
  67. else \
  68. echo '$$STEM_SOURCE_DIR was not set.'; echo; \
  69. echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \
  70. fi
  71. test-stem-full: $(TESTING_TOR_BINARY)
  72. @if test -d "$$STEM_SOURCE_DIR"; then \
  73. "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL,ONLINE -v; \
  74. else \
  75. echo '$$STEM_SOURCE_DIR was not set.'; echo; \
  76. echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \
  77. fi
  78. reset-gcov:
  79. rm -f $(top_builddir)/src/*/*.gcda $(top_builddir)/src/*/*/*.gcda
  80. HTML_COVER_DIR=$(top_builddir)/coverage_html
  81. coverage-html: all
  82. if COVERAGE_ENABLED
  83. test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
  84. test -d "$(HTML_COVER_DIR)" || $(MKDIR_P) "$(HTML_COVER_DIR)"
  85. lcov --rc lcov_branch_coverage=1 --directory $(top_builddir)/src --zerocounters
  86. $(MAKE) reset-gcov
  87. $(MAKE) check
  88. lcov --capture --rc lcov_branch_coverage=1 --no-external --directory $(top_builddir) --base-directory $(top_srcdir) --output-file "$(HTML_COVER_DIR)/lcov.tmp"
  89. lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
  90. genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
  91. else
  92. @printf "Not configured with --enable-coverage, run ./configure --enable-coverage\n"
  93. endif
  94. coverage-html-full: all
  95. test -e "`which lcov`" || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false)
  96. test -d "$(HTML_COVER_DIR)" || mkdir -p "$(HTML_COVER_DIR)"
  97. lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters
  98. $(MAKE) reset-gcov
  99. $(MAKE) check
  100. $(MAKE) test-stem-full
  101. CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh
  102. CHUTNEY_TOR=tor-cov CHUTNEY_TOR_GENCERT=tor-cov-gencert $(top_srcdir)/src/test/test-network.sh --flavor hs
  103. lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp"
  104. lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info"
  105. genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info"
  106. # Avoid strlcpy.c, strlcat.c, aes.c, OpenBSD_malloc_Linux.c, sha256.c,
  107. # eventdns.[hc], tinytest*.[ch]
  108. check-spaces:
  109. $(top_srcdir)/scripts/maint/checkSpace.pl -C \
  110. $(top_srcdir)/src/common/*.[ch] \
  111. $(top_srcdir)/src/or/*.[ch] \
  112. $(top_srcdir)/src/test/*.[ch] \
  113. $(top_srcdir)/src/tools/*.[ch] \
  114. $(top_srcdir)/src/tools/tor-fw-helper/*.[ch]
  115. check-docs: all
  116. $(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
  117. check-logs:
  118. $(top_srcdir)/scripts/maint/checkLogs.pl \
  119. $(top_srcdir)/src/*/*.[ch] | sort -n
  120. .PHONY: check-changes
  121. check-changes:
  122. @if test -d "$(top_srcdir)/changes"; then \
  123. $(PYTHON) $(top_srcdir)/scripts/maint/lintChanges.py $(top_srcdir)/changes/*; \
  124. fi
  125. .PHONY: update-versions
  126. update-versions:
  127. $(PERL) $(top_builddir)/scripts/maint/updateVersions.pl
  128. version:
  129. @echo "Tor @VERSION@"
  130. @if test -d "$(top_srcdir)/.git" && test -x "`which git 2>&1;true`"; then \
  131. echo -n "git: " ;\
  132. (cd "$(top_srcdir)" && git rev-parse --short=16 HEAD); \
  133. fi
  134. mostlyclean-local:
  135. rm -f $(top_builddir)/src/*/*.gc{da,no} $(top_builddir)/src/*/*/*.gc{da,no}
  136. rm -rf $(HTML_COVER_DIR)
  137. rm -rf $(top_builddir)/doc/doxygen