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@
33 INSTALL_SCRIPT
:=@INSTALL_SCRIPT@
36 exec_prefix:=@
exec_prefix@
38 sysconfdir
:=@sysconfdir@
39 datarootdir
:=@datarootdir@
40 transform
:=@program_transform_name@
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 \
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
)
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 \
65 # version.o is handled specially below and in the link rule for secnet.
67 TEST_OBJECTS
:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
70 ifeq (version.o
,$(MAKECMDGOALS
))
75 STALE_PYTHON_FILES
= $(foreach e
, py pyc
, \
76 $(foreach p
, /usr
/usr
/local
, \
77 $(foreach l
, ipaddr
, \
78 $p/share
/secnet
/$l.
$e \
84 flex
--header
=$*.yy.h
-o
$@
$<
90 $(CC
) $(CPPFLAGS
) $(ALL_CFLAGS
) -c
$< -o
$@
94 # Automatic remaking of configuration files, from autoconf documentation
95 ${srcdir}/configure
: configure.in
96 cd
${srcdir} && autoconf
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
105 stamp-h
: config.h.in config.status
108 Makefile
: Makefile.in config.status
111 config.status
: configure
112 .
/config.status
--recheck
113 # End of config file remaking rules
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
)
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
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.)
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
)
141 check: eax-aes-test.confirm eax-serpent-test.confirm \
142 eax-serpentbe-test.confirm check-ipaddrset
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
; \
152 echo
"char version[]=\"secnet $$v\";" >>$@.new
155 eax-
%-test: eax-
%-test.o eax-test.o
%.o
156 $(CC
) $(LDFLAGS
) $(ALL_CFLAGS
) -o
$@
$^
158 eax-
%-test.confirm
: eax-
%-test eax-
%-test.vectors
159 .
/$< <$(srcdir)/eax-
$*-test.vectors
>$@.new
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
166 .PRECIOUS
: eax-
%-test
169 $(INSTALL
) -d
$(prefix)/share
/secnet
$(sbindir
)
170 $(INSTALL
) -d
$(mandir)/man8
171 $(INSTALL
) -d
$(datarootdir
)/secnet
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'"; \
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
190 rm -f
$(STALE_PYTHON_FILES
)
194 $(RM
) -f
*.o
*.yy.c
*.tab.
[ch
] $(TARGETS
) core version.c
195 $(RM
) -f
*.d
*~ eax-
*-test.confirm eax-
*-test
198 $(RM
) -f
*~ Makefile config.h
*.d \
199 config.log config.status config.cache \
204 pfname
:=$(PACKAGE
)-$(VERSION
)
205 tarfname
:=..
/$(pfname
).
tar
207 $(RM
) -rf
$(tarfname
) $(tarfname
).gz
208 git archive
--format
=tar --prefix=$(pfname
)/ HEAD
-o
$(tarfname
)
212 # 1. Check that the tree has what you want
214 # 2. Update VERSION (above) and debian/changelog
220 # and check that the resulting tarball looks OK.
221 # Eg, untar it and build it, or have it reviewed.
223 # 3. Commit the updates to VERSION (above) and debian/changelog
225 # 4. git-tag -m "secnet $VERSION" -s v$VERSION
227 # 5. git-push origin v$VERSION v${VERSION}~0:master
232 # 7. gpg --detach-sign ../secnet-$VERSION.tar.gz
234 # 8. rsync -v ../secnet-$VERSION.tar.gz* \
235 # chiark:/home/ianmdlvl/public-html/secnet/download/
238 # tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$VERSION.tar.gz
241 # fakeroot debian/rules binary
242 # mv ../secnet_${VERSION}_i386.deb ~ianmdlvl/public-html/secnet/download/
244 # 10. On chiark as user secnet:
245 # cd ~secnet/public-html/release/
248 # ln -s /home/ianmdlvl/public-html/secnet/download/secnet?$VERSION* .
250 # 11. write and post a release announcement