####### Makefile for "BioSig for C/C++" #####################
###
###  Copyright (C) 2006-2021,2025,2026 Alois Schloegl <alois.schloegl@ist.ac.at>
###  This file is part of the "BioSig for C/C++" repository 
###  (biosig4c++) at http://biosig.sf.net/ 
###
##############################################################

PYTHON ?= python3
PYVER  := $(shell $(PYTHON) -c "import sys; print(sys.version[:3])")

release target : sdist wheel

dist/Biosig-@PACKAGE_VERSION@.tar.gz : sdist

sdist wheel ::
	$(PYTHON) -m build --$@

install :
	pip install

test:
	## get ../data/Newtest17-256.bdf
	$(MAKE) -C .. fetchdata
	## need to run from different directory, because
	(cd .. && PYTHONPATH=/usr/local/lib/python$(PYVER)/dist-packages/ $(PYTHON) -c 'import biosig; print(biosig.header("data/Newtest17-256.bdf"))')
	(cd .. && PYTHONPATH=/usr/local/lib/python$(PYVER)/dist-packages/ $(PYTHON) -c 'import biosig; print(biosig.data("data/Newtest17-256.bdf"))')
	(cd .. && PYTHONPATH=/usr/local/lib/python$(PYVER)/dist-packages/ $(PYTHON) < python/demo2.py)

clean:
	-rm -rf build/*
	-rm -rf dist/*
	-rm *.so

check: release
	twine check dist/*

upload: release
	# https://pypi.org/manage/account/token/
	# twine upload --repository PROJECT_NAME
	# see also  ~/.pypirc
	twine upload --repository Biosig dist/biosig-*.tar.gz dist/biosig-*-win_amd64.whl

