# Copyright (c) 2015 Peter Pentchev # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. SUBDIR= ayiya_listen ayiya_resp ng_ayiya .include NAME= ng_ayiya VERSION= 0.1.0 DISTNAME= ${NAME}-${VERSION} DISTDIR= ${DISTNAME} S= ${.CURDIR} D= ${.CURDIR}/${DISTDIR} CP?= cp -pf RM?= rm -rf MKDIR?= mkdir -p SUDO?= sudo down: cd ${.CURDIR}/ng_ayiya && ${MAKE} down up: cd ${.CURDIR}/ng_ayiya && ${MAKE} up tic: cd ${.CURDIR}/ng_ayiya && ${MAKE} tic clitest: tic cd ${.CURDIR}/ayiya_resp && ${MAKE} clitest clitest-quiet: tic cd ${.CURDIR}/ayiya_resp && ${MAKE} clitest-quiet dist: ${RM} $D/ ${MKDIR} $D cd $S && git ls-files | fgrep -ve / | while read f; do ${CP} $S/$$f $D/$$f; done cd $S && git ls-files ${SUBDIR} | xargs -n1 dirname | sort -u | while read d; do ${MKDIR} $D/$$d; done cd $S && git ls-files ${SUBDIR} | while read f; do ${CP} $S/$$f $D/$$f; done cd $S && tar zcf ${DISTNAME}.tar.gz ${DISTDIR}/ cd $S && tar jcf ${DISTNAME}.tar.bz2 ${DISTDIR}/ cd $S && tar Jcf ${DISTNAME}.tar.xz ${DISTDIR}/ distclean: ${RM} $D/ cd $S && ${MAKE} cleandir && ${MAKE} cleandir shutdown: ${SUDO} ngctl list | awk "/Type: ayiya/ { print \$$2 }" | while read node; do \ ${SUDO} ngctl shutdown "$$node:inet6" || true; \ ${SUDO} ngctl shutdown "$$node:"; \ done ayiya-server: @if [ -z "${TUNNELSFILE}" ] || [ -z "${LISTENADDR}" ]; then \ printf "\n\nYou must specify the path to the tic-tunnels.txt file in the TUNNELSFILE variable and the IPv4 address to listen on in the LISTENADDR variable\n\n"; \ false; \ fi ${MAKE} -C ${.CURDIR} obj ${MAKE} -C ${.CURDIR} depend ${MAKE} -C ${.CURDIR} ${MAKE} -C ${.CURDIR} shutdown ${SUDO} ${MAKE} -C ${.CURDIR}/ng_ayiya unload || true ${SUDO} ${MAKE} -C ${.CURDIR}/ng_ayiya load cd ${.CURDIR} && ${SUDO} `${MAKE} -C ${.CURDIR}/ayiya_listen -V .OBJDIR`/ayiya_listen -v -a "${LISTENADDR}" -t "${TUNNELSFILE}" -v