chiark / gitweb /
Merge udptunnelconf branch; cvs up -j branchpoint-2000-12-10-udptunnelconf -j mergepo...
[userv-utils.git] / ipif / Makefile
index e3dac053712024bae9bba810cfbd50a7289b1ee7..6c4e7c0e59fb9abf378a96624cbd849d700b8be4 100644 (file)
@@ -26,14 +26,21 @@ CFLAGS=             -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith \
 etcdir=                /etc
 prefix=                /usr/local
 bindir=                $(prefix)/bin
+vardir=                /var
 
 libdir=                $(prefix)/lib
+sharedir=      $(prefix)/share
 libuserv=      $(libdir)/userv
+shareuserv=    $(sharedir)/userv
+varlib=                $(vardir)/lib
+varlibuserv=   $(varlib)/userv
+varlibvpn=     $(varlibuserv)/vpn
 
 etcuserv=      $(etcdir)/userv
+etcvpn=                $(etcdir)/userv/vpn
 services=      $(etcuserv)/services.d
 
-PROGRAM_TARGETS=       udptunnel-forwarder
+PROGRAM_TARGETS=       udptunnel-forwarder udptunnel-reconf
 TARGETS=               service blowfishtest $(PROGRAM_TARGETS)
 PROGRAMS=              udptunnel $(PROGRAM_TARGETS)
 
@@ -46,11 +53,28 @@ OBJS_BFTEST=        blowfishtest.o blowfish.o hex.o
 all:           $(TARGETS)
 
 install:       all
-               mkdir -p $(libuserv) $(services)
+               mkdir -p $(libuserv) $(services) $(etcvpn) \
+                       $(varlibvpn) $(shareuserv)
                cp -b service $(libuserv)/ipif
-               cp ipif $(services)/ipif:new
                cp -b $(PROGRAMS) $(bindir)/.
+               cp ipif $(services)/ipif:new
                set -e; cd $(services); test -f ipif || mv ipif:new ipif
+               cp *.example $(etcvpn)/.
+               cp udptunnel-vpn-config.m4 udptunnel-vpn-defaults \
+                       $(shareuserv)/.
+
+udptunnel-reconf:      udptunnel-reconf.pl Makefile
+               perl -pe '      \
+       print "\
+\$$shareuserv= \"$(shareuserv)\";\n\
+\$$etcvpn= \"$(etcvpn)\";\n\
+\$$varlibvpn= \"$(varlibvpn)\";\n" if m#^\# \@\@\@\-#; \
+       $$_="" if m/^\# \@\@\@\-/ .. m/^\# \-\@\@\@/;   \
+               '       \
+                       <$< >$@.new
+               chmod +x $@.new
+               mv -f $@.new $@
+
 
 udptunnel-forwarder:   $(OBJS_FORWARD)
                $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_FORWARD)