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