3 # This file is part of secnet.
4 # See README for full list of copyright holders.
6 # secnet is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # secnet is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # version 3 along with secnet; if not, see
18 # https://www.gnu.org/licenses/gpl.html.
20 .PHONY
: all clean realclean distclean dist install
34 INSTALL_PROGRAM
:=@INSTALL_PROGRAM@
35 INSTALL_SCRIPT
:=@INSTALL_SCRIPT@
36 INSTALL_DATA
:=@INSTALL_DATA@
38 prefix:=$(DESTDIR
)@
prefix@
39 exec_prefix:=@
exec_prefix@
41 sysconfdir
:=$(DESTDIR
)@sysconfdir@
42 datarootdir
:=@datarootdir@
43 transform
:=@program_transform_name@
46 CFLAGS
:=-Wall @WRITESTRINGS@ @CFLAGS@
-Werror \
47 -W
-Wno-unused
-Wno-unused-parameter \
48 -Wno-pointer-sign
-Wstrict-prototypes
-Wmissing-prototypes \
49 -Wmissing-declarations
-Wnested-externs
-Wredundant-decls \
50 -Wpointer-arith
-Wformat
=2 -Winit-self \
51 -Wswitch-enum
-Wunused-variable
-Wunused-function
-Wbad-function-cast \
52 -Wno-strict-aliasing
-fno-strict-aliasing \
54 ALL_CFLAGS
:=@DEFS@
-I
$(srcdir) -I.
$(CFLAGS
) $(EXTRA_CFLAGS
)
55 CPPFLAGS
:=@CPPFLAGS@
-DDATAROOTDIR
='"$(datarootdir)"' $(EXTRA_CPPFLAGS
)
56 LDFLAGS
:=@LDFLAGS@
$(EXTRA_LDFLAGS
)
57 LDLIBS
:=@LIBS@
$(EXTRA_LDLIBS
)
61 OBJECTS
:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
62 resolver.o random.o udp.o site.o transform-cbcmac.o transform-eax.o \
63 comm-common.o polypath.o \
64 netlink.o rsa.o dh.o serpent.o serpentbe.o \
65 md5.o sha512.o tun.o slip.o sha1.o ipaddr.o log.o \
68 # version.o is handled specially below and in the link rule for secnet.
70 TEST_OBJECTS
:=eax-aes-test.o eax-serpent-test.o eax-serpentbe-test.o \
73 ifeq (version.o
,$(MAKECMDGOALS
))
78 STALE_PYTHON_FILES
= $(foreach e
, py pyc
, \
79 $(foreach p
, /usr
/usr
/local
, \
80 $(foreach l
, ipaddr
, \
81 $(DESTDIR
)$p/share
/secnet
/$l.
$e \
87 flex
--header
=$*.yy.h
-o
$@
$<
92 %.o
: %.c conffile.yy.h
93 $(CC
) $(CPPFLAGS
) $(ALL_CFLAGS
) -c
$< -o
$@
97 # Automatic remaking of configuration files, from autoconf documentation
98 ${srcdir}/configure
: configure.in
99 cd
${srcdir} && autoconf
101 # autoheader might not change config.h.in, so touch a stamp file.
102 ${srcdir}/config.h.in
: stamp-h.in
103 ${srcdir}/stamp-h.in
: configure.in
104 cd
${srcdir} && autoheader
105 echo timestamp
> ${srcdir}/stamp-h.in
108 stamp-h
: config.h.in config.status
111 Makefile
: Makefile.in config.status
114 config.status
: configure
115 .
/config.status
--recheck
116 # End of config file remaking rules
118 # C and header file dependency rules
119 SOURCES
:=$(OBJECTS
:.o
=.c
) $(TEST_OBJECTS
:.o
=.c
)
120 DEPENDS
:=$(OBJECTS
:.o
=.d
) $(TEST_OBJECTS
:.o
=.d
)
124 # Manual dependencies section
125 conffile.yy.c
: conffile.fl conffile.tab.c
126 conffile.yy.h
: conffile.yy.c
127 conffile.tab.c
: conffile.y
128 # End of manual dependencies section
130 conffile.yy.o
: ALL_CFLAGS
+= -Wno-sign-compare
133 $(MAKE
) version.o
# *.o $(filter-out %.o, $^)
134 $(CC
) $(LDFLAGS
) $(ALL_CFLAGS
) -o
$@
$(OBJECTS
) version.o
$(LDLIBS
)
135 # We (always) regenerate the version, but only if we regenerate the
136 # binary. (This is necessary as the version string is can depend on
137 # any of the source files, eg to see whether "+" is needed.)
139 ifneq (,$(wildcard .git
/HEAD
))
140 # If we have (eg) committed, relink and thus regenerate the version
141 # with the new info from git describe.
142 secnet
: Makefile .git
/HEAD
$(shell sed
-n
's#^ref: #.git/#p' .git
/HEAD
)
143 secnet
: $(wildcard .git
/packed-refs
)
146 check: eax-aes-test.confirm eax-serpent-test.confirm \
147 eax-serpentbe-test.confirm check-ipaddrset
150 echo
"#include \"secnet.h\"" >$@.new
151 @set
-ex
; if
test -e .git
&& type
-p git
>/dev
/null
; then \
152 v
=$$(git describe
--match
'v*'); v
=$${v
#v}; \
153 if
! git diff
--quiet HEAD
; then v
="$$v+"; fi
; \
157 echo
"char version[]=\"secnet $$v\";" >>$@.new
160 eax-
%-test: eax-
%-test.o eax-test.o
%.o
161 $(CC
) $(LDFLAGS
) $(ALL_CFLAGS
) -o
$@
$^
163 eax-
%-test.confirm
: eax-
%-test eax-
%-test.vectors
164 .
/$< <$(srcdir)/eax-
$*-test.vectors
>$@.new
167 check-ipaddrset
: ipaddrset-test.py ipaddrset.py ipaddrset-test.expected
168 $(srcdir)/ipaddrset-test.py
>ipaddrset-test.new
169 diff
-u
$(srcdir)/ipaddrset-test.expected ipaddrset-test.new
171 .PRECIOUS
: eax-
%-test
174 $(INSTALL
) -d
$(prefix)/share
/secnet
$(sbindir
)
175 $(INSTALL
) -d
$(mandir)/man8
176 $(INSTALL
) -d
$(datarootdir
)/secnet
179 set
-e
; ok
=true
; for f in
$(STALE_PYTHON_FILES
); do \
180 if
test -e
$$f; then \
181 echo
>&2 "ERROR: $$f still exists "\
182 "- try \`make install-force'"; \
187 $(INSTALL_PROGRAM
) secnet
$(sbindir
)/`echo secnet|sed '$(transform)'`
188 $(INSTALL_PROGRAM
) ${srcdir}/make-secnet-sites
$(sbindir
)/`echo make-secnet-sites|sed '$(transform)'`
189 $(INSTALL_DATA
) ${srcdir}/ipaddrset.py
$(prefix)/share
/secnet
/ipaddrset.py
190 $(INSTALL_SCRIPT
) ${srcdir}/polypath-interface-monitor-linux \
191 $(datarootdir
)/secnet
/.
192 $(INSTALL_DATA
) secnet
.8 $(mandir)/man8
/secnet
.8
195 rm -f
$(STALE_PYTHON_FILES
)
199 $(RM
) -f
*.o
*.yy.
[ch
] *.tab.
[ch
] $(TARGETS
) core version.c
200 $(RM
) -f
*.d
*.pyc
*~ eax-
*-test.confirm eax-
*-test
203 $(RM
) -f
*~ Makefile config.h
*.d \
204 config.log config.status config.cache \
209 pfname
:=$(PACKAGE
)-$(VERSION
)
210 tarfname
:=..
/$(pfname
).
tar
212 $(RM
) -rf
$(tarfname
) $(tarfname
).gz
213 git archive
--format
=tar --prefix=$(pfname
)/ HEAD
-o
$(tarfname
)
218 # 0. Use this checklist from Makefile.in
220 # 1. Check that the tree has what you want
222 # 2. Update VERSION (above) and debian/changelog
228 # and check that the resulting tarball looks OK.
229 # Eg, untar it and build it, or have it reviewed.
231 # 3. Commit the updates to VERSION (above) and debian/changelog
233 # 4. git-tag -m "secnet $VERSION" -s v${VERSION//\~/_}
235 # 5. git-push origin v${VERSION//\~/_} v${VERSION//\~/_}~0:master
240 # 7. gpg --detach-sign ../secnet-$VERSION.tar.gz
242 # 8. rsync -v ../secnet-$VERSION.tar.gz* \
243 # chiark:/home/ianmdlvl/public-html/secnet/download/
245 # 9. In zealot's squeeze chroot:
246 # rm -rf ../d; mkdir ../d; cd ../d
247 # tar zxf ../secnet-$VERSION.tar.gz
249 # dpkg-buildpackage -F -uc -us -rfakeroot
250 # rsync -vP ../secnet_${VERSION}_i386.deb ianmdlvl@chiark:public-html/secnet/download/
252 # 9a. On chiark as ianmdlvl:
253 # cd ~ianmdlvl/secnet-build/
254 # tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$VERSION.tar.gz
256 # dpkg-buildpackage -a -uc -us -rfakeroot
257 # mv ../secnet_${VERSION}_i386.deb ~ianmdlvl/public-html/secnet/download/backport/
259 # 10. On chiark as user secnet:
260 # cd ~secnet/public-html/release/
263 # ln -s /home/ianmdlvl/public-html/secnet/download/secnet?$VERSION* .
264 # mkdir polypath-backport
265 # ln -s /home/ianmdlvl/public-html/secnet/download/backport/secnet?$VERSION* polypath-backport/.
266 # ln -s /home/ianmdlvl/public-html/secnet/download/backport/*adns* polypath-backport/.
268 # 11. write and post a release announcement
269 # find -type l | sort | xargs sha256sum