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 methods 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-2014 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 as published by
24 ## the Free Software Foundation, either version 3 of the License, or
27 ## uAnytun is distributed in the hope that it will be useful,
28 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
29 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ## GNU General Public License for more details.
32 ## You should have received a copy of the GNU General Public License
33 ## along with uAnytun. If not, see <http://www.gnu.org/licenses/>.
35 ## In addition, as a special exception, the copyright holders give
36 ## permission to link the code of portions of this program with the
37 ## OpenSSL library under certain conditions as described in each
38 ## individual source file, and distribute linked combinations
40 ## You must obey the GNU General Public License in all respects
41 ## for all of the code used other than OpenSSL. If you modify
42 ## file(s) with this exception, you may extend this exception to your
43 ## version of the file(s), but you are not obligated to do so. If you
44 ## do not wish to do so, delete this exception statement from your
45 ## version. If you delete this exception statement from all source
46 ## files in the program, then also delete it here.
49 ifneq ($(MAKECMDGOALS),distclean)
55 CRYPT_OBJ := key_derivation.o \
77 .PHONY: clean cleanall distclean manpage install install-bin install-etc install-man uninstall remove purge
83 $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
84 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
85 rm -f $@.$$$$; echo '(re)building $@'
87 ifneq ($(MAKECMDGOALS),distclean)
88 -include $(SRC:%.c=%.d)
92 $(CC) $(OBJ) -o $@ $(LDFLAGS)
99 $(STRIP) -s $(EXECUTABLE)
102 find . -name *.o -exec rm -f {} \;
103 find . -name "*.\~*" -exec rm -rf {} \;
115 $(MAKE) --directory="../doc/" clean
118 $(MAKE) --directory="../doc/" manpage
121 INSTALL_TARGETS := install-bin install-etc
122 REMOVE_TARGETS := remove-bin remove-etc
125 INSTALL_TARGETS += install-man
126 REMOVE_TARGETS += remove-man
130 INSTALL_TARGETS += install-examples
131 REMOVE_TARGETS += remove-examples
134 install: all $(INSTALL_TARGETS)
136 install-bin: $(EXECUTABLE)
137 $(INSTALL) -d $(DESTDIR)$(SBINDIR)
138 $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
141 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)
142 @ echo "example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/README
143 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d
144 @ sed -e 's#DAEMON=/usr/sbin/uanytun#DAEMON=$(SBINDIR)/$(EXECUTABLE)#' \
145 -e 's#CONFIG_DIR=/etc/uanytun#CONFIG_DIR=$(ETCDIR)/uanytun#' ../etc/init.d/uanytun > ../etc/init.d/uanytun.bak
146 $(INSTALL) -m 755 ../etc/init.d/uanytun.bak $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
147 rm -f ../etc/init.d/uanytun.bak
150 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)
151 $(INSTALL) -m 644 ../etc/uanytun/autostart $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/autostart
152 @( cd '../etc/uanytun/' ; \
153 for dir in `ls`; do \
154 if [ -d $$dir ]; then \
155 echo "install $$dir configuration" ; \
157 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir ; \
158 $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/config ; \
159 if [ -e 'post-up.sh' ]; then \
160 $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/post-up.sh ; \
168 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
169 $(INSTALL) -m 644 ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
173 remove: $(REMOVE_TARGETS)
176 rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
179 rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
182 rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/
185 rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
188 rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/