# -*-mode: makefile; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-

PREFIX=/usr/local
ROLE=proxy
VAGRANT_DOCTEST=python3.sh ../../../src/ansible/bin/vagrant_doctest-ssh.py
PYTHON_DOCTEST=python3.sh -m doctest
SSH_DOCTEST=python3.sh ../../../src/ansible/bin/vagrant_doctest-ssh.py -p 2222 --box="vagrant@127.0.0.1"
LOCAL_DOCTEST=/var/local/bin/testforge_run_doctest2.bash

DOCTEST=$(LOCAL_DOCTEST)

USER=`grep PRIV_SKEL_USERS_LIST /usr/local/etc/testforge/testforge.bash|sed -e 's/.*=//' -e 's/"//g'`

default:: local

test:: local

check::
	sudo -u ${USER} ${PREFIX}/src/usr_local_$(ROLE).bash $@

test::
	sudo -u ${USER} ${PREFIX}/src/usr_local_$(ROLE).bash $@

lint::
	sudo -u ${USER} ${PREFIX}/src/usr_local_$(ROLE).bash $@

local::
	[ -f $(LOCAL_DOCTEST) ] || exit 0
	$(DOCTEST) overlay/Linux/usr/local/share/doc/txt/proxy2.txt
	$(DOCTEST) overlay/Linux/usr/local/share/doc/txt/proxy3.txt

refresh::
	find . -maxdepth 1 -type l -delete
	ln -s overlay/Linux/var/local/share/doc/txt/*txt .

veryclean:: clean
	find * -name \*.py | xargs grep -l '[ 	]*$$' | \
	    xargs sed -i -e 's/[	 ]*$$//'

clean::
	find * -name \*~ -delete
