polypath: Make message class an argument to bad() callbacks
[secnet] / Makefile.in
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
18 .PHONY: all clean realclean distclean dist install
19
20 PACKAGE:=secnet
21 VERSION:=0.4.0~beta1
22
23 @SET_MAKE@
24
25 srcdir:=@srcdir@
26 VPATH:=@srcdir@
27
28 SHELL:=/bin/sh
29 RM:=@RM@
30 CC:=@CC@
31 INSTALL:=@INSTALL@
32 INSTALL_PROGRAM:=@INSTALL_PROGRAM@
33 INSTALL_SCRIPT:=@INSTALL_SCRIPT@
34
35 prefix:=@prefix@
36 exec_prefix:=@exec_prefix@
37 sbindir:=@sbindir@
38 sysconfdir:=@sysconfdir@
39 datarootdir:=@datarootdir@
40 transform:=@program_transform_name@
41 mandir:=@mandir@
42
43 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
44 -W -Wno-unused -Wno-unused-parameter \
45 -Wno-pointer-sign -Wstrict-prototypes -Wmissing-prototypes \
46 -Wmissing-declarations -Wnested-externs -Wredundant-decls \
47 -Wpointer-arith -Wformat=2 -Winit-self \
48 -Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
49 -Wno-strict-aliasing -fno-strict-aliasing \
50 -MMD
51 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) $(EXTRA_CFLAGS)
52 CPPFLAGS:=@CPPFLAGS@ -DDATAROOTDIR='"$(datarootdir)"' $(EXTRA_CPPFLAGS)
53 LDFLAGS:=@LDFLAGS@ $(EXTRA_LDFLAGS)
54 LDLIBS:=@LIBS@ $(EXTRA_LDLIBS)
55
56 TARGETS:=secnet
57
58 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
59 resolver.o random.o udp.o site.o transform-cbcmac.o transform-eax.o \
60 comm-common.o polypath.o \
61 netlink.o rsa.o dh.o serpent.o serpentbe.o \
62 md5.o sha512.o tun.o slip.o sha1.o ipaddr.o log.o \
63 process.o @LIBOBJS@ \
64 hackypar.o
65 # version.o is handled specially below and in the link rule for secnet.
66
67 TEST_OBJECTS:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
68 eax-test.o aes.o
69
70 ifeq (version.o,$(MAKECMDGOALS))
71 OBJECTS:=version.o
72 TEST_OBJECTS:=
73 endif
74
75 STALE_PYTHON_FILES= $(foreach e, py pyc, \
76 $(foreach p, /usr /usr/local, \
77 $(foreach l, ipaddr, \
78 $p/share/secnet/$l.$e \
79 )))
80
81 %.c: %.y
82
83 %.yy.c: %.fl
84 flex --header=$*.yy.h -o$@ $<
85
86 %.tab.c %.tab.h: %.y
87 bison -d -o $@ $<
88
89 %.o: %.c conffile.yy.h
90 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
91
92 all: $(TARGETS) check
93
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
100 ${srcdir}/stamp-h.in: configure.in
101 cd ${srcdir} && autoheader
102 echo timestamp > ${srcdir}/stamp-h.in
103
104 config.h: stamp-h
105 stamp-h: config.h.in config.status
106 ./config.status
107
108 Makefile: Makefile.in config.status
109 ./config.status
110
111 config.status: configure
112 ./config.status --recheck
113 # End of config file remaking rules
114
115 # C and header file dependency rules
116 SOURCES:=$(OBJECTS:.o=.c) $(TEST_OBJECTS:.o=.c)
117 DEPENDS:=$(OBJECTS:.o=.d) $(TEST_OBJECTS:.o=.d)
118
119 -include *.d
120
121 # Manual dependencies section
122 conffile.yy.c: conffile.fl conffile.tab.c
123 conffile.yy.h: conffile.yy.c
124 conffile.tab.c: conffile.y
125 # End of manual dependencies section
126
127 secnet: $(OBJECTS)
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
134 ifneq (,$(wildcard .git/HEAD))
135 # If we have (eg) committed, relink and thus regenerate the version
136 # with the new info from git describe.
137 secnet: Makefile .git/HEAD $(shell sed -n 's#^ref: #.git/#p' .git/HEAD)
138 secnet: $(wildcard .git/packed-refs)
139 endif
140
141 check: eax-aes-test.confirm eax-serpent-test.confirm \
142 eax-serpentbe-test.confirm check-ipaddrset
143
144 version.c: Makefile
145 echo "#include \"secnet.h\"" >$@.new
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
153 mv -f $@.new $@
154
155 eax-%-test: eax-%-test.o eax-test.o %.o
156 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
157
158 eax-%-test.confirm: eax-%-test eax-%-test.vectors
159 ./$< <$(srcdir)/eax-$*-test.vectors >$@.new
160 mv -f $@.new $@
161
162 check-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
166 .PRECIOUS: eax-%-test
167
168 installdirs:
169 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
170 $(INSTALL) -d $(mandir)/man8
171 $(INSTALL) -d $(datarootdir)/secnet
172
173 install: installdirs
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
182 $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
183 $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
184 $(INSTALL) ${srcdir}/ipaddrset.py $(prefix)/share/secnet/ipaddrset.py
185 $(INSTALL_SCRIPT) ${srcdir}/polypath-interface-monitor-linux \
186 $(datarootdir)/secnet/.
187 $(INSTALL) secnet.8 $(mandir)/man8/secnet.8
188
189 install-force:
190 rm -f $(STALE_PYTHON_FILES)
191 $(MAKE) install
192
193 clean:
194 $(RM) -f *.o *.yy.[ch] *.tab.[ch] $(TARGETS) core version.c
195 $(RM) -f *.d *.pyc *~ eax-*-test.confirm eax-*-test
196
197 realclean: clean
198 $(RM) -f *~ Makefile config.h *.d \
199 config.log config.status config.cache \
200 stamp-h Makefile.bak
201
202 distclean: realclean
203
204 pfname:=$(PACKAGE)-$(VERSION)
205 tarfname:=../$(pfname).tar
206 dist:
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 #
214 # 2. Update VERSION (above) and debian/changelog
215 # but DO NOT COMMIT
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 #
223 # 3. Commit the updates to VERSION (above) and debian/changelog
224 #
225 # 4. git-tag -m "secnet $VERSION" -s v$VERSION
226 #
227 # 5. git-push origin v$VERSION v${VERSION}~0:master
228 #
229 # 6. Run, again,
230 # make dist
231 #
232 # 7. gpg --detach-sign ../secnet-$VERSION.tar.gz
233 #
234 # 8. rsync -v ../secnet-$VERSION.tar.gz* \
235 # chiark:/home/ianmdlvl/public-html/secnet/download/
236 #
237 # 9. On chiark:
238 # tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$VERSION.tar.gz
239 # cd secnet-$VERSION
240 # debian/rules build
241 # fakeroot debian/rules binary
242 # mv ../secnet_${VERSION}_i386.deb ~ianmdlvl/public-html/secnet/download/
243 #
244 # 10. On chiark as user secnet:
245 # cd ~secnet/public-html/release/
246 # mkdir $VERSION
247 # cd $VERSION
248 # ln -s /home/ianmdlvl/public-html/secnet/download/secnet?$VERSION* .
249 #
250 # 11. write and post a release announcement