.PHONY:	xhp lo aoo gui tk_translate help pylint version oxt test

all:	xhp version oxt install

install:
	unopkg remove vnd.include-once.pagetranslate
	unopkg add --log-file log.txt -s pagetranslate.oxt

version: # https://fossil.include-once.org/versionnum/
	which version  &&  version  --read pagetranslate.py  --incr  --write pagetranslate.py  --write description.xml  ||  true

oxt:
	zip pagetranslate.oxt -9 -r META-INF pagetranslate.py *xcu *xcs *xdl *desc* icons pythonpath/ help NEWS -x '*/__pycache__/*'

aoo:	version oxt
	#/opt/openoffice4/program/unopkg remove pagetranslate.oxt
	/opt/openoffice4/program/unopkg add pagetranslate.oxt
	# Shift+F1 for UNO names of widgets
	HELP_DEBUG=true /opt/openoffice4/program/soffice -writer

lo:	lo74

lo7:	lo74

lo74:	version oxt
	/opt/libreoffice7.4/program/unopkg add pagetranslate.oxt
	/opt/libreoffice7.4/program/soffice --writer --norestore
	tail /tmp/pagetranslate-libreoffice.log
	
lo71:	version oxt
	/opt/libreoffice7.1/program/unopkg add pagetranslate.oxt
	/opt/libreoffice7.1/program/soffice --writer


help:	xhp

xhp:
	make -C help/en/vnd.include-once.pagetranslate/

pip:
	make -C pythonpath

gui:	tk_translate

setup:
	./setup.py bdist_wheel
	# twine upload dist/*

tk_translate:
	./setup.py bdist_wheel

pylint:
	PYTHONPATH=./pythonpath/:/opt/libreoffice7.1/program/ pylint pagetranslate.py pythonpath/translationbackends.py

test:
	pytest -vv -ra
