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