chiark / gitweb /
879c0136ab96f624ef528aae57c1c13a4724d13b
[userv-utils.git] / ipif / Makefile
1 # Makefile for ipif/udptunnel stuff
2
3 # Copyright (C) 1999-2000 Ian Jackson
4 #
5 # This is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with userv-utils; if not, write to the Free Software
17 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #
19 # $Id$
20
21 include ../settings.make
22
23 varlibvpn=      $(varlibuserv)/vpn
24 etcvpn=         $(etcdir)/userv/vpn
25
26 PROGRAM_TARGETS=        udptunnel-forwarder udptunnel-reconf
27 TARGETS=                service blowfishtest $(PROGRAM_TARGETS)
28 PROGRAMS=               udptunnel $(PROGRAM_TARGETS)
29
30 MECHFILES=      null pkcs5 timestamp sequence blowfish
31 MECHOBJS=       $(foreach m, $(MECHFILES), mech-$m.o)
32
33 OBJS_FORWARD=   forwarder.o $(MECHOBJS) blowfish.o automech.c utils.c
34 OBJS_BFTEST=    blowfishtest.o blowfish.o hex.o
35
36 all:            $(TARGETS)
37
38 install:        all
39                 mkdir -p $(bindir) $(libuserv) $(services) \
40                         $(varlibvpn) $(shareuserv)
41                 cp -b service $(libuserv)/ipif
42                 cp -b $(PROGRAMS) $(bindir)/.
43                 cp ipif $(services)/ipif:new
44                 set -e; cd $(services); test -f ipif || mv ipif:new ipif
45                 cp udptunnel-vpn-config.m4 udptunnel-vpn-defaults \
46                         $(shareuserv)/.
47
48 install-docs:
49
50 install-examples:
51                 mkdir -p $(etcvpn)
52                 cp *.example $(etcvpn)/.
53
54 udptunnel-reconf:       udptunnel-reconf.pl Makefile
55                 perl -pe '      \
56         print "\
57 \$$shareuserv= \"$(shareuserv)\";\n\
58 \$$etcvpn= \"$(etcvpn)\";\n\
59 \$$varlibvpn= \"$(varlibvpn)\";\n" if m#^\# \@\@\@\-#;  \
60         $$_="" if m/^\# \@\@\@\-/ .. m/^\# \-\@\@\@/;   \
61                 '       \
62                         <$< >$@.new
63                 chmod +x $@.new
64                 mv -f $@.new $@
65
66
67 udptunnel-forwarder:    $(OBJS_FORWARD)
68                 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_FORWARD)
69
70 blowfishtest:           $(OBJS_BFTEST)
71                 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_BFTEST)
72
73 automech.h:             automechgen.sh Makefile
74                 ./$< $(MECHFILES)
75
76 automech.c:             automech.h
77
78 clean:
79                 rm -f *.o core automech.[ch] *~ ./#*#
80
81 realclean distclean:    clean
82                 rm -f $(TARGETS)
83
84 forwarder.o $(MECHOBJS) automech.o utils.o:     forwarder.h automech.h
85 blowfish.o mech-blowfish.o blowfishtest.o:      blowfish.h
86 blowfishtest.o hex.o:                           hex.h