-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (34 loc) · 1.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
SONGBOOK=perso
SONGS_BUILD_DIR=build/$(SONGBOOK)/songs
SONGS=$(wildcard songbooks/$(SONGBOOK)/*.tex)
BUILT_SONGS=$(patsubst songbooks/$(SONGBOOK)/%.tex,$(SONGS_BUILD_DIR)/%.tex,$(SONGS))
INSTRUMENT=ukulele
all: build/$(SONGBOOK).pdf
view: build/$(SONGBOOK).pdf
xdg-open ./$^
$(SONGS_BUILD_DIR):
mkdir -vp $(SONGS_BUILD_DIR)
$(BUILT_SONGS): $(SONGS_BUILD_DIR)/%.tex: songbooks/$(SONGBOOK)/%.tex | $(SONGS_BUILD_DIR)
ifeq ("$(INSTRUMENT)","")
cp -v $< $@
else
python3.12 -m songbook_tools insertchords $< > $@
endif
build/$(SONGBOOK)/songlist.tex: $(BUILT_SONGS) songbook_tools/*.py
cd build/$(SONGBOOK) && PYTHONPATH=../.. python3.12 -m songbook_tools makesonglist songs > ../../$@
build/$(SONGBOOK)/buildinfo.tex: songbook_tools/*.py
mkdir -vp build/$(SONGBOOK)
python3.12 -m songbook_tools makebuildinfo > $@
build/$(SONGBOOK)/$(SONGBOOK).tex: template.tex newline-fix.tex scripts/apply_newline_fix.sh
cp -v template.tex $@
scripts/apply_newline_fix.sh $@
build/$(SONGBOOK)/chords.tex: songbook_tools/*.py chords/*.ini
mkdir -vp build/$(SONGBOOK)
python3.12 -m songbook_tools makechords chords/ukulele.ini > $@
build/$(SONGBOOK).pdf: build/$(SONGBOOK)/chords.tex build/$(SONGBOOK)/songlist.tex build/$(SONGBOOK)/buildinfo.tex $(BUILT_SONGS) build/$(SONGBOOK)/$(SONGBOOK).tex
cd build/$(SONGBOOK) && pdflatex $(SONGBOOK).tex
texlua scripts/songidx.lua build/$(SONGBOOK)/songsindex.sxd build/$(SONGBOOK)/songsindex.sbx
cd build/$(SONGBOOK) && pdflatex $(SONGBOOK).tex
cp build/$(SONGBOOK)/$(SONGBOOK).pdf build/$(SONGBOOK).pdf
clean:
rm -rf build/