4 ## uAnytun is a tiny implementation of SATP. Unlike Anytun which is a full
5 ## featured implementation uAnytun has no support for multiple connections
6 ## or synchronisation. It is a small single threaded implementation intended
7 ## to act as a client on small platforms.
8 ## The secure anycast tunneling protocol (satp) defines a protocol used
9 ## for communication between any combination of unicast and anycast
10 ## tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
11 ## mode and allows tunneling of every ETHER TYPE protocol (e.g.
12 ## ethernet, ip, arp ...). satp directly includes cryptography and
13 ## message authentication based on the methodes used by SRTP. It is
14 ## intended to deliver a generic, scaleable and secure solution for
15 ## tunneling and relaying of packets of any protocol.
18 ## Copyright (C) 2007-2008 Christian Pointner <equinox@anytun.org>
20 ## This file is part of uAnytun.
22 ## uAnytun is free software: you can redistribute it and/or modify
23 ## it under the terms of the GNU General Public License version 3 as
24 ## published by the Free Software Foundation.
26 ## uAnytun is distributed in the hope that it will be useful,
27 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
28 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ## GNU General Public License for more details.
31 ## You should have received a copy of the GNU General Public License
32 ## along with uAnytun. If not, see <http://www.gnu.org/licenses/>.
35 ifneq ($(MAKECMDGOALS),distclean)
41 CRYPT_OBJ := key_derivation.o \
62 .PHONY: clean distclean manpage install install-bin install-etc install-man remove purge
68 $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
69 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
70 rm -f $@.$$$$; echo '(re)building $@'
72 ifneq ($(MAKECMDGOALS),distclean)
73 -include $(SRC:%.c=%.d)
77 $(CC) $(OBJ) -o $@ $(LDFLAGS)
84 find . -name *.o -exec rm -f {} \;
85 find . -name "*.\~*" -exec rm -rf {} \;
96 $(MAKE) --directory="../doc/" manpage
98 install: all install-bin install-etc install-man add-user
100 install-bin: $(EXECUTABLE)
101 mkdir -p $(DESTDIR)$(SBINDIR)
102 install -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
103 $(STRIP) $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
106 mkdir -p $(DESTDIR)$(ETCDIR)/uanytun
107 install -m 644 ../etc/uanytun/autostart $(DESTDIR)$(ETCDIR)/uanytun/autostart
108 @( cd '../etc/uanytun/' ; \
109 for dir in `ls`; do \
110 if [ -d $$dir ]; then \
111 echo "install $$dir configuration" ; \
113 mkdir -p $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \
114 install -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
115 sed -i 's#username uanytun#username $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
116 sed -i 's#groupname uanytun#groupname $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
117 sed -i 's#chroot /var/run/uanytun#chroot $(USERHOME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
118 if [ -e 'post-up.sh' ]; then \
119 install -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/uanytun/$$dir/post-up.sh ; \
125 mkdir -p $(DESTDIR)$(ETCDIR)/init.d
126 install -m 755 ../etc/init.d/uanytun $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
127 @ sed -i 's#DAEMON=/usr/sbin/uanytun#DAEMON=$(SBINDIR)/$(EXECUTABLE)#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
128 @ sed -i 's#CONFIG_DIR=/etc/uanytun#CONFIG_DIR=$(ETCDIR)/uanytun#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
131 mkdir -p $(DESTDIR)$(MANDIR)/man8/
132 cp ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
133 gzip $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
136 @ adduser --system --group --home $(USERHOME) $(USERNAME)
139 @ deluser $(USERNAME)
143 rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
144 rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8.gz
145 rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
147 purge: remove remove-user
148 rm -rf $(DESTDIR)$(ETCDIR)/uanytun/