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)
38 ANYTUNOBJS := tunDevice.o \
54 keyDerivationFactory.o \
66 ANYSHOWOBJS := buffer.o \
69 keyDerivationFactory.o \
83 SYNCOBJS := syncServer.o \
88 syncConnectionCommand.o \
91 ANYCTROBJS := signalController.o \
102 ANYCONFOBJS := log.o \
107 keyDerivationFactory.o \
120 syncTcpConnection.o \
122 syncConnectionCommand.o \
125 EXECUTABLES := anytun anytun-config anytun-controld anytun-showtables anytun-nosync
126 EXEOBJS := anytun.o anytun-config.o anytun-controld.o anytun-showtables.o
128 ANYTUNSRCS := $(ANYTUNOBJS:%.o=%.cpp)
129 ANYSHOWSRCS := $(ANYSHOWOBJS:%.o=%.cpp)
130 SYNCSRCS := $(SYNCOBJS:%.o=%.cpp)
131 ANYCTRSRCS := $(ANYCTROBJS:%.o=%.cpp)
132 ANYCONFSRCS := $(ANYCONFOBJS:%.o=%.cpp)
133 EXESRCS := $(EXEOBJS:%.o=%.cpp)
135 .PHONY: distclean cleanall clean manpage install install-bin install-etc install-man uninstall remove purge
137 all: $(EXECUTABLES) #libAnysync.a
141 $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
142 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
143 rm -f $@.$$$$; echo '(re)building $@'
145 ifneq ($(MAKECMDGOALS),distclean)
146 -include $(ANYTUNSRCS:%.cpp=%.d) $(ANYSHOWSRCS:%.cpp=%.d) $(SYNCSRCS:%.cpp=%.d) $(ANYCTRSRCS:%.cpp=%.d) $(ANYCONFSRCS:%.cpp=%.d) $(EXESRCS:%.cpp=%.d)
149 strip: $(EXECUTABLES)
150 $(STRIP) -s $(EXECUTABLES)
152 anytun: $(ANYTUNOBJS) $(SYNCOBJS) anytun.o
153 $(LD) $(ANYTUNOBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS)
155 anytun-static: $(ANYTUNOBJS) $(SYNCOBJS) anytun-noprivdrop.o
156 $(LD) $(ANYTUNOBJS) $(SYNCOBJS) anytun-noprivdrop.o -o $@ -Bstatic -lstdc++ -static $(LDFLAGS) -lpthread
157 $(STRIP) -s anytun-static
159 anytun-nosync: $(ANYTUNOBJS) anytun-nosync.o
160 $(LD) $(ANYTUNOBJS) anytun-nosync.o -o $@ $(LDFLAGS)
162 anytun-nosync.o: anytun.cpp
163 $(CXX) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o
165 anytun-showtables: $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o
166 $(LD) $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS)
168 anytun-config: $(ANYCONFOBJS) anytun-config.o
169 $(LD) $(ANYCONFOBJS) anytun-config.o -o $@ $(LDFLAGS)
171 anytun-controld: $(ANYCTROBJS) anytun-controld.o
172 $(LD) $(ANYCTROBJS) anytun-controld.o -o $@ $(LDFLAGS)
175 options.o: options.cpp
176 $(CXX) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@
178 anyCtrOptions.o: options.cpp
179 $(CXX) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@
181 anyConfOptions.o: options.cpp
182 $(CXX) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@
184 nullOptions.o: options.cpp
185 $(CXX) $(CXXFLAGS) $< -c -o $@
188 $(CXX) $(CXXFLAGS) $< -c
191 libAnysync.a: $(OBJS)
196 $(MAKE) --directory=$(CURDIR)/anyrtpproxy
200 find . -name *.o -exec rm -f {} \;
201 rm -f config.sub config.guess
202 rm -f daemonService.h
203 rm -f daemonService.cpp
204 rm -f signalHandler.hpp
211 $(MAKE) --directory="../doc" clean
222 $(MAKE) --directory=$(CURDIR)/anyrtpproxy clean
225 $(MAKE) --directory="../doc" manpage
228 INSTALL_TARGETS := install-bin install-etc
229 REMOVE_TARGETS := remove-bin remove-etc
232 INSTALL_TARGETS += install-man
233 REMOVE_TARGETS += remove-man
237 INSTALL_TARGETS += install-examples
238 REMOVE_TARGETS += remove-examples
241 install: all $(INSTALL_TARGETS)
243 install-bin: $(EXECUTABLES)
244 $(INSTALL) -d $(DESTDIR)$(SBINDIR)
245 $(INSTALL) -m 755 anytun $(DESTDIR)$(SBINDIR)
246 $(INSTALL) -d $(DESTDIR)$(BINDIR)
247 $(INSTALL) -m 755 anytun-config $(DESTDIR)$(BINDIR)
248 $(INSTALL) -m 755 anytun-controld $(DESTDIR)$(BINDIR)
249 $(INSTALL) -m 755 anytun-showtables $(DESTDIR)$(BINDIR)
252 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/anytun
253 @ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README
254 $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d
255 @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \
256 -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \
257 -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \
258 -e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../etc/init.d/anytun > ../etc/init.d/anytun.bak
259 $(INSTALL) -m 755 ../etc/init.d/anytun.bak $(DESTDIR)$(ETCDIR)/init.d/anytun
260 rm -f ../etc/init.d/anytun.bak
263 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun
264 $(INSTALL) -m 644 ../etc/anytun/autostart $(DESTDIR)$(EXAMPLESDIR)/anytun/autostart
265 @( cd '../etc/anytun/' ; \
266 for dir in `ls`; do \
267 if [ -d $$dir ]; then \
268 echo "install $$dir configuration" ; \
270 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir ; \
271 $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/config ; \
272 if [ -e 'post-up.sh' ]; then \
273 $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/post-up.sh ; \
275 if [ -d 'conf.d' ]; then \
276 $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \
278 for file in `ls`; do \
279 if [ -f $$file ]; then \
280 $(INSTALL) -m 600 $$file $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \
291 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
292 $(INSTALL) -m 644 ../doc/anytun.8 $(DESTDIR)$(MANDIR)/man8/
293 $(INSTALL) -m 644 ../doc/anytun-config.8 $(DESTDIR)$(MANDIR)/man8/
294 $(INSTALL) -m 644 ../doc/anytun-controld.8 $(DESTDIR)$(MANDIR)/man8/
295 $(INSTALL) -m 644 ../doc/anytun-showtables.8 $(DESTDIR)$(MANDIR)/man8/
300 remove: $(REMOVE_TARGETS)
303 rm -f $(DESTDIR)$(SBINDIR)/anytun
304 rm -f $(DESTDIR)$(BINDIR)/anytun-config
305 rm -f $(DESTDIR)$(BINDIR)/anytun-controld
306 rm -f $(DESTDIR)$(BINDIR)/anytun-showtables
309 rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun
312 rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/
315 rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8
316 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8
317 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8
318 rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8
321 rm -rf $(DESTDIR)$(ETCDIR)/anytun/