Make PDF the default target
All checks were successful
Build / build (push) Successful in 1m46s

This commit is contained in:
Emil Miler 2024-06-03 09:54:05 +02:00
parent 89be2699c5
commit 657f97ffc0
3 changed files with 21 additions and 10 deletions

View File

@ -22,7 +22,7 @@ jobs:
run: git clone https://git.0x45.cz/em/mixtape.git /workspace/em/mixtape run: git clone https://git.0x45.cz/em/mixtape.git /workspace/em/mixtape
- name: Build Chordpro - name: Build Chordpro
run: make run: make pdf html
- name: Build Zola - name: Build Zola
run: zola build run: zola build

View File

@ -12,7 +12,7 @@ SONG_PDF := $(patsubst %$(SRC_EXTENSION),%.pdf,$(SONG_CHO))
SONG_HTML := $(patsubst %$(SRC_EXTENSION),%.html,$(SONG_CHO)) SONG_HTML := $(patsubst %$(SRC_EXTENSION),%.html,$(SONG_CHO))
SONGBOOK := songbook.pdf SONGBOOK := songbook.pdf
.DEFAULT_GOAL := all .DEFAULT_GOAL := pdf
%.pdf: %$(SRC_EXTENSION) %.pdf: %$(SRC_EXTENSION)
$(CHORDPRO_CMD) -o $@ $< $(CHORDPRO_CMD) -o $@ $<
@ -20,7 +20,7 @@ SONGBOOK := songbook.pdf
%.html: %$(SRC_EXTENSION) %.html: %$(SRC_EXTENSION)
$(CHORDPRO_CMD) -o $@ $< $(CHORDPRO_CMD) -o $@ $<
all: $(SONG_PDF) $(SONG_HTML) $(SONGBOOK) all: pdf html songbook
$(SONGBOOK): $(SONG_PDF) $(SONGBOOK): $(SONG_PDF)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^
@ -31,6 +31,10 @@ html: $(SONG_HTML)
.PHONY: pdf .PHONY: pdf
pdf: $(SONG_PDF) pdf: $(SONG_PDF)
.PHONY: songbook
songbook: pdf
$(MAKE) $(SONGBOOK)
.PHONY: clean .PHONY: clean
clean: clean:
rm -f $(SONG_PDF) $(SONG_HTML) $(SONGBOOK) rm -f $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)

View File

@ -1,12 +1,14 @@
My personal guitar chord-book written in [ChordPro](https://www.chordpro.org/).
## Requirements ## Requirements
- [`chordpro`](https://github.com/ChordPro/chordpro/) - `docker`
- `ghostscript` - `ghostscript` (optional for `songbook` make target)
- `zola` (optional) - `zola` (optional for web deployment)
The makefile uses Docker with the official iamge `chordpro/chordpro:latest`. The makefile uses Docker with the official iamge `chordpro/chordpro:latest`.
It can be seamlesly integrated with a shell alias in case you want to use It can be seamlesly integrated with a shell alias in case you want to use
chordpro directly in your shell outside of make: ChordPro directly in your shell outside of make:
``` ```
alias chordpro="docker run -ti --rm --env HOME=\$HOME --env USER=\$USER --workdir \$(pwd) --volume \$HOME:\$HOME chordpro/chordpro:latest chordpro" alias chordpro="docker run -ti --rm --env HOME=\$HOME --env USER=\$USER --workdir \$(pwd) --volume \$HOME:\$HOME chordpro/chordpro:latest chordpro"
@ -14,10 +16,15 @@ alias chordpro="docker run -ti --rm --env HOME=\$HOME --env USER=\$USER --workdi
## Building ## Building
`make` defaults to `all` which builds individual PDF and HTML files for `make` defaults to `pdf` which builds individual PDF files for all songs.
all songs. It also builds one complete PDF songbook with all songs.
Available targets: `all`, `pdf`, `html`, `clean` Target | Description
-|-
`all` | `pdf`, `html`, `songbook`
`pdf` | Build individual PDF files
`html` | Build individual HTML files
`songbook` | Build one complete PDF songbook with all songs
`clean` | Remove all generated files
You can also build PDF for a specific page with: You can also build PDF for a specific page with: