4 ## The secure anycast tunneling protocol (satp) defines a protocol used
5 ## for communication between any combination of unicast and anycast
6 ## tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
7 ## mode and allows tunneling of every ETHER TYPE protocol (e.g.
8 ## ethernet, ip, arp ...). satp directly includes cryptography and
9 ## message authentication based on the methodes used by SRTP. It is
10 ## intended to deliver a generic, scaleable and secure solution for
11 ## tunneling and relaying of packets of any protocol.
14 ## Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl,
15 ## Christian Pointner <satp@wirdorange.org>
17 ## This file is part of Anytun.
19 ## Anytun is free software: you can redistribute it and/or modify
20 ## it under the terms of the GNU General Public License as published by
21 ## the Free Software Foundation, either version 3 of the License, or
24 ## Anytun is distributed in the hope that it will be useful,
25 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ## GNU General Public License for more details.
29 ## You should have received a copy of the GNU General Public License
30 ## along with anytun. If not, see <http://www.gnu.org/licenses/>.
33 ifneq ($(MAKECMDGOALS),distclean)
48 keyDerivationFactory.o \
64 SYNCOBJS := syncServer.o \
69 syncConnectionCommand.o \
72 ANYCTROBJS := signalController.o \
82 ANYCONFOBJS := log.o \
87 keyDerivationFactory.o \
100 syncTcpConnection.o \
102 syncConnectionCommand.o \
105 EXECUTABLES := anytun anytun-config anytun-controld anytun-showtables anytun-nosync
106 EXEOBJS := anytun.o anytun-config.o anytun-controld.o anytun-showtables.o
108 SRCS := $(OBJS:%.o=%.cpp)
109 SYNCSRCS := $(SYNCOBJS:%.o=%.cpp)
110 ANYCTRSRCS := $(ANYCTROBJS:%.o=%.cpp)
111 ANYCONFSRCS := $(ANYCONFOBJS:%.o=%.cpp)
112 EXESRCS := $(EXEOBJS:%.o=%.cpp)
114 .PHONY: distclean cleanall clean manpage install install-bin install-etc install-man uninstall remove purge
116 all: $(EXECUTABLES) #libAnysync.a
120 $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
121 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
122 rm -f $@.$$$$; echo '(re)building $@'
124 ifneq ($(MAKECMDGOALS),distclean)
125 -include $(SRCS:%.cpp=%.d) $(SYNCSRCS:%.cpp=%.d) $(ANYCTRSRCS:%.cpp=%.d) $(ANYCONFSRCS:%.cpp=%.d) $(EXESRCS:%.cpp=%.d)
128 strip: $(EXECUTABLES)
129 $(STRIP) -s $(EXECUTABLES)
131 anytun: $(OBJS) $(SYNCOBJS) anytun.o
132 $(LD) $(OBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS)
134 anytun-static: $(OBJS) $(SYNCOBJS) anytun-noprivdrop.o
135 $(LD) $(OBJS) $(SYNCOBJS) anytun-noprivdrop.o -o $@ -Bstatic -lstdc++ -static $(LDFLAGS) -lpthread
136 $(STRIP) -s anytun-static
138 anytun-nosync: $(OBJS) anytun-nosync.o
139 $(LD) $(OBJS) anytun-nosync.o -o $@ $(LDFLAGS)
141 anytun-nosync.o: anytun.cpp
142 $(CXX) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o
144 anytun-noprivdrop.o: anytun.cpp
145 $(CXX) $(CXXFLAGS) -DNO_PRIVDROP $< -c -o anytun-noprivdrop.o
147 anytun-showtables: $(OBJS) $(SYNCOBJS) anytun-showtables.o
148 $(LD) $(OBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS)
150 anytun-config: $(ANYCONFOBJS) anytun-config.o
151 $(LD) $(ANYCONFOBJS) anytun-config.o -o $@ $(LDFLAGS)
153 anytun-controld: $(ANYCTROBJS) anytun-controld.o
154 $(LD) $(ANYCTROBJS) anytun-controld.o -o $@ $(LDFLAGS)
157 options.o: options.cpp
158 $(CXX) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@
160 anyCtrOptions.o: options.cpp
161 $(CXX) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@
163 anyConfOptions.o: options.cpp
164 $(CXX) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@
167 $(CXX) $(CXXFLAGS) $< -c
170 libAnysync.a: $(OBJS)
175 $(MAKE) --directory=$(CURDIR)/anyrtpproxy
179 find . -name *.o -exec rm -f {} \;
180 rm -f config.sub config.guess
185 $(MAKE) --directory=$(CURDIR)/man clean
196 $(MAKE) --directory=$(CURDIR)/anyrtpproxy clean
202 INSTALL_TARGETS := install-bin install-etc
203 REMOVE_TARGETS := remove-bin remove-etc
206 INSTALL_TARGETS += install-man
207 REMOVE_TARGETS += remove-man
211 INSTALL_TARGETS += install-examples
212 REMOVE_TARGETS += remove-examples
215 install: all $(INSTALL_TARGETS)
217 install-bin: $(EXECUTABLES)
218 $(INSTALL) -d $(DESTDIR)$(SBINDIR)
219 $(INSTALL) -m 755 anytun $(DESTDIR)$(SBINDIR)
220 $(INSTALL) -d $(DESTDIR)$(BINDIR)
221 $(INSTALL) -m 755 anytun-config $(DESTDIR)$(BINDIR)
222 $(INSTALL) -m 755 anytun-controld $(DESTDIR)$(BINDIR)
223 $(INSTALL) -m 755 anytun-showtables $(DESTDIR)$(BINDIR)
226 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/anytun
227 @ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README
228 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d
229 @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \
230 -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \
231 -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \
232 -e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../etc/init.d/anytun > ../etc/init.d/anytun.bak
233 $(INSTALL) -m 755 ../etc/init.d/anytun.bak $(DESTDIR)$(ETCDIR)/init.d/anytun
234 rm -f ../etc/init.d/anytun.bak
237 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun
238 $(INSTALL) -m 644 ../etc/anytun/autostart $(DESTDIR)$(EXAMPLESDIR)/anytun/autostart
239 @( cd '../etc/anytun/' ; \
240 for dir in `ls`; do \
241 if [ -d $$dir ]; then \
242 echo "install $$dir configuration" ; \
244 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir ; \
245 $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/config ; \
246 if [ -e 'post-up.sh' ]; then \
247 $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/post-up.sh ; \
249 if [ -d 'conf.d' ]; then \
250 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \
252 for file in `ls`; do \
253 if [ -f $$file ]; then \
254 $(INSTALL) -m 644 $$file $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \
265 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
266 $(INSTALL) -m 644 man/anytun.8 $(DESTDIR)$(MANDIR)/man8/
267 $(INSTALL) -m 644 man/anytun-config.8 $(DESTDIR)$(MANDIR)/man8/
268 $(INSTALL) -m 644 man/anytun-controld.8 $(DESTDIR)$(MANDIR)/man8/
269 $(INSTALL) -m 644 man/anytun-showtables.8 $(DESTDIR)$(MANDIR)/man8/
274 remove: $(REMOVE_TARGETS)
277 rm -f $(DESTDIR)$(SBINDIR)/anytun
278 rm -f $(DESTDIR)$(BINDIR)/anytun-config
279 rm -f $(DESTDIR)$(BINDIR)/anytun-controld
280 rm -f $(DESTDIR)$(BINDIR)/anytun-showtables
283 rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun
286 rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/
289 rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8
290 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8
291 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8
292 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8
295 rm -rf $(DESTDIR)$(ETCDIR)/anytun/