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