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-2010 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/>.
36 ifneq ($(MAKECMDGOALS),distclean)
42 CRYPT_OBJ := key_derivation.o \
64 .PHONY: clean cleanall distclean manpage install install-bin install-etc install-man uninstall remove purge
70 $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
71 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
72 rm -f $@.$$$$; echo '(re)building $@'
74 ifneq ($(MAKECMDGOALS),distclean)
75 -include $(SRC:%.c=%.d)
79 $(CC) $(OBJ) -o $@ $(LDFLAGS)
86 $(STRIP) -s $(EXECUTABLE)
89 find . -name *.o -exec rm -f {} \;
90 find . -name "*.\~*" -exec rm -rf {} \;
102 $(MAKE) --directory="../doc/" clean
105 $(MAKE) --directory="../doc/" manpage
108 INSTALL_TARGETS := install-bin install-etc
109 REMOVE_TARGETS := remove-bin remove-etc
112 INSTALL_TARGETS += install-man
113 REMOVE_TARGETS += remove-man
117 INSTALL_TARGETS += install-examples
118 REMOVE_TARGETS += remove-examples
121 install: all $(INSTALL_TARGETS)
123 install-bin: $(EXECUTABLE)
124 $(INSTALL) -d $(DESTDIR)$(SBINDIR)
125 $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
128 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)
129 @ echo "example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/README
130 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d
131 @ sed -e 's#DAEMON=/usr/sbin/uanytun#DAEMON=$(SBINDIR)/$(EXECUTABLE)#' \
132 -e 's#CONFIG_DIR=/etc/uanytun#CONFIG_DIR=$(ETCDIR)/uanytun#' ../etc/init.d/uanytun > ../etc/init.d/uanytun.bak
133 $(INSTALL) -m 755 ../etc/init.d/uanytun.bak $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
134 rm -f ../etc/init.d/uanytun.bak
137 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)
138 $(INSTALL) -m 644 ../etc/uanytun/autostart $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/autostart
139 @( cd '../etc/uanytun/' ; \
140 for dir in `ls`; do \
141 if [ -d $$dir ]; then \
142 echo "install $$dir configuration" ; \
144 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir ; \
145 $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/config ; \
146 if [ -e 'post-up.sh' ]; then \
147 $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/post-up.sh ; \
155 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
156 $(INSTALL) -m 644 ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
160 remove: $(REMOVE_TARGETS)
163 rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
166 rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
169 rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/
172 rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
175 rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/