#---*- Makefile -*-------------------------------------------------------
#$Author: saulius $
#$Date: 2019-03-07 17:33:31 +0200 (Thu, 07 Mar 2019) $
#$Revision: 184 $
#$URL: svn+ssh://saulius-grazulis.lt/home/saulius/svn-repositories/makefiles/convert/Makelocal-convert $
#------------------------------------------------------------------------

INPUT_DIR = .
OUTPUT_DIR = converted

RST_FILES  = ${wildcard ${INPUT_DIR}/*.rst}
MD_FILES   = ${wildcard ${INPUT_DIR}/*.md}

PDF_FILES = \
	${RST_FILES:${INPUT_DIR}/%.rst=${OUTPUT_DIR}/%.pdf} \
	${MD_FILES:${INPUT_DIR}/%.md=${OUTPUT_DIR}/%.pdf} \
#

ODT_FILES = \
	${RST_FILES:${INPUT_DIR}/%.rst=${OUTPUT_DIR}/%.odt} \
	${MD_FILES:${INPUT_DIR}/%.md=${OUTPUT_DIR}/%.odt} \
#

DOCX_FILES = \
	${RST_FILES:${INPUT_DIR}/%.rst=${OUTPUT_DIR}/%.docx} \
	${MD_FILES:${INPUT_DIR}/%.md=${OUTPUT_DIR}/%.docx} \
#

.PHONY: all clean cleanAll distclean

all: ${PDF_FILES} ${ODT_FILES} ${DOCX_FILES}

${OUTPUT_DIR}/%.pdf: ${INPUT_DIR}/%.rst
	pandoc -o $@ $<

${OUTPUT_DIR}/%.pdf: ${INPUT_DIR}/%.md
	pandoc -o $@ $<

${OUTPUT_DIR}/%.odt: ${INPUT_DIR}/%.rst
	pandoc -o $@ $<

${OUTPUT_DIR}/%.odt: ${INPUT_DIR}/%.md
	pandoc -o $@ $<

${OUTPUT_DIR}/%.docx: ${INPUT_DIR}/%.rst
	pandoc -o $@ $<

${OUTPUT_DIR}/%.docx: ${INPUT_DIR}/%.md
	pandoc -o $@ $<

clean cleanAll distclean:
	rm -f ${PDF_FILES}
	rm -f ${ODT_FILES}
	rm -f ${DOCX_FILES}
