Commit | Line | Data |
---|---|---|
f0e54a99 | 1 | # Makefile for ipif/udptunnel stuff |
2 | ||
9028e234 IJ |
3 | # This file is part of ipif, part of userv-util |
4 | # | |
5 | # Copyright 1996-2013 Ian Jackson <ijackson@chiark.greenend.org.uk> | |
6 | # Copyright 1998 David Damerell <damerell@chiark.greenend.org.uk> | |
7 | # Copyright 1999,2003 | |
8 | # Chancellor Masters and Scholars of the University of Cambridge | |
9 | # Copyright 2010 Tony Finch <fanf@dotat.at> | |
1c1a9fa1 | 10 | # |
caa68336 | 11 | # This is free software; you can redistribute it and/or modify it |
12 | # under the terms of the GNU General Public License as published by | |
9028e234 | 13 | # the Free Software Foundation; either version 3 of the License, or |
caa68336 | 14 | # (at your option) any later version. |
15 | # | |
16 | # This program is distributed in the hope that it will be useful, but | |
17 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | # General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
9028e234 | 22 | # along with userv-utils; if not, see http://www.gnu.org/licenses/. |
1c1a9fa1 | 23 | |
6362f12c | 24 | include ../settings.make |
e5e5fd4e | 25 | |
6362f12c | 26 | varlibvpn= $(varlibuserv)/vpn |
5e8cb121 IJ |
27 | etcuserv= $(etcdir)/userv |
28 | etcvpn= $(etcuserv)/vpn | |
6d90651a | 29 | |
97f318e0 IJ |
30 | PROGRAM_TARGETS+= |
31 | PROGRAM_TARGETS$(depr)+= udptunnel-forwarder udptunnel-reconf | |
32 | ||
33 | TARGETS+= service | |
34 | TARGETS$(depr)+= blowfishtest | |
35 | TARGETS+= $(PROGRAM_TARGETS) | |
36 | ||
37 | PROGRAMS$(depr)+= udptunnel | |
38 | PROGRAMS+= $(PROGRAM_TARGETS) | |
39 | ||
5e8cb121 IJ |
40 | DIRS+= $(libuserv) $(etcuserv) $(services) |
41 | DIRS$(depr)+= $(bindir) $(varlibvpn) $(shareuserv) | |
97f318e0 IJ |
42 | |
43 | SHAREFILES$(depr)+= udptunnel-vpn-config.m4 udptunnel-vpn-defaults | |
1fb3cba0 | 44 | |
45 | MECHFILES= null pkcs5 timestamp sequence blowfish | |
46 | MECHOBJS= $(foreach m, $(MECHFILES), mech-$m.o) | |
47 | ||
f9e59051 | 48 | OBJS_FORWARD= forwarder.o $(MECHOBJS) blowfish.o automech.c utils.c |
ed509ebd | 49 | OBJS_BFTEST= blowfishtest.o blowfish.o hex.o |
6d90651a | 50 | |
51 | all: $(TARGETS) | |
52 | ||
5e8cb121 | 53 | install: all |
97f318e0 | 54 | mkdir -p $(DIRS) |
8d9c5866 | 55 | cp -b service $(libuserv)/ipif |
97f318e0 | 56 | set -e; for f in $(PROGRAMS); do cp -b $$f $(bindir)/.; done |
2e082dfe | 57 | cp ipif $(services)/ipif:new |
e5e5fd4e | 58 | set -e; cd $(services); test -f ipif || mv ipif:new ipif |
97f318e0 | 59 | set -e; for f in $(SHAREFILES); do cp $$f $(shareuserv)/.; done |
2e082dfe | 60 | |
6362f12c | 61 | install-docs: |
62 | ||
63 | install-examples: | |
97f318e0 IJ |
64 | set -e; if [ "x$depr" = x ]; then \ |
65 | mkdir -p $(etcvpn); \ | |
66 | cp *.example $(etcvpn)/.; \ | |
67 | fi | |
6362f12c | 68 | |
2e082dfe | 69 | udptunnel-reconf: udptunnel-reconf.pl Makefile |
80ebbf9e IJ |
70 | perl -p \ |
71 | -e ' print " ' \ | |
72 | -e '\$$shareuserv= \"$(shareuserv)\";\n ' \ | |
73 | -e '\$$etcvpn= \"$(etcvpn)\";\n ' \ | |
74 | -e '\$$varlibvpn= \"$(varlibvpn)\";\n" if m#^\# \@\@\@\-#; ' \ | |
75 | -e ' $$_="" if m/^\# \@\@\@\-/ .. m/^\# \-\@\@\@/; ' \ | |
2e082dfe | 76 | <$< >$@.new |
77 | chmod +x $@.new | |
78 | mv -f $@.new $@ | |
79 | ||
1fb3cba0 | 80 | |
81 | udptunnel-forwarder: $(OBJS_FORWARD) | |
82 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_FORWARD) | |
83 | ||
ed509ebd | 84 | blowfishtest: $(OBJS_BFTEST) |
85 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_BFTEST) | |
86 | ||
31dcbf98 | 87 | automech.h: automechgen.sh Makefile |
1fb3cba0 | 88 | ./$< $(MECHFILES) |
89 | ||
31dcbf98 | 90 | automech.c: automech.h |
91 | ||
92 | clean: | |
93 | rm -f *.o core automech.[ch] *~ ./#*# | |
94 | ||
c62ccbd5 | 95 | realclean distclean: clean |
31dcbf98 | 96 | rm -f $(TARGETS) |
97 | ||
f9e59051 | 98 | forwarder.o $(MECHOBJS) automech.o utils.o: forwarder.h automech.h |
ed509ebd | 99 | blowfish.o mech-blowfish.o blowfishtest.o: blowfish.h |
100 | blowfishtest.o hex.o: hex.h |