diff --git a/Makefile b/Makefile index ebf6182..e6d3e8d 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,14 @@ docker = podman build_dir = build -tex_deps = variables.tt library/*/*/*.tt song_choices.csv song_template.tt empty_page_template.tt propers/*.tt purpose_processing.tt +template_dir = templates +config_dir = config .PHONY: all .PRECIOUS: %.tex all: leadsheet_collection.pdf choir_scores.pdf print_a3.pdf clean_intermediate #print_a4.pdf %.pdf: build $(MAKE) -C $(build_dir) $@ -songsheet.tex: songsheet.tt $(tex_deps) header.tt head.tt footer.tt - tpage $< > $(build_dir)/$@ -musician_scores.tex: musician_scores.tt $(tex_deps) - tpage $< > $(build_dir)/$@ -leadsheet_collection.tex: musician_scores.tt $(tex_deps) - tpage --define parts=band $< > $(build_dir)/$@ -choir_scores.tex: musician_scores.tt $(tex_deps) - tpage --define parts=SATB $< > $(build_dir)/$@ +%.tex: build + $(MAKE) -C $(template_dir) $@ clean_intermediate: $(MAKE) -C $(build_dir) clean_intermediate build: build-Makefile diff --git a/qr_codes.csv b/config/qr_codes.csv similarity index 100% rename from qr_codes.csv rename to config/qr_codes.csv diff --git a/song_choices.csv b/config/song_choices.csv similarity index 100% rename from song_choices.csv rename to config/song_choices.csv diff --git a/templates/Makefile b/templates/Makefile new file mode 100644 index 0000000..fb205fa --- /dev/null +++ b/templates/Makefile @@ -0,0 +1,13 @@ +build_dir = ../build +library_dir = ../library +propers_dir = ../propers +config_dir = ../config +tex_deps = *.tt $(library_dir)/*/*/*.tt $(config_dir)/song_choices.csv $(propers_dir)/*.tt +songsheet.tex: songsheet.tt $(tex_deps) header.tt head.tt footer.tt + tpage $< > $(build_dir)/$@ +musician_scores.tex: musician_scores.tt $(tex_deps) + tpage $< > $(build_dir)/$@ +leadsheet_collection.tex: musician_scores.tt $(tex_deps) + tpage --define parts=band $< > $(build_dir)/$@ +choir_scores.tex: musician_scores.tt $(tex_deps) + tpage --define parts=SATB $< > $(build_dir)/$@ diff --git a/empty_page_template.tt b/templates/empty_page_template.tt similarity index 100% rename from empty_page_template.tt rename to templates/empty_page_template.tt diff --git a/footer.tt b/templates/footer.tt similarity index 89% rename from footer.tt rename to templates/footer.tt index 3c57cc2..b54383f 100644 --- a/footer.tt +++ b/templates/footer.tt @@ -1,6 +1,6 @@ \vspace*{\fill} -[% USE qr_codes = datafile('qr_codes.csv', delim='|') %] +[% USE qr_codes = datafile("${config_dir}/qr_codes.csv", delim='|') %] [% FOREACH qr_code = qr_codes -%] diff --git a/head.tt b/templates/head.tt similarity index 100% rename from head.tt rename to templates/head.tt diff --git a/header.tt b/templates/header.tt similarity index 100% rename from header.tt rename to templates/header.tt diff --git a/musician_scores.tt b/templates/musician_scores.tt similarity index 97% rename from musician_scores.tt rename to templates/musician_scores.tt index cab7a9c..a4f5179 100644 --- a/musician_scores.tt +++ b/templates/musician_scores.tt @@ -75,7 +75,7 @@ RawFeature = {+ss06} [% subtitle %] \end{centering} -[% USE song_choices = datafile('song_choices.csv', delim='|') %] +[% USE song_choices = datafile("${config_dir}/song_choices.csv", delim='|') %] [% IF parts == 0 -%] parts = ensemble [% END -%] diff --git a/purpose_processing.tt b/templates/purpose_processing.tt similarity index 100% rename from purpose_processing.tt rename to templates/purpose_processing.tt diff --git a/song_template.tt b/templates/song_template.tt similarity index 78% rename from song_template.tt rename to templates/song_template.tt index f0ca777..747dc2a 100644 --- a/song_template.tt +++ b/templates/song_template.tt @@ -11,25 +11,25 @@ [% IF NOT gregorian -%] \textbf{\LARGE{Activate gregorian}} [% ELSE -%] - \gregorioscore{../library/[% scores.gregorian %]} + \gregorioscore{[% library_dir %]/[% scores.gregorian %]} [% END -%] [% ELSE -%] \lilypondfile{[% IF parts; IF parts == 'band'; IF scores.leadsheet; - GET "../library/${scores.leadsheet}"; + GET "${library_dir}/${scores.leadsheet}"; ELSE; - GET "../library/${scores.SATB}"; + GET "${library_dir}/${scores.SATB}"; END; ELSIF parts == 'SATB'; IF scores.SATB; - GET "../library/${scores.SATB}"; + GET "${library_dir}/${scores.SATB}"; ELSE; - GET "../library/${scores.leadsheet}"; + GET "${library_dir}/${scores.leadsheet}"; END; END; ELSE; - GET "../library/${scores.congregation}"; + GET "${library_dir}/${scores.congregation}"; END; %]} [% END -%] [% ELSIF lyrics -%] diff --git a/songsheet.tt b/templates/songsheet.tt similarity index 85% rename from songsheet.tt rename to templates/songsheet.tt index 6db9c86..9b97502 100644 --- a/songsheet.tt +++ b/templates/songsheet.tt @@ -4,7 +4,7 @@ \begin{document} [% INCLUDE head.tt %] -[% USE song_choices = datafile('song_choices.csv', delim='|') %] +[% USE song_choices = datafile("${config_dir}/song_choices.csv", delim='|') %] [% FOREACH song = song_choices %] [% template = song.template == '' ? "song_template.tt" : song.template -%] diff --git a/variables.tt b/templates/variables.tt similarity index 81% rename from variables.tt rename to templates/variables.tt index f172e32..fa7c17d 100644 --- a/variables.tt +++ b/templates/variables.tt @@ -8,5 +8,7 @@ small_footer = 0 lent = 0 meditations = 0 + config_dir = '../config' + library_dir = '../library' -%] [%# PROCESS propers/per_annum_XIII.tt -%]