## commands

cmd_log := echo "--"
cmd_quarto := quarto
cmd_mkdir := mkdir -p
cmd_cp := cp
cmd_rm := rm --force --recursive

## rules

all: \
	media \
	${dir_build}/praesentation.html \
	${dir_build}/fortlaufend.html \
	bewerbung \
	${dir_build}/index.html

.PHONY: media
media: ${dir_build}/media

${dir_build}/media: $(wildcard ${dir_source}/media/*)
	@ ${cmd_log} "Media …"
	@ ${cmd_mkdir} ${dir_build}/media
	@ ${cmd_cp} -u -r $^ ${dir_build}/media/

${dir_build}/praesentation.html: $(wildcard ${dir_source}/slides/*)
	@ ${cmd_log} "Präsentation …"
	@ ${cmd_mkdir} $(dir $@)
	@ ${cmd_quarto} render ${dir_source}/slides/main.qmd --quiet --to revealjs --output-dir ${dir_build} && mv ${dir_build}/main.html $@
	@ ${cmd_rm} ${dir_source}/slides/main_files

${dir_build}/fortlaufend.html: $(wildcard ${dir_source}/slides/*)
	@ ${cmd_log} "Fortlaufend …"
	@ ${cmd_mkdir} $(dir $@)
	@ ${cmd_quarto} render ${dir_source}/slides/main.qmd --quiet --to html --output-dir ${dir_build} && mv ${dir_build}/main.html $@
	@ ${cmd_rm} ${dir_source}/slides/main_files

.PHONY: bewerbung
bewerbung:
	@ ${cmd_log} "Bewerbung …"
	@ ${cmd_mkdir} ${dir_build}/bewerbung/
	@ ${cmd_cp} -r -u -v ${dir_source}/bewerbung/* ${dir_build}/bewerbung/

${dir_build}/index.html: ${dir_source}/index.html
	@ ${cmd_log} "index …"
	@ ${cmd_mkdir} $(dir $@)
	@ ${cmd_cp} -u $^ $@

