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