diff --git a/.gitignore b/.gitignore index d4b68f5..2c58e71 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/book/makefile b/book/makefile index b328d93..610240d 100644 --- a/book/makefile +++ b/book/makefile @@ -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)))))