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 | |
37b5bdcf | 21 | VERSION:=0.2.1 |
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 \ | |
56 | resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \ | |
7138d0c5 | 57 | serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \ |
3b83c932 SE |
58 | process.o @LIBOBJS@ \ |
59 | hackypar.o | |
9d3a4132 | 60 | |
2fe58dfd SE |
61 | %.c: %.y |
62 | ||
63 | %.yy.c: %.fl | |
27f5042b | 64 | flex --header=$*.yy.h -o$@ $< |
2fe58dfd | 65 | |
76eca292 | 66 | %.tab.c %.tab.h: %.y |
8689b3a9 | 67 | bison -d -o $@ $< |
2fe58dfd | 68 | |
fe5e9cc4 SE |
69 | %.o: %.c |
70 | $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@ | |
2fe58dfd SE |
71 | |
72 | all: $(TARGETS) | |
73 | ||
8689b3a9 SE |
74 | # Automatic remaking of configuration files, from autoconf documentation |
75 | ${srcdir}/configure: configure.in | |
76 | cd ${srcdir} && autoconf | |
77 | ||
78 | # autoheader might not change config.h.in, so touch a stamp file. | |
79 | ${srcdir}/config.h.in: stamp-h.in | |
f74f5f43 | 80 | ${srcdir}/stamp-h.in: configure.in |
8689b3a9 SE |
81 | cd ${srcdir} && autoheader |
82 | echo timestamp > ${srcdir}/stamp-h.in | |
83 | ||
84 | config.h: stamp-h | |
85 | stamp-h: config.h.in config.status | |
86 | ./config.status | |
87 | ||
974d0468 | 88 | Makefile: Makefile.in config.status |
8689b3a9 | 89 | ./config.status |
974d0468 SE |
90 | |
91 | config.status: configure | |
8689b3a9 SE |
92 | ./config.status --recheck |
93 | # End of config file remaking rules | |
59635212 | 94 | |
d3fe100d SE |
95 | # C and header file dependency rules |
96 | SOURCES:=$(OBJECTS:.o=.c) | |
97 | DEPENDS:=$(OBJECTS:.o=.d) | |
98 | ||
99 | $(DEPENDS): ${srcdir}/depend.sh | |
100 | ||
101 | %.d: %.c | |
ea7ec970 | 102 | ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@ |
d3fe100d SE |
103 | |
104 | -include $(DEPENDS) | |
105 | ||
106 | # Manual dependencies section | |
8689b3a9 | 107 | conffile.yy.c: conffile.fl conffile.tab.c |
27f5042b | 108 | conffile.yy.h: conffile.yy.c |
8689b3a9 SE |
109 | conffile.tab.c: conffile.y |
110 | # End of manual dependencies section | |
974d0468 | 111 | |
2fe58dfd | 112 | secnet: $(OBJECTS) |
fe5e9cc4 | 113 | $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS) |
2fe58dfd | 114 | |
974d0468 | 115 | version.c: Makefile |
fcbc5905 IJ |
116 | echo "#include \"secnet.h\"" >$@.new |
117 | echo "char version[]=\"secnet $(VERSION)\";" >>$@.new | |
118 | mv -f $@.new $@ | |
974d0468 | 119 | |
60fe3102 | 120 | installdirs: |
d3fe100d | 121 | $(INSTALL) -d $(prefix)/share/secnet $(sbindir) |
3ca86f6d | 122 | $(INSTALL) -d $(mandir)/man8 |
60fe3102 RK |
123 | |
124 | install: installdirs | |
d3fe100d SE |
125 | $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'` |
126 | $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'` | |
127 | $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py | |
3ca86f6d | 128 | $(INSTALL) secnet.8 $(mandir)/man8/secnet.8 |
974d0468 | 129 | |
2fe58dfd | 130 | clean: |
8689b3a9 | 131 | $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c |
2b6ab62e | 132 | $(RM) -f *.d *~ |
2fe58dfd SE |
133 | |
134 | realclean: clean | |
d3fe100d | 135 | $(RM) -f *~ Makefile config.h *.d \ |
8689b3a9 SE |
136 | config.log config.status config.cache \ |
137 | stamp-h Makefile.bak | |
2fe58dfd | 138 | |
469fd1d9 SE |
139 | distclean: realclean |
140 | ||
974d0468 | 141 | pfname:=$(PACKAGE)-$(VERSION) |
2562e34b | 142 | tarfname:=../$(pfname).tar |
974d0468 | 143 | dist: |
2562e34b IJ |
144 | $(RM) -rf $(tarfname) $(tarfname).gz |
145 | git archive --format=tar --prefix=$(pfname)/ HEAD -o $(tarfname) | |
146 | gzip -9f $(tarfname) | |
147 | ||
148 | # Release checklist: | |
149 | # 1. Check that the tree has what you want | |
150 | # | |
66ee7152 IJ |
151 | # 2. Update VERSION (above) and debian/changelog |
152 | # but DO NOT COMMIT | |
2562e34b IJ |
153 | # |
154 | # 3. Run | |
155 | # ./configure | |
156 | # make dist | |
157 | # and check that the resulting tarball looks OK. | |
158 | # Eg, untar it and build it, or have it reviewed. | |
159 | # | |
66ee7152 | 160 | # 3. Commit the updates to VERSION (above) and debian/changelog |
2562e34b IJ |
161 | # |
162 | # 4. git-tag -s v$(VERSION) | |
163 | # | |
164 | # 5. git-push origin | |
165 | # | |
fd44936f IJ |
166 | # 6. Run, again, |
167 | # make dist | |
168 | # | |
169 | # 7. gpg --detach-sign ../secnet-$(VERSION).tar.gz | |
b57cc2eb | 170 | # |
fd44936f | 171 | # 8. rsync -v ../secnet-$VERSION.tar.gz* \ |
2562e34b IJ |
172 | # chiark:/home/ianmdlvl/public-html/secnet/download/ |
173 | # | |
fd44936f | 174 | # 9. On chiark: |
66ee7152 IJ |
175 | # tar zxf ~ianmdlvl/public-html/secnet/download/secnet-$(VERSION).tar.gz |
176 | # cd secnet-$(VERSION) | |
177 | # debian/rules build | |
178 | # fakeroot debian/rules binary | |
fd44936f | 179 | # mv ../secnet_0.1.18.1-1_i386.deb ~/public-html/secnet/download/ |
66ee7152 | 180 | # |
fd44936f | 181 | # 10. On chiark as user secnet: |
66ee7152 IJ |
182 | # cd ~secnet/ |
183 | # rsync ~ianmdlvl/public-html/secnet/download/secnet* . | |
184 | # | |
fd44936f | 185 | # 11. write and post a release announcement |