# Packages the application for CTAN
package:
	# Render the manpage
	asciidoctor -b manpage -o man/tikztosvg.1 man/man.adoc
	 
	# Render the README as PDF
	asciidoctor -r asciidoctor-pdf -b pdf -o tikztosvg.pdf README.adoc
	
	# Render the README as Markdown
	asciidoctor -b docbook -a leveloffset=+1 -o - README.adoc \
		| pandoc --atx-headers \
						 --wrap=preserve \
						 -t markdown_github \
						 -f docbook - \
		| comby '![:[name]](:[link])' \
						'![:[name]](examples/:[link])' \
						-stdin \
						-stdout \
						-m .md \
		| comby  ':imagesdir: :[[value]]' '' -stdin -stdout -m .md \
		| comby  ':source-highlighter: :[[value]]' '' -stdin -stdout -m .md \
		> README.md
	
	# Package the repository as a tar file
	tar -cvO \
			--directory=.. \
			--exclude='.*' \
			--exclude='*.tar.gz' \
			--exclude='README.adoc' \
			tikztosvg \
		| gzip -c /dev/stdin > tikztosvg.tar.gz

install:
	sh install.sh

