mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-11-15 07:31:11 -06:00
Makefile bugs fix and debug info (#124)
* Update .gitignore
Hide the svg file created during ebook builds and the new directories
after makefile changes
* Fix a makefile variable that stayed in uppercase
* Do not clean ebook systematically anymore
Should be fixed with new way to build ebooks
* Add rule showing version of tools on build machine
This helps with debugging on another machine.. or a build server.
* Add figures/vars.tex to the list of dependencies
Was missing...
* Add a makefile variable print facility
Quite a neat trick, avoids having to add it manually when you debug
* Add a target to print all variables in the makefile
* Fix the src_tables target
typos one s too many...
* Add a makefile variable to run tools in debug mode
Only ebook for now.
* Make default build the serif version of pdf
This is what the documentation said but both serif and sans were built
* Explicit serif in makefile and flattens rules
We had default (serif) and sans, better we have target named after their
fonts family
Flatten them as well so we can build ebooks or sans serif only as we
wish.
Simplified rules tree before:
-----------------------------
all/ bake
release_serif
build_pdf
build_serif_pdf
book_serif/book.pdf
build_sans_serif_pdf
book_sans_serif/book_sans_serif.pdf
build_ebook
build_serif_ebook
epub/book.epub
epub/book.mobi
epub/book.azw3
build_sans_serif_ebook
epub/book_sans_serif.epub
epub/book_sans_serif.mobi
epub/book_sans_serif.azw3
release_sans_serif
build_sans_serif_pdf
book_sans_serif/book_sans_serif.pdf
build_sans_serif_ebook
epub/book_sans_serif.epub
epub/book_sans_serif.mobi
epub/book_sans_serif.azw3
Simplified rules tree now:
--------------------------
all: bake
bake:
release_serif
build_serif_pdf
book_serif/book.pdf
build_serif_ebook:
epub/book.epub
epub/book.mobi
epub/book.azw3
release_sans_serif
build_sans_serif_pdf
book_sans_serif/book_sans_serif.pdf
build_sans_serif_ebook
epub/book_sans_serif.epub
epub/book_sans_serif.mobi
epub/book_sans_serif.azw3
build_pdf:
build_serif_pdf
build_sans_serif_pdf
build_ebook:
build_serif_ebook
build_sans_serif_ebook
release_serif:
build_serif_pdf
build_serif_ebook
release_sans_serif:
build_sans_serif_pdf
build_sans_serif_ebook
* Explicit the dependency on TikZ figures
latexmk figured that out but better if makefile is aware of it as well
This commit is contained in:
46
.gitignore
vendored
46
.gitignore
vendored
@@ -22,33 +22,35 @@ book/figures/*.pdf
|
||||
book/tables/*.png
|
||||
book/tables/*.pdf
|
||||
book/release/*
|
||||
book/book.4ct
|
||||
book/book.4tc
|
||||
book/book.aux
|
||||
book/book.bbl
|
||||
book/book.bcf
|
||||
book/book.blg
|
||||
book/book.css
|
||||
book/book.dvi
|
||||
book/book.html
|
||||
book/book.idv
|
||||
book/book.lg
|
||||
book/book.log
|
||||
book/book.mobi
|
||||
book/book.azw3
|
||||
book/book.epub
|
||||
book/book.ncx
|
||||
book/book.out
|
||||
book/book.pdf
|
||||
book/book.run.xml
|
||||
book/book.tmp
|
||||
book/book.toc
|
||||
book/book.xref
|
||||
book/book*.4ct
|
||||
book/book*.4tc
|
||||
book/book*.aux
|
||||
book/book*.bbl
|
||||
book/book*.bcf
|
||||
book/book*.blg
|
||||
book/book*.css
|
||||
book/book*.dvi
|
||||
book/book*.html
|
||||
book/book*.idv
|
||||
book/book*.lg
|
||||
book/book*.log
|
||||
book/book*.mobi
|
||||
book/book*.azw3
|
||||
book/book*.epub
|
||||
book/book*.ncx
|
||||
book/book*.out
|
||||
book/book*.pdf
|
||||
book/book*.run.xml
|
||||
book/book*.tmp
|
||||
book/book*.toc
|
||||
book/book*.xref
|
||||
book/book*.html
|
||||
book/book*.svg
|
||||
book/book-epub/
|
||||
book/book-mobi/
|
||||
book/book-azw3/
|
||||
*.bak
|
||||
book_sans_serif/
|
||||
book_serif/
|
||||
release_sans_serif/
|
||||
*.opf
|
||||
|
||||
@@ -6,16 +6,20 @@ EBOOK_CONVERT := kindlegen
|
||||
CHECK_1 := lacheck
|
||||
CHECK_2 := chktex
|
||||
|
||||
ifdef DEBUG
|
||||
EBOOK += -a debug
|
||||
endif
|
||||
|
||||
# List all files that are dependencies
|
||||
chapters = baking basics bread-types flour-types history intro\
|
||||
non-wheat-sourdough sourdough-starter storing-bread troubleshooting\
|
||||
wheat-sourdough
|
||||
|
||||
src_tables := $(wildcard tables/tables-*.tex)
|
||||
src_tables := $(wildcard tables/table-*.tex)
|
||||
src_figures := $(wildcard figures/fig-*.tex)
|
||||
|
||||
src_tex := $(foreach directory, $(chapters), $(wildcard $(directory)/*.tex))
|
||||
src_tex += book.tex book_sans_serif.tex references.bib
|
||||
src_tex += book.tex book_sans_serif.tex references.bib figures/vars.tex
|
||||
|
||||
images := $(wildcard images/*/*.jpg)
|
||||
images += $(wildcard images/*/*.png)
|
||||
@@ -30,13 +34,13 @@ src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(imag
|
||||
%.pdf: %.tex
|
||||
$(LATEX) $<
|
||||
|
||||
book_serif/book.pdf: clean_ebook_build $(SRC_ALL)
|
||||
book_serif/book.pdf: $(src_all) $(tgt_figures)
|
||||
$(LATEX) -output-directory=book_serif book.tex
|
||||
|
||||
book_sans_serif/book_sans_serif.pdf: clean_ebook_build $(SRC_ALL)
|
||||
book_sans_serif/book_sans_serif.pdf: $(src_all) $(tgt_figures)
|
||||
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
||||
|
||||
epub/%.epub: %.tex $(src_all)
|
||||
epub/%.epub: %.tex $(src_all) $(tgt_figures)
|
||||
$(EBOOK) -f epub $<
|
||||
|
||||
epub/%.mobi: epub/%.epub
|
||||
@@ -48,7 +52,7 @@ epub/%.azw3: epub/%.epub
|
||||
# Now with the rules
|
||||
# Expected usual rules first
|
||||
.PHONY: default
|
||||
default: build_pdf
|
||||
default: build_serif_pdf
|
||||
|
||||
.PHONY: all
|
||||
all: bake
|
||||
@@ -61,7 +65,6 @@ help:
|
||||
@echo "all: pdf and ebooks serif and sans-serif accessible version, same as"
|
||||
@echo " build release"
|
||||
@echo "bake: same as build all"
|
||||
@echo "release_default: same as build all"
|
||||
@echo ""
|
||||
@echo "check: runs static analysis checker on LaTeX source to spot"
|
||||
@echo " programming or typographic mistakes"
|
||||
@@ -71,12 +74,29 @@ help:
|
||||
@echo "clean_figures: delete intermediate TikZ files"
|
||||
@echo ""
|
||||
@echo "build_ebook: builds only the ebook serif and accessible version"
|
||||
@echo "build_pdf:builds both serif and accessible pdf"
|
||||
@echo "build_pdf: builds both serif and accessible pdf"
|
||||
@echo ""
|
||||
@echo "build_sans_serif_ebook: build accessible ebook only"
|
||||
@echo "build_sans_serif_pdf: build accessible pdf only"
|
||||
@echo ""
|
||||
@echo "build_serif_ebook: build serif ebook only"
|
||||
@echo "build_serif_pdf: build serif pdf only"
|
||||
@echo ""
|
||||
@echo "figures: build TikZ figures"
|
||||
@echo ""
|
||||
@echo "release_serif: build serif only version of pdf and ebooks"
|
||||
@echo "release_sans_serif: build sans-serif/accessible version of pdf and ebooks"
|
||||
@echo ""
|
||||
@echo "Debug targets:"
|
||||
@echo ""
|
||||
@echo "show_tools_version: Show version of tools used on the build machine"
|
||||
@echo ""
|
||||
@echo "print-X: print makefile variable X"
|
||||
@echo ""
|
||||
@echo "printvars: print all variables in the makefile"
|
||||
@echo ""
|
||||
@echo "set DEBUG i.e make DEBUG=1 build_ebook to add debug flags to commands"
|
||||
|
||||
|
||||
# Finally project specif targets
|
||||
.PHONY: build_pdf
|
||||
@@ -170,14 +190,14 @@ mrproper: clean
|
||||
rm -rf book_sans_serif-epub/
|
||||
|
||||
.PHONY: bake
|
||||
bake: release_default release_sans_serif
|
||||
bake: release_serif release_sans_serif
|
||||
|
||||
.PHONY: make_release_dir
|
||||
make_release_dir:
|
||||
mkdir -p release
|
||||
|
||||
.PHONY: release_default
|
||||
release_default: build_pdf build_ebook | make_release_dir
|
||||
.PHONY: release_serif
|
||||
release_serif: build_serif_pdf build_serif_ebook | make_release_dir
|
||||
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
||||
cp epub/book.mobi release/TheBreadCode-The-Sourdough-Framework.mobi
|
||||
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
||||
@@ -189,3 +209,35 @@ release_sans_serif: build_sans_serif_pdf build_sans_serif_ebook | make_release_d
|
||||
cp epub/book_sans_serif.mobi release/TheBreadCode-The-Sourdough-Framework-sans-serif.mobi
|
||||
cp epub/book_sans_serif.epub release/TheBreadCode-The-Sourdough-Framework-sans-serif.epub
|
||||
cp epub/book_sans_serif.azw3 release/TheBreadCode-The-Sourdough-Framework-sans-serif.azw3
|
||||
|
||||
# Debug Stuff from now on
|
||||
.PHONY: show_tools_version
|
||||
show_tools_version: # Show version of tools used on the build machine
|
||||
- latexmk --version
|
||||
@echo ""
|
||||
- pdflatex --version
|
||||
@echo ""
|
||||
- tex4ebook --version
|
||||
@echo ""
|
||||
- make4ht --version
|
||||
@echo ""
|
||||
- tidy -version
|
||||
@echo ""
|
||||
- kindlegen --version
|
||||
@echo ""
|
||||
- lacheck --version
|
||||
@echo ""
|
||||
- chktex --version
|
||||
@echo ""
|
||||
- make --version
|
||||
@echo ""
|
||||
|
||||
# You can find the value of variable X with the following command:
|
||||
# make print-X
|
||||
print-%: ; @echo $* = $($*) # Print a makefile variable
|
||||
|
||||
.PHONY: printvars
|
||||
printvars: # Print all variables in the makefile
|
||||
@$(foreach V,$(sort $(.VARIABLES)), \
|
||||
$(if $(filter-out environ% default automatic, \
|
||||
$(origin $V)),$(info $V=$($V) ($(value $V)))))
|
||||
|
||||
Reference in New Issue
Block a user