2 # Copyright (C) 1995-2001 Stephen Early <steve@greenend.org.uk>
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)
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.
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.
18 .PHONY: all clean realclean distclean dist install
32 INSTALL_PROGRAM:=@INSTALL_PROGRAM@
34 # Use -DHACKY_PARALLEL if you are compiling secnet for an extremely
36 #CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -DHACKY_PARALLEL
37 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
39 -Wno-pointer-sign -Wstrict-prototypes -Wmissing-prototypes \
40 -Wmissing-declarations -Wnested-externs -Wredundant-decls \
41 -Wpointer-arith -Wformat=2 -Winit-self \
42 -Wswitch-enum -Wunused-variable -Wbad-function-cast \
43 -Wno-strict-aliasing -fno-strict-aliasing
44 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
50 exec_prefix:=@exec_prefix@
52 sysconfdir:=@sysconfdir@
53 transform:=@program_transform_name@
57 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
58 resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \
59 serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
64 DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
65 NEWS NOTES README TODO \
66 ac_prog_cc_no_writeable_strings.m4 \
67 conffile.c conffile.fl conffile.h conffile.y \
69 config.h.in configure \
70 configure.in depend.sh dh.c \
72 getopt.c getopt1.c getopt.h \
73 install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
76 modules.c netlink.c netlink.h process.c process.h \
77 random.c resolver.c rsa.c \
78 secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
79 snprintf.c snprintf.h \
80 sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
81 unaligned.h util.c util.h \
83 DISTSUBDIRS:=debian/copyright debian/changelog debian/control \
84 debian/init debian/rules debian/compat debian/default
89 flex --header=$*.yy.h -o$@ $<
95 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
99 # Automatic remaking of configuration files, from autoconf documentation
100 ${srcdir}/configure: configure.in
101 cd ${srcdir} && autoconf
103 # autoheader might not change config.h.in, so touch a stamp file.
104 ${srcdir}/config.h.in: stamp-h.in
105 ${srcdir}/stamp-h.in: configure.in
106 cd ${srcdir} && autoheader
107 echo timestamp > ${srcdir}/stamp-h.in
110 stamp-h: config.h.in config.status
113 Makefile: Makefile.in config.status
116 config.status: configure
117 ./config.status --recheck
118 # End of config file remaking rules
120 # C and header file dependency rules
121 SOURCES:=$(OBJECTS:.o=.c)
122 DEPENDS:=$(OBJECTS:.o=.d)
124 $(DEPENDS): ${srcdir}/depend.sh
127 ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
131 # Manual dependencies section
132 conffile.yy.c: conffile.fl conffile.tab.c
133 conffile.yy.h: conffile.yy.c
134 conffile.tab.c: conffile.y
135 # End of manual dependencies section
138 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
141 echo "#include \"secnet.h\"" >$@.new
142 echo "char version[]=\"secnet $(VERSION)\";" >>$@.new
146 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
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
152 $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
156 $(RM) -f *~ Makefile config.h *.d \
157 config.log config.status config.cache \
162 pfname:=$(PACKAGE)-$(VERSION)
166 for i in $(DISTDIRS) ; do mkdir $(pfname)/$$i ; done
167 for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
168 for i in $(DISTSUBDIRS) ; do ln -s ../../$(srcdir)/$$i $(pfname)/$$i ; done
169 tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
170 gzip -9f ../$(pfname).tar