aboutsummaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 1573a7ba9a9dde580c903b2e74c337d1bae25cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# vim:ft=automake

AM_CFLAGS="-D__STDC_LIMIT_MACROS"

BUILT_SOURCES=
doc_DATA=
EXTRA_DIST=
TESTS=
bin_PROGRAMS=
sbin_PROGRAMS=
check_PROGRAMS=
lib_LTLIBRARIES=
man_MANS=
noinst_HEADERS=
noinst_LTLIBRARIES=
noinst_PROGRAMS=

if !TARGET_OSX
# GNU style is "make check", this will make check and test work
TESTS+= src/conf_unittest src/proxy-bio_unittest
if TARGET_LINUX
TESTS+= src/tlsdated_unittest
endif
test: check
endif

ACLOCAL_AMFLAGS= -I m4

# Our Debian version
DEBIAN_VERSION := $(shell if [ -e debian/changelog ]; then cat debian/changelog|head -n1|cut -d\- -f2| head -c 1; else echo "unknown"; fi)

doc_DATA+= AUTHORS
doc_DATA+= CHANGELOG
doc_DATA+= LICENSE
doc_DATA+= README
doc_DATA+= TODO

EXTRA_DIST+= $(doc_DATA)
EXTRA_DIST+= apparmor-profile
EXTRA_DIST+= autogen.sh 
EXTRA_DIST+= tlsdated.service

include src/include.am

# Cleanup individual files in order to preserve uninstall/etc order
maintainer-clean-local:
	@rm -r -f autom4te.cache
	@rm Makefile.in
	@rm aclocal.m4
	@rm config.in
	@rm config/config.guess
	@rm config/config.sub
	@rm config/depcomp
	@rm config/install-sh
	@rm config/ltmain.sh
	@rm config/missing
	@rm configure
	@rmdir config
	@rm dbus/org.torproject.tlsdate.conf
	@rm m4/libtool.m4
	@rm m4/ltoptions.m4
	@rm m4/ltsugar.m4
	@rm m4/ltversion.m4
	@rm m4/lt~obsolete.m4
	@rm -f tlsdate-*.tar.gz
	-rm src/configmake.h
	-rm dbus/org.torproject.tlsdate.conf
	@find ./ | $(GREP) \~$$ | xargs rm -f

certdir =  @TLSDATE_CA_ROOTS@
cert_DATA = ca-roots/tlsdate-ca-roots.conf
EXTRA_DIST+= $(cert_DATA)

confdir = @TLSDATE_CONF_DIR@
if TARGET_LINUX
conf_DATA = etc/tlsdated.conf
EXTRA_DIST+= $(conf_DATA)
endif

# Our documentation
man_MANS+= man/tlsdate.1
man_MANS+= man/tlsdate-helper.1

if TARGET_LINUX
man_MANS+= man/tlsdated.8
man_MANS+= man/tlsdated.conf.5
endif

EXTRA_DIST+= $(man_MANS)

.PHONY: debian_orig git-tag git-push git-tag-debian deb really-clean valgrind_test
debian_orig:
	$(MAKE) dist
	mv tlsdate-$(VERSION).tar.gz ../tlsdate_$(VERSION).orig.tar.gz

git-tag:
	git tag -u 0x1801A819 -s tlsdate-$(VERSION)

git-tag-debian:
	git tag -u 0x1801A819 -s tlsdate-$(VERSION)-debian-${DEBIAN_VERSION}

git-push:
	git push --tags
	git push

deb: debian_orig
	debuild -i'.*' -rfakeroot -uc -us -d

# This generates code coverage data that is useful for continuous integration
lcov:
#  ./configure --enable-code-coverage-checks && make && # ... run everything and then...
	lcov --directory src -b . --capture --output-file tlsdate.lcov && genhtml -o lcov/ tlsdate.lcov

valgrind_test:
	TESTS_ENVIRONMENT="./libtool --mode=execute valgrind  --trace-children=yes --leak-check=full" ./src/tlsdate -v -V -n -H encrypted.google.com

# This allows us to parse the Mozilla NSS CA trusted root list and ensures we
# respect the trust bits as they are set - using them directly without the
# context is dangerous. This gives us a basic set of CA roots to trust for use
# with tlsdate without relying on any system CA list.
# You'll need agl's extract-nss-root-certs to recreate this file:
# https://github.com/agl/extract-nss-root-certs
update_ca_root_data:
	curl https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt\?raw\=1 -o ca-roots/certdata.txt
	go run ~/Documents/code/git/extract-nss-root-certs/convert_mozilla_certdata.go ca-roots/certdata.txt > ca-roots/tlsdate-ca-roots.conf
	rm ca-roots/certdata.txt

test_run:
	./src/tlsdate-helper google.com 443 tlsv1 racket verbose ca-roots/tlsdate-ca-roots.conf dont-set-clock showtime no-fun holdfast none

BUILT_SOURCES+= src/configmake.h
noinst_HEADERS+= src/configmake.h
src/configmake.h: ${top_srcdir}/Makefile.in
	@echo "Making $@"
	@rm -f $@-t $@
	@{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
	  echo '#define TLSDATE_CONFIG "$(sysconfdir)/ca-roots/"'; \
	  echo '#define TLSDATE_CERTFILE "$(sysconfdir)/tlsdate/ca-roots/tlsdate-ca-roots.conf"'; \
	  echo '#define TLSDATE_CONF_DIR "$(sysconfdir)/tlsdate/"'; \
	  echo '#define TLSDATE_HELPER "$(bindir)/tlsdate-helper"'; \
	  echo '#define TLSDATE "$(bindir)/tlsdate"'; \
	  echo '#define TLSDATED "$(bindir)/tlsdated"'; \
	  } | sed '/""/d' > $@-t
	@if diff $@-t $@ >/dev/null 2>&1 ; then \
	  rm @-t ; \
	  else \
	  mv $@-t $@ ; \
	  fi