md5: correct size arg to memset().
[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
ca58ee48 21VERSION:=0.1.18
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 \
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
fe5e9cc4 41ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
ea7ec970 42CPPFLAGS:=@CPPFLAGS@
2fe58dfd 43LDFLAGS:=@LDFLAGS@
2fe58dfd
SE
44LDLIBS:=@LIBS@
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 \
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
3b83c932 61DISTDIRS:=debian
794f2398 62DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
8dea8d37 63 NEWS NOTES README TODO \
19a171f1 64 setup.mac uk.org.greenend.secnet.plist README.mac \
3b83c932 65 ac_prog_cc_no_writeable_strings.m4 \
9d3a4132 66 conffile.c conffile.fl conffile.h conffile.y \
f74f5f43
SE
67 conffile_internal.h \
68 config.h.in configure \
3b83c932 69 configure.in depend.sh dh.c \
8dea8d37 70 example.conf \
ff05a229
SE
71 install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
72 magic.h md5.c md5.h \
8dea8d37 73 make-secnet-sites \
7138d0c5 74 modules.c netlink.c netlink.h process.c process.h \
9d3a4132 75 random.c resolver.c rsa.c \
974d0468 76 secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
3454dce4 77 sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
3b83c932
SE
78 unaligned.h util.c util.h \
79 hackypar.c hackypar.h
ca58ee48
SE
80DISTSUBDIRS:=debian/copyright debian/changelog debian/control \
81 debian/init debian/rules debian/compat debian/default
2fe58dfd
SE
82
83%.c: %.y
84
85%.yy.c: %.fl
27f5042b 86 flex --header=$*.yy.h -o$@ $<
2fe58dfd 87
76eca292 88%.tab.c %.tab.h: %.y
8689b3a9 89 bison -d -o $@ $<
2fe58dfd 90
fe5e9cc4
SE
91%.o: %.c
92 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
2fe58dfd
SE
93
94all: $(TARGETS)
95
8689b3a9
SE
96# Automatic remaking of configuration files, from autoconf documentation
97${srcdir}/configure: configure.in
98 cd ${srcdir} && autoconf
99
100# autoheader might not change config.h.in, so touch a stamp file.
101${srcdir}/config.h.in: stamp-h.in
f74f5f43 102${srcdir}/stamp-h.in: configure.in
8689b3a9
SE
103 cd ${srcdir} && autoheader
104 echo timestamp > ${srcdir}/stamp-h.in
105
106config.h: stamp-h
107stamp-h: config.h.in config.status
108 ./config.status
109
974d0468 110Makefile: Makefile.in config.status
8689b3a9 111 ./config.status
974d0468
SE
112
113config.status: configure
8689b3a9
SE
114 ./config.status --recheck
115# End of config file remaking rules
59635212 116
d3fe100d
SE
117# C and header file dependency rules
118SOURCES:=$(OBJECTS:.o=.c)
119DEPENDS:=$(OBJECTS:.o=.d)
120
121$(DEPENDS): ${srcdir}/depend.sh
122
123%.d: %.c
ea7ec970 124 ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
d3fe100d
SE
125
126-include $(DEPENDS)
127
128# Manual dependencies section
8689b3a9 129conffile.yy.c: conffile.fl conffile.tab.c
27f5042b 130conffile.yy.h: conffile.yy.c
8689b3a9
SE
131conffile.tab.c: conffile.y
132# End of manual dependencies section
974d0468 133
2fe58dfd 134secnet: $(OBJECTS)
fe5e9cc4 135 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
2fe58dfd 136
974d0468 137version.c: Makefile
fcbc5905
IJ
138 echo "#include \"secnet.h\"" >$@.new
139 echo "char version[]=\"secnet $(VERSION)\";" >>$@.new
140 mv -f $@.new $@
974d0468 141
60fe3102 142installdirs:
d3fe100d 143 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
3ca86f6d 144 $(INSTALL) -d $(mandir)/man8
60fe3102
RK
145
146install: installdirs
d3fe100d
SE
147 $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
148 $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
149 $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
3ca86f6d 150 $(INSTALL) secnet.8 $(mandir)/man8/secnet.8
974d0468 151
2fe58dfd 152clean:
8689b3a9 153 $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
2b6ab62e 154 $(RM) -f *.d *~
2fe58dfd
SE
155
156realclean: clean
d3fe100d 157 $(RM) -f *~ Makefile config.h *.d \
8689b3a9
SE
158 config.log config.status config.cache \
159 stamp-h Makefile.bak
2fe58dfd 160
469fd1d9
SE
161distclean: realclean
162
974d0468
SE
163pfname:=$(PACKAGE)-$(VERSION)
164dist:
165 $(RM) -rf $(pfname)
166 mkdir $(pfname)
3b83c932 167 for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done
8689b3a9 168 for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
3b83c932 169 for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done
fe5e9cc4 170 tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
974d0468
SE
171 gzip -9f ../$(pfname).tar
172 $(RM) -rf $(pfname)