build_dir = build
config_dir = config
docker = podman
library_dir = library
propers_dir = propers
template_dir = templates
tex_deps = $(template_dir)/*.tt $(library_dir)/*/*/*.tt $(propers_dir)/*.tt $(config_dir)/song_choices.csv $(config_dir)/qr_codes.csv $(config_dir)/variables.tt
.PHONY: all 
all: leadsheet_collection.pdf choir_scores.pdf print_a3.pdf clean_intermediate #print_a4.pdf
%.pdf: build
	$(MAKE) -C $(build_dir) $@
songsheet.tex: $(template_dir)/songsheet.tt $(tex_deps) $(template_dir)/header.tt $(template_dir)/head.tt $(template_dir)/footer.tt
%.tex: build
	$(MAKE) -C $(template_dir) $@
clean_intermediate:
	$(MAKE) -C $(build_dir) clean_intermediate
build: build-Makefile
	mkdir -p $(build_dir) && \
	cp build-Makefile $(build_dir)/Makefile && \
	cp -r library/gregorio_scores $(build_dir)
clean:
	$(RM) -r build
init:
	git submodule update --init --recursive
build_docker_image:
	$(docker) build -t songsheet_generator .
pull_docker:
	$(docker) pull gitea.leopold.fajtak.at/leopold/songsheet_generator:latest
build_in_docker:
	$(docker) run -v `pwd`:/data songsheet_generator make

