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 CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@
35 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS)
40 exec_prefix:=@exec_prefix@
42 sysconfdir:=@sysconfdir@
43 transform:=@program_transform_name@
47 OBJECTS:=secnet.o util.o conffile.yy.o conffile.tab.o conffile.o modules.o \
48 resolver.o random.o udp.o site.o transform.o netlink.o rsa.o dh.o \
49 serpent.o md5.o version.o tun.o slip.o sha1.o ipaddr.o log.o \
52 DISTFILES:=BUGS COPYING CREDITS INSTALL LICENSE.txt Makefile.in \
53 NEWS NOTES README TODO \
55 conffile.c conffile.fl conffile.h conffile.y \
56 conffile_internal.h config.h.bot \
57 config.h.in config.h.top configure \
58 configure.in debian depend.sh dh.c \
60 getopt.c getopt1.c getopt.h \
61 install-sh ipaddr.c ipaddr.h ipaddr.py linux log.c \
64 modules.c netlink.c netlink.h process.c process.h \
65 random.c resolver.c rsa.c \
66 secnet.c secnet.h serpent.c serpent.h serpentsboxes.h \
67 snprintf.c snprintf.h \
68 sha1.c site.c slip.c stamp-h.in transform.c tun.c udp.c \
69 unaligned.h util.c util.h
80 $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
84 # Automatic remaking of configuration files, from autoconf documentation
85 ${srcdir}/configure: configure.in
86 cd ${srcdir} && autoconf
88 # autoheader might not change config.h.in, so touch a stamp file.
89 ${srcdir}/config.h.in: stamp-h.in
90 ${srcdir}/stamp-h.in: configure.in config.h.top config.h.bot
91 cd ${srcdir} && autoheader
92 echo timestamp > ${srcdir}/stamp-h.in
95 stamp-h: config.h.in config.status
98 Makefile: Makefile.in config.status
101 config.status: configure
102 ./config.status --recheck
103 # End of config file remaking rules
105 # C and header file dependency rules
106 SOURCES:=$(OBJECTS:.o=.c)
107 DEPENDS:=$(OBJECTS:.o=.d)
109 $(DEPENDS): ${srcdir}/depend.sh
112 ${srcdir}/depend.sh $(srcdir) $(ALL_CFLAGS) $< > $@
116 # Manual dependencies section
117 conffile.yy.c: conffile.fl conffile.tab.c
118 conffile.tab.c: conffile.y
119 # End of manual dependencies section
122 $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
125 echo "char version[]=\"secnet $(VERSION)\";" >version.c
128 $(INSTALL) -d $(prefix)/share/secnet $(sbindir)
129 $(INSTALL_PROGRAM) secnet $(sbindir)/`echo secnet|sed '$(transform)'`
130 $(INSTALL_PROGRAM) ${srcdir}/make-secnet-sites $(sbindir)/`echo make-secnet-sites|sed '$(transform)'`
131 $(INSTALL) ${srcdir}/ipaddr.py $(prefix)/share/secnet/ipaddr.py
134 $(RM) -f *.o *.yy.c *.tab.[ch] $(TARGETS) core version.c
137 $(RM) -f *~ Makefile config.h *.d \
138 config.log config.status config.cache \
143 pfname:=$(PACKAGE)-$(VERSION)
147 for i in $(DISTFILES) ; do ln -s ../$(srcdir)/$$i $(pfname)/ ; done
148 tar hcf ../$(pfname).tar --exclude=CVS --exclude=.cvsignore $(pfname)
149 gzip -9f ../$(pfname).tar