made library dependencies more dynamic

switched to absolute paths
This commit is contained in:
2024-11-27 12:52:40 +01:00
parent 0f7023da16
commit 0ae5cba75c
7 changed files with 53 additions and 37 deletions
+25 -17
View File
@@ -1,25 +1,30 @@
build_dir = build TOPDIR :::= $(PWD)
config_dir = config build_dir ::= $(TOPDIR)/build
docker = podman config_dir ::= $(TOPDIR)/config
library_dir = library docker ::= podman
propers_dir = propers library_dir ::= $(TOPDIR)/library
template_dir = templates propers_dir ::= $(TOPDIR)/propers
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 template_dir ::= $(TOPDIR)/templates
.PHONY: all song_choices ::= $(config_dir)/song_choices.csv
user_variables ::= $(config_dir)/variables.tt
export
.PHONY: clean all
*: $(build_dir)/dynamic_deps.mk
$(build_dir)/dynamic_deps.mk: build_dir $(template_dir)/dynamic_deps.mk.tt $(song_choices) $(user_variables)
$(MAKE) -C $(template_dir) $@
include $(build_dir)/dynamic_deps.mk
clean:
$(RM) -r build
all: leadsheet_collection.pdf choir_scores.pdf print_a3.pdf clean_intermediate #print_a4.pdf all: leadsheet_collection.pdf choir_scores.pdf print_a3.pdf clean_intermediate #print_a4.pdf
%.pdf: build %.pdf: build
$(MAKE) -C $(build_dir) $@ $(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: clean_intermediate:
$(MAKE) -C $(build_dir) clean_intermediate $(MAKE) -C $(build_dir) clean_intermediate
build: build-Makefile build_dir:
mkdir -p $(build_dir) && \ mkdir -p $(build_dir)
build: build_dir build-Makefile
cp build-Makefile $(build_dir)/Makefile && \ cp build-Makefile $(build_dir)/Makefile && \
cp -r library/gregorio_scores $(build_dir) cp -r library/gregorio_scores $(build_dir)
clean:
$(RM) -r build
init: init:
git submodule update --init --recursive git submodule update --init --recursive
build_docker_image: build_docker_image:
@@ -27,5 +32,8 @@ build_docker_image:
pull_docker: pull_docker:
$(docker) pull gitea.leopold.fajtak.at/leopold/songsheet_generator:latest $(docker) pull gitea.leopold.fajtak.at/leopold/songsheet_generator:latest
build_in_docker: build_in_docker:
$(docker) run -v `pwd`:/data songsheet_generator make $(docker) run -v `pwd`:/data songsheet_generator make -j all
tex_deps ::= $(template_dir)/variables.tt $(config_dir)/qr_codes.csv $(config_dir)/variables.tt $(dynamic_deps)
songsheet.tex: $(template_dir)/songsheet.tt $(tex_deps) $(template_dir)/header.tt $(template_dir)/head.tt $(template_dir)/footer.tt
%.tex: build $(tex_deps)
$(MAKE) -C $(template_dir) $@
+1 -1
View File
@@ -18,6 +18,6 @@ songsheet_a4part.pdf: songsheet_a5.pdf
songsheet_a5.pdf: songsheet.pdf songsheet_a5.pdf: songsheet.pdf
pdfjam -o $@ --nup 2x1 --paper a5paper --landscape $< pdfjam -o $@ --nup 2x1 --paper a5paper --landscape $<
%.tex: %.tex:
$(MAKE) -C .. $@ $(MAKE) -C $(TOPDIR) $@
clean_intermediate: clean_intermediate:
$(RM) songsheet_a3part.pdf songsheet_a4part.pdf songsheet_a5.pdf $(RM) songsheet_a3part.pdf songsheet_a4part.pdf songsheet_a5.pdf
+1 -1
View File
@@ -1,5 +1,5 @@
purpose | content | template | variables purpose | content | template | variables
| | | | | | freie_lieder/adeste_fideles
introitus | | | introitus | | |
#confiteor | \input{library/gebete/confiteor/confiteor_de.tex} | | #confiteor | \input{library/gebete/confiteor/confiteor_de.tex} | |
kyrie | | | kyrie | | |
1 purpose content template variables
2 freie_lieder/adeste_fideles
3 introitus
4 #confiteor \input{library/gebete/confiteor/confiteor_de.tex}
5 kyrie
+9 -9
View File
@@ -1,13 +1,13 @@
build_dir = ../build tpage_defs = --define config_dir=$(config_dir) --define library_dir=$(library_dir) --define propers_dir=$(propers_dir)
library_dir = ../library tpage = tpage $(tpage_defs)
propers_dir = ../propers tex_deps = *.tt $(config_dir)/variables.tt $(dynamic_deps)
config_dir = ../config
tex_deps = *.tt $(library_dir)/*/*/*.tt $(propers_dir)/*.tt $(config_dir)/song_choices.csv $(config_dir)/variables.tt
songsheet.tex: songsheet.tt $(tex_deps) header.tt head.tt footer.tt songsheet.tex: songsheet.tt $(tex_deps) header.tt head.tt footer.tt
tpage $< > $(build_dir)/$@ $(tpage) $< > $(build_dir)/$@
musician_scores.tex: musician_scores.tt $(tex_deps) musician_scores.tex: musician_scores.tt $(tex_deps)
tpage $< > $(build_dir)/$@ $(tpage) $< > $(build_dir)/$@
leadsheet_collection.tex: musician_scores.tt $(tex_deps) leadsheet_collection.tex: musician_scores.tt $(tex_deps)
tpage --define parts=band $< > $(build_dir)/$@ $(tpage) --define parts=band $< > $(build_dir)/$@
choir_scores.tex: musician_scores.tt $(tex_deps) choir_scores.tex: musician_scores.tt $(tex_deps)
tpage --define parts=SATB $< > $(build_dir)/$@ $(tpage) --define parts=SATB $< > $(build_dir)/$@
$(build_dir)/dynamic_deps.mk: dynamic_deps.mk.tt $(song_choices) $(user_variables)
$(tpage) $< > $@
+11
View File
@@ -0,0 +1,11 @@
dynamic_deps = [% PROCESS variables.tt;
USE song_choices = datafile("${config_dir}/song_choices.csv", delim= '|');
FOREACH song = song_choices;
IF song.variables != '';
GET "${library_dir}/${song.variables}/* ";
END;
END;
IF proper != '';
GET "${propers_dir}/${proper}.tt";
END;
-%]
+5 -1
View File
@@ -1,4 +1,8 @@
[% PROCESS variables.tt -%] [% PROCESS variables.tt;
IF proper != '';
PROCESS "${propers_dir}/${proper}.tt";
END;
-%]
[% parts = 0 -%] [% parts = 0 -%]
[% INCLUDE header.tt -%] [% INCLUDE header.tt -%]
\begin{document} \begin{document}
+1 -8
View File
@@ -8,12 +8,5 @@
small_footer = 0 small_footer = 0
lent = 0 lent = 0
meditations = 0 meditations = 0
config_dir = '../config'
library_dir = '../library'
propers_dir = '../propers/'
-%]
[% PROCESS "${config_dir}/variables.tt";
IF proper != '';
PROCESS "${propers_dir}/${proper}.tt";
END;
-%] -%]
[% PROCESS "${config_dir}/variables.tt" -%]