#!/usr/bin/make

ifndef db
db=maildb
endif

dsn='dbname=$(db)'

ifndef debug
debug=no
endif

ifdef junit-dir
pytest_params=--junit-xml=$(junit-dir)/TESTS-ora2pg.xml
endif

ifdef coverage-file
pytest_params+=--cov-report= --cov=ora2pg --cov-append
endif

behave=behave --format=progress2

clean-pyc:
	rm -f `find . -name '*.pyc' | xargs` 2>/dev/null || echo 'no pycs'

config-check: clean-pyc
	python -m ora2pg.app.config_file ora2pg/configs/*.yaml

unit-check: clean-pyc
	py.test ora2pg $(pytest_params)

check: config-check unit-check

ifdef coverage-file
coverage-report: .coverage
	coverage xml -o $(coverage-file)
	rm .coverage
endif
