2 # Copyright (C) 1995-2001 Stephen Early <steve@greenend.org.uk>
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)
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.
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.
18 .PHONY: all clean realclean distclean dist install
32 INSTALL_PROGRAM:=@INSTALL_PROGRAM@
34 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
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 -Wbad-function-cast \
40 -Wno-strict-aliasing -fno-strict-aliasing
41 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) $(EXTRA_CFLAGS)
42 CPPFLAGS:=@CPPFLAGS@ $(EXTRA_CPPFLAGS)
43 LDFLAGS:=@LDFLAGS@ $(EXTRA_LDFLAGS)
44 LDLIBS:=@LIBS@ $(EXTRA_LDLIBS)
47 exec_prefix:=@exec_prefix@
49 sysconfdir:=@sysconfdir@
50 transform:=@program_transform_name@
55 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
56 resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \
57 serpentbe.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
61 TEST_OBJECTS:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
67 flex --header=$*.yy.h -o$@ $<
73 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
77 # Automatic remaking of configuration files, from autoconf documentation
78 ${srcdir}/configure: configure.in
79 cd ${srcdir} && autoconf
81 # autoheader might not change config.h.in, so touch a stamp file.
82 ${srcdir}/config.h.in: stamp-h.in
83 ${srcdir}/stamp-h.in: configure.in
84 cd ${srcdir} && autoheader
85 echo timestamp > ${srcdir}/stamp-h.in
88 stamp-h: config.h.in config.status
91 Makefile: Makefile.in config.status
94 config.status: configure
95 ./config.status --recheck
96 # End of config file remaking rules
98 # C and header file dependency rules
99 SOURCES:=$(OBJECTS:.o=.c) $(TEST_OBJECTS:.o=.c)
100 DEPENDS:=$(OBJECTS:.o=.d) $(TEST_OBJECTS:.o=.d)
102 $(DEPENDS): ${srcdir}/depend.sh
105 ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
109 # Manual dependencies section
110 conffile.yy.c: conffile.fl conffile.tab.c
111 conffile.yy.h: conffile.yy.c
112 conffile.tab.c: conffile.y
113 # End of manual dependencies section
116 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
118 check: eax-aes-test.confirm eax-serpent-test.confirm \
119 eax-serpentbe-test.confirm
122 echo "#include \"secnet.h\"" >$@.new
123 echo "char version[]=\"secnet $(VERSION)\";" >>$@.new
126 eax-%-test: eax-%-test.o eax-test.o %.o
127 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
129 eax-%-test.confirm: eax-%-test eax-%-test.vectors
130 ./$< <$(srcdir)/eax-$*-test.vectors >$@.new
133 .PRECIOUS: eax-%-test
136 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
137 $(INSTALL) -d $(mandir)/man8
140 $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
141 $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
142 $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
143 $(INSTALL) secnet.8 $(mandir)/man8/secnet.8
146 $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
147 $(RM) -f *.d *~ eax-*-test.confirm eax-*-test
150 $(RM) -f *~ Makefile config.h *.d \
151 config.log config.status config.cache \
156 pfname:=$(PACKAGE)-$(VERSION)
157 tarfname:=../$(pfname).tar
159 $(RM) -rf $(tarfname) $(tarfname).gz
160 git archive --format=tar --prefix=$(pfname)/ HEAD -o $(tarfname)
164 # 1. Check that the tree has what you want
166 # 2. Update VERSION (above) and debian/changelog
172 # and check that the resulting tarball looks OK.
173 # Eg, untar it and build it, or have it reviewed.
175 # 3. Commit the updates to VERSION (above) and debian/changelog
177 # 4. git-tag -s v$(VERSION)
184 # 7. gpg --detach-sign ../secnet-$(VERSION).tar.gz
186 # 8. rsync -v ../secnet-$VERSION.tar.gz* \
187 # chiark:/home/ianmdlvl/public-html/secnet/download/
190 # tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$(VERSION).tar.gz
191 # cd secnet-$(VERSION)
193 # fakeroot debian/rules binary
194 # mv ../secnet_0.1.18.1-1_i386.deb ~/public-html/secnet/download/
196 # 10. On chiark as user secnet:
198 # rsync ~ianmdlvl/public-html/secnet/download/secnet* .
200 # 11. write and post a release announcement