mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2026-04-20 19:04:29 -05:00
@@ -29,4 +29,4 @@ jobs:
|
|||||||
options: -v ${{ github.workspace }}:/app
|
options: -v ${{ github.workspace }}:/app
|
||||||
run: |
|
run: |
|
||||||
cd /app/book
|
cd /app/book
|
||||||
make -j build_pdf build_serif_ebook
|
make -j build_pdf build_ebook
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB |
+70
-34
@@ -5,8 +5,13 @@ WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilter
|
|||||||
CLEAN := latexmk -cd -lualatex -c -use-make
|
CLEAN := latexmk -cd -lualatex -c -use-make
|
||||||
CHECK_1 := lacheck
|
CHECK_1 := lacheck
|
||||||
CHECK_2 := chktex
|
CHECK_2 := chktex
|
||||||
|
CONVERT_PIC := convert
|
||||||
|
REDUCE_PIC := -resize '800x800>' \
|
||||||
|
-strip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
|
||||||
|
-set colorspace Gray -separate -evaluate-sequence Mean
|
||||||
|
RSYNC := rsync -au --exclude 'book.epub' --exclude '*.jpg' --exclude '*.png'
|
||||||
|
|
||||||
# we want bash as shell
|
# We want bash as shell
|
||||||
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||||
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
||||||
else echo sh; fi; fi)
|
else echo sh; fi; fi)
|
||||||
@@ -36,7 +41,13 @@ images += $(wildcard images/*.jpg)
|
|||||||
images += $(wildcard images/*.png)
|
images += $(wildcard images/*.png)
|
||||||
images += $(wildcard images/*/*.png)
|
images += $(wildcard images/*/*.png)
|
||||||
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.jpg))
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.jpg))
|
||||||
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.jpg))
|
||||||
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
|
||||||
|
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.png))
|
||||||
|
|
||||||
|
# Black and White ebook, we will just re-zip directory after converting the
|
||||||
|
# images to lower resolution and greyscale
|
||||||
|
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
|
||||||
|
|
||||||
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(images)
|
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(images)
|
||||||
|
|
||||||
@@ -48,8 +59,8 @@ ruby_pkg := ../website/Gemfile ../website/Gemfile.lock
|
|||||||
|
|
||||||
tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
|
tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
|
||||||
|
|
||||||
# Default target is not all becuse most of the time we just want a pdf...
|
# Default target is not all because most of the time we just want a pdf...
|
||||||
# ebook take a long time to build.
|
# and ebook take a long time to build.
|
||||||
.DEFAULT_GOAL := build_serif_pdf
|
.DEFAULT_GOAL := build_serif_pdf
|
||||||
|
|
||||||
# Default rules for pdf and ebooks, getting overwritten when built in a
|
# Default rules for pdf and ebooks, getting overwritten when built in a
|
||||||
@@ -76,9 +87,33 @@ book_serif/book.pdf: $(src_all)
|
|||||||
book_sans_serif/book_sans_serif.pdf: $(src_all)
|
book_sans_serif/book_sans_serif.pdf: $(src_all)
|
||||||
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
||||||
|
|
||||||
|
.PHONY: bw_epub copy_ebook_files
|
||||||
|
|
||||||
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
|
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
|
||||||
$(EBOOK) -f epub $<
|
$(EBOOK) -f epub $<
|
||||||
|
|
||||||
|
bw-book-epub:
|
||||||
|
mkdir -p bw-book-epub
|
||||||
|
|
||||||
|
copy_ebook_files: build_ebook | bw-book-epub
|
||||||
|
$(RSYNC) book-epub/ bw-book-epub/
|
||||||
|
|
||||||
|
# We not convert SVG to B&W or lower res for now as they are super small
|
||||||
|
# anyway
|
||||||
|
bw-book-epub/OEBPS/%.jpg: %.jpg
|
||||||
|
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
|
||||||
|
|
||||||
|
bw-book-epub/OEBPS/%.png: %.png
|
||||||
|
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
|
||||||
|
|
||||||
|
bw_ebook.zip: copy_ebook_files $(bw_images)
|
||||||
|
zip -qXr9D bw_ebook.zip bw-book-epub
|
||||||
|
|
||||||
|
epub/bw_book.epub: bw_ebook.zip
|
||||||
|
mv bw_ebook.zip epub/bw_book.epub
|
||||||
|
|
||||||
|
bw_epub: epub/bw_book.epub | bw-book-epub
|
||||||
|
|
||||||
# Now with the rules
|
# Now with the rules
|
||||||
# Expected usual rules first
|
# Expected usual rules first
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@@ -89,14 +124,16 @@ help:
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "default: builds the book in pdf format (serif)"
|
@echo "default: builds the book in pdf format (serif)"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "all: pdf and ebooks serif and sans-serif accessible version, same as"
|
@echo "all: pdf serif and sans-serif accessible version, as well as ebooks"
|
||||||
@echo " build release"
|
@echo " in colour and black&white versions"
|
||||||
|
@echo ""
|
||||||
@echo "bake: same as build all"
|
@echo "bake: same as build all"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "check: runs static analysis checker on LaTeX source to spot"
|
@echo "check: runs static analysis checker on LaTeX source to spot"
|
||||||
@echo " programming or typographic mistakes"
|
@echo " programming or typographic mistakes"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "clean: delete all intermediate files keep targets (pdf/ebooks/website)"
|
@echo "clean: delete all intermediate files keep targets (pdf/ebooks/website)"
|
||||||
|
@echo ""
|
||||||
@echo "mrproper: delete all generated files intermediate and pdf/ebooks/website"
|
@echo "mrproper: delete all generated files intermediate and pdf/ebooks/website"
|
||||||
@echo " clean_figures: delete intermediate TikZ files"
|
@echo " clean_figures: delete intermediate TikZ files"
|
||||||
@echo " clean_website_build: delete intermediate website files"
|
@echo " clean_website_build: delete intermediate website files"
|
||||||
@@ -104,7 +141,9 @@ help:
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "build_pdf: builds both serif and accessible pdf"
|
@echo "build_pdf: builds both serif and accessible pdf"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "build_ebook: builds only the ebook"
|
@echo "build_ebook: builds only the colour ebook"
|
||||||
|
@echo ""
|
||||||
|
@echo "build_bw_ebook: builds the low res black & white ebook"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "build_sans_serif_pdf: build accessible pdf only"
|
@echo "build_sans_serif_pdf: build accessible pdf only"
|
||||||
@echo ""
|
@echo ""
|
||||||
@@ -122,7 +161,7 @@ help:
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "quick: compiles serif_pdf but runs lulatex only once"
|
@echo "quick: compiles serif_pdf but runs lulatex only once"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "quick_ebook: compiles serif_ebook but runs lulatex only once"
|
@echo "quick_ebook: compiles ebook but runs lulatex only once"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "show_tools_version: Show version of tools used on the build machine"
|
@echo "show_tools_version: Show version of tools used on the build machine"
|
||||||
@echo ""
|
@echo ""
|
||||||
@@ -133,30 +172,26 @@ help:
|
|||||||
@echo "set DEBUG i.e make DEBUG=1 build_ebook to add debug flags to commands"
|
@echo "set DEBUG i.e make DEBUG=1 build_ebook to add debug flags to commands"
|
||||||
|
|
||||||
|
|
||||||
# Finally project specif targets
|
# Finally actual project targets (i.e. build pdf and ebooks)
|
||||||
.PHONY: build_pdf
|
.PHONY: build_pdf build_serif_pdf build_sans_serif_pdf build_ebook
|
||||||
|
|
||||||
build_pdf: build_serif_pdf build_sans_serif_pdf
|
build_pdf: build_serif_pdf build_sans_serif_pdf
|
||||||
|
|
||||||
.PHONY: build_serif_pdf
|
|
||||||
build_serif_pdf: book_serif/book.pdf
|
build_serif_pdf: book_serif/book.pdf
|
||||||
|
|
||||||
.PHONY: build_sans_serif_pdf
|
|
||||||
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
|
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
|
||||||
|
|
||||||
.PHONY: build_ebook
|
build_ebook: epub/book.epub
|
||||||
build_ebook: build_serif_ebook
|
|
||||||
|
|
||||||
.PHONY: build_serif_ebook
|
build_bw_ebook: epub/bw_book.epub
|
||||||
build_serif_ebook: epub/book.epub | make_release_dir
|
|
||||||
|
|
||||||
.PHONY: export_figures
|
.PHONY: export_figures check
|
||||||
# Requires that you have docker running on your computer.
|
# Requires that you have docker running on your computer.
|
||||||
export_figures: build_pdf $(tgt_figures)
|
export_figures: build_pdf $(tgt_figures)
|
||||||
cd figures/ && bash export_figures.sh
|
cd figures/ && bash export_figures.sh
|
||||||
|
|
||||||
# Goal is not really to have 0 warning reported but we should check we don't
|
# Goal is not really to have 0 warning reported but we should check we don't
|
||||||
# add many and if we do, we know they are false positive
|
# add many and if we do, we know they are false positive
|
||||||
PHONY: check
|
|
||||||
check: $(SRC_TEX)
|
check: $(SRC_TEX)
|
||||||
@echo "Running: " $(CHECK_1)
|
@echo "Running: " $(CHECK_1)
|
||||||
$(CHECK_1) book.tex
|
$(CHECK_1) book.tex
|
||||||
@@ -164,7 +199,9 @@ check: $(SRC_TEX)
|
|||||||
@echo "Running: " $(CHECK_2)
|
@echo "Running: " $(CHECK_2)
|
||||||
$(CHECK_2) book.tex
|
$(CHECK_2) book.tex
|
||||||
|
|
||||||
.PHONY: clean_figures
|
|
||||||
|
# Clean up and delete generated files
|
||||||
|
.PHONY: clean_figures clean_ebook_build clean_website_build clean mrproper
|
||||||
clean_figures:
|
clean_figures:
|
||||||
- $(CLEAN) $(patsubst %.tex, %.png.in, $(src_figures))
|
- $(CLEAN) $(patsubst %.tex, %.png.in, $(src_figures))
|
||||||
- rm $(patsubst %.tex, %.png.pdf, $(src_figures))
|
- rm $(patsubst %.tex, %.png.pdf, $(src_figures))
|
||||||
@@ -172,7 +209,6 @@ clean_figures:
|
|||||||
- rm $(wildcard figures/*.png.*)
|
- rm $(wildcard figures/*.png.*)
|
||||||
- rm cover/cover-page.xbb
|
- rm cover/cover-page.xbb
|
||||||
|
|
||||||
.PHONY: clean_ebook_build
|
|
||||||
clean_ebook_build:
|
clean_ebook_build:
|
||||||
-rm book*.{4ct,4tc,aux,bbl,bcf,blg,dvi,fdb_latexmk,fls,html}
|
-rm book*.{4ct,4tc,aux,bbl,bcf,blg,dvi,fdb_latexmk,fls,html}
|
||||||
-rm book*.{idv,lg,loc,log,ncx,run.xml,tmp,xref}
|
-rm book*.{idv,lg,loc,log,ncx,run.xml,tmp,xref}
|
||||||
@@ -180,13 +216,11 @@ clean_ebook_build:
|
|||||||
-rm book.css
|
-rm book.css
|
||||||
-rm content.opf
|
-rm content.opf
|
||||||
|
|
||||||
.PHONY: clean_website_build
|
|
||||||
clean_website_build: clean_ebook_build
|
clean_website_build: clean_ebook_build
|
||||||
-rm book-*.svg
|
-rm book-*.svg
|
||||||
-rm book.{loc,dlog}
|
-rm book.{loc,dlog}
|
||||||
-rm $(subst $(website_dir)/,, $(wildcard $(website_dir)/*.html))
|
-rm $(subst $(website_dir)/,, $(wildcard $(website_dir)/*.html))
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: clean_ebook_build clean_figures clean_website_build
|
clean: clean_ebook_build clean_figures clean_website_build
|
||||||
$(CLEAN) -output-directory=book_serif book.tex
|
$(CLEAN) -output-directory=book_serif book.tex
|
||||||
$(CLEAN) -output-directory=book_sans_serif book_sans_serif.tex
|
$(CLEAN) -output-directory=book_sans_serif book_sans_serif.tex
|
||||||
@@ -195,7 +229,6 @@ clean: clean_ebook_build clean_figures clean_website_build
|
|||||||
-rm -rf book*-epub/OEBPS
|
-rm -rf book*-epub/OEBPS
|
||||||
-rm book*-epub/mimetype
|
-rm book*-epub/mimetype
|
||||||
|
|
||||||
.PHONY: mrproper
|
|
||||||
mrproper: clean
|
mrproper: clean
|
||||||
$(CLEAN) -C $(src_figures)
|
$(CLEAN) -C $(src_figures)
|
||||||
$(CLEAN) -C -output-directory=book_serif book.tex
|
$(CLEAN) -C -output-directory=book_serif book.tex
|
||||||
@@ -210,27 +243,27 @@ mrproper: clean
|
|||||||
-rm -rf book-epub/
|
-rm -rf book-epub/
|
||||||
-rm -rf $(website_dir)
|
-rm -rf $(website_dir)
|
||||||
|
|
||||||
.PHONY: bake
|
# top level releases rules
|
||||||
|
.PHONY: bake release_serif release_sans_serif
|
||||||
|
|
||||||
bake: release_serif release_sans_serif
|
bake: release_serif release_sans_serif
|
||||||
|
|
||||||
.PHONY: make_release_dir
|
release:
|
||||||
make_release_dir:
|
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
|
|
||||||
.PHONY: release_serif
|
release_serif: build_serif_pdf build_ebook build_bw_ebook | release
|
||||||
release_serif: build_serif_pdf build_serif_ebook | make_release_dir
|
|
||||||
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
||||||
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
||||||
|
cp epub/bw_book.epub release/TheBreadCode-The-Sourdough-Framework-black-and-white.epub
|
||||||
|
|
||||||
.PHONY: release_sans_serif
|
release_sans_serif: build_sans_serif_pdf | release
|
||||||
release_sans_serif: build_sans_serif_pdf | make_release_dir
|
|
||||||
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
||||||
|
|
||||||
# Website stuff
|
# Website stuff
|
||||||
|
.PHONY: html website
|
||||||
$(website_dir)/book.html: $(website_src) cover/cover-page.xbb
|
$(website_dir)/book.html: $(website_src) cover/cover-page.xbb
|
||||||
$(WEBSITE) -d $(website_dir) book.tex
|
$(WEBSITE) -d $(website_dir) book.tex
|
||||||
|
|
||||||
.PHONY: html
|
|
||||||
html: $(website_dir)/book.html
|
html: $(website_dir)/book.html
|
||||||
cp $< $(website_dir)/index.html
|
cp $< $(website_dir)/index.html
|
||||||
|
|
||||||
@@ -242,18 +275,17 @@ html: $(website_dir)/book.html
|
|||||||
touch ../website/$@
|
touch ../website/$@
|
||||||
|
|
||||||
# TODO: this will run every single time, but is so fast we don't really care
|
# TODO: this will run every single time, but is so fast we don't really care
|
||||||
.PHONY: website
|
|
||||||
website: html ../website/_bundle_install_done $(ruby_src)
|
website: html ../website/_bundle_install_done $(ruby_src)
|
||||||
cd ../website && ruby modify_build.rb
|
cd ../website && ruby modify_build.rb
|
||||||
|
|
||||||
# Debug Stuff from now on
|
# Debug Stuff from now on
|
||||||
.PHONY: quick show_tools_version printvars
|
.PHONY: quick show_tools_version printvars
|
||||||
|
|
||||||
# Those 2 targets allow fast debug cycles but not reolvig refrences etc
|
# Those 2 targets allow fast debug cycles but not resolving references etc
|
||||||
quick: # run latex only once no biber, no references etc..
|
quick: # run latex only once no biber, no references etc...
|
||||||
$(LATEX) -e '$$max_repeat=1' -output-directory=book_serif book.tex
|
$(LATEX) -e '$$max_repeat=1' -output-directory=book_serif book.tex
|
||||||
|
|
||||||
quick_ebook: cover/cover-page.xbb # run latex only once no biber, refe etc..
|
quick_ebook: cover/cover-page.xbb # run latex only once no biber, ref etc...
|
||||||
$(EBOOK) --mode draft -f epub book.tex
|
$(EBOOK) --mode draft -f epub book.tex
|
||||||
|
|
||||||
show_tools_version: # Show version of tools used on the build machine
|
show_tools_version: # Show version of tools used on the build machine
|
||||||
@@ -281,6 +313,10 @@ show_tools_version: # Show version of tools used on the build machine
|
|||||||
@echo ""
|
@echo ""
|
||||||
- ruby --version
|
- ruby --version
|
||||||
@echo ""
|
@echo ""
|
||||||
|
- convert --version
|
||||||
|
@echo ""
|
||||||
|
- rsync --version
|
||||||
|
|
||||||
|
|
||||||
# You can find the value of variable X with the following command:
|
# You can find the value of variable X with the following command:
|
||||||
# make print-X
|
# make print-X
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ website: mrproper
|
|||||||
|
|
||||||
.PHONY: validate
|
.PHONY: validate
|
||||||
validate: mrproper
|
validate: mrproper
|
||||||
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_serif_ebook"
|
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_ebook"
|
||||||
|
|
||||||
.PHONY: mrproper
|
.PHONY: mrproper
|
||||||
mrproper:
|
mrproper:
|
||||||
|
|||||||
Reference in New Issue
Block a user