chiark / gitweb /
udp: Support IPv6 when using authbind
[secnet.git] / 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.3.4
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
34 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
35         -W -Wno-unused -Wno-unused-parameter \
36         -Wno-pointer-sign -Wstrict-prototypes -Wmissing-prototypes \
37         -Wmissing-declarations -Wnested-externs -Wredundant-decls \
38         -Wpointer-arith -Wformat=2 -Winit-self \
39         -Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
40         -Wno-strict-aliasing -fno-strict-aliasing \
41         -MMD
42 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) $(EXTRA_CFLAGS)
43 CPPFLAGS:=@CPPFLAGS@ $(EXTRA_CPPFLAGS)
44 LDFLAGS:=@LDFLAGS@ $(EXTRA_LDFLAGS)
45 LDLIBS:=@LIBS@ $(EXTRA_LDLIBS)
46
47 prefix:=@prefix@
48 exec_prefix:=@exec_prefix@
49 sbindir:=@sbindir@
50 sysconfdir:=@sysconfdir@
51 transform:=@program_transform_name@
52 mandir:=@mandir@
53
54 TARGETS:=secnet
55
56 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
57         resolver.o random.o udp.o site.o transform-cbcmac.o transform-eax.o \
58         netlink.o rsa.o dh.o serpent.o serpentbe.o \
59         md5.o sha512.o tun.o slip.o sha1.o ipaddr.o log.o \
60         process.o @LIBOBJS@ \
61         hackypar.o
62 # version.o is handled specially below and in the link rule for secnet.
63
64 TEST_OBJECTS:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
65                 eax-test.o aes.o
66
67 ifeq (version.o,$(MAKECMDGOALS))
68 OBJECTS:=version.o
69 TEST_OBJECTS:=
70 endif
71
72 %.c:    %.y
73
74 %.yy.c: %.fl
75         flex --header=$*.yy.h -o$@ $<
76
77 %.tab.c %.tab.h:        %.y
78         bison -d -o $@ $<
79
80 %.o: %.c
81         $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
82
83 all:    $(TARGETS) check
84
85 # Automatic remaking of configuration files, from autoconf documentation
86 ${srcdir}/configure: configure.in
87         cd ${srcdir} && autoconf
88
89 # autoheader might not change config.h.in, so touch a stamp file.
90 ${srcdir}/config.h.in: stamp-h.in
91 ${srcdir}/stamp-h.in: configure.in
92         cd ${srcdir} && autoheader
93         echo timestamp > ${srcdir}/stamp-h.in
94
95 config.h: stamp-h
96 stamp-h: config.h.in config.status
97         ./config.status
98
99 Makefile: Makefile.in config.status
100         ./config.status
101
102 config.status: configure
103         ./config.status --recheck
104 # End of config file remaking rules
105
106 # C and header file dependency rules
107 SOURCES:=$(OBJECTS:.o=.c) $(TEST_OBJECTS:.o=.c)
108 DEPENDS:=$(OBJECTS:.o=.d) $(TEST_OBJECTS:.o=.d)
109
110 -include *.d
111
112 # Manual dependencies section
113 conffile.yy.c:  conffile.fl conffile.tab.c
114 conffile.yy.h:  conffile.yy.c
115 conffile.tab.c: conffile.y
116 # End of manual dependencies section
117
118 secnet: $(OBJECTS)
119         $(MAKE) version.o # *.o $(filter-out %.o, $^)
120         $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) version.o $(LDLIBS)
121 # We (always) regenerate the version, but only if we regenerate the
122 # binary.  (This is necessary as the version string is can depend on
123 # any of the source files, eg to see whether "+" is needed.)
124
125 ifneq (,$(wildcard .git/HEAD))
126 # If we have (eg) committed, relink and thus regenerate the version
127 # with the new info from git describe.
128 secnet: Makefile .git/HEAD $(shell sed -n 's#^ref: #.git/#p' .git/HEAD)
129 secnet: $(wildcard .git/packed-refs)
130 endif
131
132 check: eax-aes-test.confirm eax-serpent-test.confirm \
133         eax-serpentbe-test.confirm
134
135 version.c: Makefile
136         echo "#include \"secnet.h\"" >$@.new
137         @set -ex; if test -e .git; then \
138                 v=$$(git describe --match 'v*'); v=$${v#v}; \
139                 if ! git diff --quiet HEAD; then v="$$v+"; fi; \
140         else \
141                 v="$(VERSION)"; \
142         fi; \
143         echo "char version[]=\"secnet $$v\";" >>$@.new
144         mv -f $@.new $@
145
146 eax-%-test: eax-%-test.o eax-test.o %.o
147         $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
148
149 eax-%-test.confirm: eax-%-test eax-%-test.vectors
150         ./$< <$(srcdir)/eax-$*-test.vectors >$@.new
151         mv -f $@.new $@
152
153 .PRECIOUS: eax-%-test
154
155 installdirs:
156         $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
157         $(INSTALL) -d $(mandir)/man8
158
159 install: installdirs
160         $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
161         $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
162         $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
163         $(INSTALL) secnet.8 $(mandir)/man8/secnet.8
164
165 clean:
166         $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
167         $(RM) -f *.d *~ eax-*-test.confirm eax-*-test
168
169 realclean:      clean
170         $(RM) -f *~ Makefile config.h  *.d \
171         config.log config.status config.cache \
172         stamp-h Makefile.bak
173
174 distclean:      realclean
175
176 pfname:=$(PACKAGE)-$(VERSION)
177 tarfname:=../$(pfname).tar
178 dist:
179         $(RM) -rf $(tarfname) $(tarfname).gz
180         git archive --format=tar --prefix=$(pfname)/ HEAD -o $(tarfname)
181         gzip -9f $(tarfname)
182
183 # Release checklist:
184 #  1. Check that the tree has what you want
185 #
186 #  2. Update VERSION (above) and debian/changelog
187 #     but DO NOT COMMIT
188 #
189 #  3. Run
190 #       ./configure
191 #       make dist
192 #     and check that the resulting tarball looks OK.
193 #     Eg, untar it and build it, or have it reviewed.
194 #
195 #  3. Commit the updates to VERSION (above) and debian/changelog
196 #
197 #  4. git-tag -m "secnet $VERSION" -s v$VERSION
198 #
199 #  5. git-push origin v$VERSION v${VERSION}~0:master
200 #
201 #  6. Run, again,
202 #       make dist
203 #
204 #  7. gpg --detach-sign ../secnet-$VERSION.tar.gz
205 #
206 #  8. rsync -v ../secnet-$VERSION.tar.gz* \
207 #        chiark:/home/ianmdlvl/public-html/secnet/download/
208 #
209 #  9. On chiark:
210 #       tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$VERSION.tar.gz
211 #       cd secnet-$VERSION
212 #       debian/rules build
213 #       fakeroot debian/rules binary
214 #       mv ../secnet_${VERSION}_i386.deb ~ianmdlvl/public-html/secnet/download/
215 #
216 #  10. On chiark as user secnet:
217 #       cd ~secnet/public-html/release/
218 #       mkdir $VERSION
219 #       cd $VERSION
220 #       ln -s /home/ianmdlvl/public-html/secnet/download/secnet?$VERSION* .
221 #
222 #  11. write and post a release announcement