secnet.8: Describe capability negotiation in its own section.
[secnet] / Makefile.in
CommitLineData
974d0468 1# Makefile for secnet
c215a4bc
IJ
2#
3# This file is part of secnet.
4# See README for full list of copyright holders.
5#
6# secnet is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License as published by
9c6a8729 8# the Free Software Foundation; either version 3 of the License, or
c215a4bc
IJ
9# (at your option) any later version.
10#
11# secnet is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# General Public License for more details.
15#
974d0468 16# You should have received a copy of the GNU General Public License
c215a4bc
IJ
17# version 3 along with secnet; if not, see
18# https://www.gnu.org/licenses/gpl.html.
974d0468 19
d3fe100d 20.PHONY: all clean realclean distclean dist install
2fe58dfd
SE
21
22PACKAGE:=secnet
edc9e302 23VERSION=0.4.5
2fe58dfd
SE
24
25@SET_MAKE@
26
27srcdir:=@srcdir@
28VPATH:=@srcdir@
29
974d0468
SE
30SHELL:=/bin/sh
31RM:=@RM@
32CC:=@CC@
33INSTALL:=@INSTALL@
34INSTALL_PROGRAM:=@INSTALL_PROGRAM@
e61a41a4 35INSTALL_SCRIPT:=@INSTALL_SCRIPT@
9c7a0b4e 36INSTALL_DATA:=@INSTALL_DATA@
2fe58dfd 37
af720152 38prefix:=$(DESTDIR)@prefix@
328ae477
IJ
39exec_prefix:=@exec_prefix@
40sbindir:=@sbindir@
af720152 41sysconfdir:=$(DESTDIR)@sysconfdir@
e61a41a4 42datarootdir:=@datarootdir@
328ae477
IJ
43transform:=@program_transform_name@
44mandir:=@mandir@
45
0ade8ecc 46CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
b24a72ef 47 -W -Wno-unused -Wno-unused-parameter \
18ca0b44
IJ
48 -Wno-pointer-sign -Wstrict-prototypes -Wmissing-prototypes \
49 -Wmissing-declarations -Wnested-externs -Wredundant-decls \
50 -Wpointer-arith -Wformat=2 -Winit-self \
07575765 51 -Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
76f7ef9c
IJ
52 -Wno-strict-aliasing -fno-strict-aliasing \
53 -MMD
68438849 54ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) $(EXTRA_CFLAGS)
e61a41a4 55CPPFLAGS:=@CPPFLAGS@ -DDATAROOTDIR='"$(datarootdir)"' $(EXTRA_CPPFLAGS)
68438849
IJ
56LDFLAGS:=@LDFLAGS@ $(EXTRA_LDFLAGS)
57LDLIBS:=@LIBS@ $(EXTRA_LDLIBS)
2fe58dfd
SE
58
59TARGETS:=secnet
60
61OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
b02b720a 62 resolver.o random.o udp.o site.o transform-cbcmac.o transform-eax.o \
ce5c098f 63 comm-common.o polypath.o \
b02b720a 64 netlink.o rsa.o dh.o serpent.o serpentbe.o \
e4cfe537 65 md5.o sha512.o tun.o slip.o sha1.o ipaddr.o log.o \
3b83c932
SE
66 process.o @LIBOBJS@ \
67 hackypar.o
e4cfe537 68# version.o is handled specially below and in the link rule for secnet.
9d3a4132 69
9018e07a
IJ
70TEST_OBJECTS:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
71 eax-test.o aes.o
72
e4cfe537
IJ
73ifeq (version.o,$(MAKECMDGOALS))
74OBJECTS:=version.o
75TEST_OBJECTS:=
76endif
77
e250348a
IJ
78STALE_PYTHON_FILES= $(foreach e, py pyc, \
79 $(foreach p, /usr /usr/local, \
80 $(foreach l, ipaddr, \
af720152 81 $(DESTDIR)$p/share/secnet/$l.$e \
e250348a
IJ
82 )))
83
2fe58dfd
SE
84%.c: %.y
85
86%.yy.c: %.fl
27f5042b 87 flex --header=$*.yy.h -o$@ $<
2fe58dfd 88
76eca292 89%.tab.c %.tab.h: %.y
8689b3a9 90 bison -d -o $@ $<
2fe58dfd 91
c26f37f0 92%.o: %.c conffile.yy.h
fe5e9cc4 93 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
2fe58dfd 94
9018e07a 95all: $(TARGETS) check
2fe58dfd 96
8689b3a9
SE
97# Automatic remaking of configuration files, from autoconf documentation
98${srcdir}/configure: configure.in
99 cd ${srcdir} && autoconf
100
101# autoheader might not change config.h.in, so touch a stamp file.
102${srcdir}/config.h.in: stamp-h.in
f74f5f43 103${srcdir}/stamp-h.in: configure.in
8689b3a9
SE
104 cd ${srcdir} && autoheader
105 echo timestamp > ${srcdir}/stamp-h.in
106
107config.h: stamp-h
108stamp-h: config.h.in config.status
109 ./config.status
110
974d0468 111Makefile: Makefile.in config.status
8689b3a9 112 ./config.status
974d0468
SE
113
114config.status: configure
8689b3a9
SE
115 ./config.status --recheck
116# End of config file remaking rules
59635212 117
d3fe100d 118# C and header file dependency rules
9018e07a
IJ
119SOURCES:=$(OBJECTS:.o=.c) $(TEST_OBJECTS:.o=.c)
120DEPENDS:=$(OBJECTS:.o=.d) $(TEST_OBJECTS:.o=.d)
d3fe100d 121
76f7ef9c 122-include *.d
d3fe100d
SE
123
124# Manual dependencies section
8689b3a9 125conffile.yy.c: conffile.fl conffile.tab.c
27f5042b 126conffile.yy.h: conffile.yy.c
8689b3a9
SE
127conffile.tab.c: conffile.y
128# End of manual dependencies section
974d0468 129
8af1390a
IJ
130conffile.yy.o: ALL_CFLAGS += -Wno-sign-compare
131
2fe58dfd 132secnet: $(OBJECTS)
e4cfe537
IJ
133 $(MAKE) version.o # *.o $(filter-out %.o, $^)
134 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) version.o $(LDLIBS)
135# We (always) regenerate the version, but only if we regenerate the
136# binary. (This is necessary as the version string is can depend on
137# any of the source files, eg to see whether "+" is needed.)
138
139ifneq (,$(wildcard .git/HEAD))
140# If we have (eg) committed, relink and thus regenerate the version
141# with the new info from git describe.
142secnet: Makefile .git/HEAD $(shell sed -n 's#^ref: #.git/#p' .git/HEAD)
143secnet: $(wildcard .git/packed-refs)
144endif
2fe58dfd 145
9018e07a 146check: eax-aes-test.confirm eax-serpent-test.confirm \
7b2ef224
MW
147 eax-serpentbe-test.confirm check-ipaddrset \
148 msgcode-test.confirm
9018e07a 149
974d0468 150version.c: Makefile
fcbc5905 151 echo "#include \"secnet.h\"" >$@.new
509a30c0 152 @set -ex; if test -e .git && type -p git >/dev/null; then \
e4cfe537
IJ
153 v=$$(git describe --match 'v*'); v=$${v#v}; \
154 if ! git diff --quiet HEAD; then v="$$v+"; fi; \
155 else \
156 v="$(VERSION)"; \
157 fi; \
158 echo "char version[]=\"secnet $$v\";" >>$@.new
fcbc5905 159 mv -f $@.new $@
974d0468 160
9018e07a
IJ
161eax-%-test: eax-%-test.o eax-test.o %.o
162 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
163
164eax-%-test.confirm: eax-%-test eax-%-test.vectors
165 ./$< <$(srcdir)/eax-$*-test.vectors >$@.new
166 mv -f $@.new $@
167
7b2ef224
MW
168msgcode-test: msgcode-test.o
169 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
170
171msgcode-test.confirm: msgcode-test
172 ./msgcode-test
173 touch $@
174
6437945a
IJ
175check-ipaddrset: ipaddrset-test.py ipaddrset.py ipaddrset-test.expected
176 $(srcdir)/ipaddrset-test.py >ipaddrset-test.new
889ae0a2 177 diff -u $(srcdir)/ipaddrset-test.expected ipaddrset-test.new
6437945a 178
9018e07a
IJ
179.PRECIOUS: eax-%-test
180
60fe3102 181installdirs:
d3fe100d 182 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
3ca86f6d 183 $(INSTALL) -d $(mandir)/man8
e61a41a4 184 $(INSTALL) -d $(datarootdir)/secnet
60fe3102
RK
185
186install: installdirs
e250348a
IJ
187 set -e; ok=true; for f in $(STALE_PYTHON_FILES); do \
188 if test -e $$f; then \
189 echo >&2 "ERROR: $$f still exists "\
190 "- try \`make install-force'"; \
191 ok=false; \
192 fi; \
193 done; \
194 $$ok
d3fe100d
SE
195 $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
196 $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
9c7a0b4e 197 $(INSTALL_DATA) ${srcdir}/ipaddrset.py $(prefix)/share/secnet/ipaddrset.py
e61a41a4
IJ
198 $(INSTALL_SCRIPT) ${srcdir}/polypath-interface-monitor-linux \
199 $(datarootdir)/secnet/.
bdc4c1f9 200 $(INSTALL_DATA) ${srcdir}/secnet.8 $(mandir)/man8/secnet.8
974d0468 201
e250348a
IJ
202install-force:
203 rm -f $(STALE_PYTHON_FILES)
204 $(MAKE) install
205
2fe58dfd 206clean:
c26f37f0 207 $(RM) -f *.o *.yy.[ch] *.tab.[ch] $(TARGETS) core version.c
4b478582 208 $(RM) -f *.d *.pyc *~ eax-*-test.confirm eax-*-test
7b2ef224 209 $(RM) -f msgcode-test.confirm msgcode-test
2fe58dfd
SE
210
211realclean: clean
d3fe100d 212 $(RM) -f *~ Makefile config.h *.d \
8689b3a9
SE
213 config.log config.status config.cache \
214 stamp-h Makefile.bak
2fe58dfd 215
469fd1d9
SE
216distclean: realclean
217
2562e34b 218# Release checklist:
0e99d630
IJ
219#
220# 0. Use this checklist from Makefile.in
221#
2562e34b
IJ
222# 1. Check that the tree has what you want
223#
a9ebbc41
IJ
224# 2. Update changelog:
225# gbp dch --since=<PREVIOUS VERSION>
226# and then edit debian/changelog.
2562e34b 227#
a9ebbc41
IJ
228# 3. Update VERSION (in this file, above) and
229# finalise debian/changelog (removing ~ from version) and commit.
2562e34b 230#
a9ebbc41
IJ
231# 4. Build source and binaries:
232# dgit -wgf sbuild -A -c stretch
2562e34b 233#
a9ebbc41
IJ
234# 5. dpkg -i on zealot just to check
235# dpkg -i ~ian/things/Fvpn/bpd/secnet_${VERSION}_amd64.deb
2562e34b 236#
a9ebbc41
IJ
237# 6. run it on chiark
238# check we can still ping davenant and chiark
2562e34b 239#
a9ebbc41
IJ
240# 7. Make git tag and source tarball signature:
241# git-tag -u general -m "secnet $VERSION" -s v${VERSION//\~/_}
242# gpg -u general --detach-sign ../bpd/secnet_$VERSION.tar.gz
fd44936f 243#
a9ebbc41
IJ
244# 8. Publish the branch and distriubtion files:
245# git-push origin v${VERSION//\~/_} v${VERSION//\~/_}~0:master
246# dcmd rsync -v ../bpd/secnet_${VERSION}_multi.changes chiark:/home/ianmdlvl/public-html/secnet/download/
b57cc2eb 247#
a9ebbc41 248# 9. Sort out html. On chiark as user secnet:
9c8b8146
IJ
249# cd ~secnet/public-html/release/
250# mkdir $VERSION
251# cd $VERSION
252# ln -s /home/ianmdlvl/public-html/secnet/download/secnet?$VERSION* .
a9ebbc41
IJ
253# ln -sfn $VERSION ../current
254#
255# 10. write and post a release announcement
256# cd ../bpd
257# dcmd sha256sum secnet_${VERSION}_multi.changes
258# ...
259# gpg --clearsign ../release-announcement
260# rsync -vP ../release-announcement.asc c:mail/d/
66ee7152 261#
a9ebbc41 262# 11. bump changelog version in master, to new version with ~