mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-12-25 02:36:26 -06:00
* Make headrow in tables bold
* Simplify tables markup
- Markup is definitely simpler.
- Will not be built separately in a pdf anymore.
- Fixed some typo as well
- Relatively coherent look
- Can be better, some sizes are relatively arbitrary
* Remove horizontal separation inside tables
Not very nice if you ask me..
* Fix some tables for the ebook
The alignement trick to have nicely alignment on = sign or on unit (g)
used broke the html. Reverting to a less optimal version on pdf while
not breaking the html.
* Simplify table for html output
* Revert "Simplify table for html output"
This reverts commit f85d65adb7.
* Revert pancake table
This way it builds ebook correctly.
* Use latexmk and dedicated build_directory
- Generic rule for building pdf from tex
- build the book in its own directory
- do not clean before
* Make accessible pdf a command line option
* Simplify accessible version generation
using the option in book.tex instead of copying files around.
TODO: figures/Tkiz still are with serif.
* Specify some dependencies as order only
We don't want to trigger a rebuild everytime the directory timestamp
changes
* Remove force rebuild
* Fix dependencies handling
- Explicit some dependencies
- Ebook must be handled manually as we don't have latexmk working with
latexmk or not sure how to do it...
* Improve clean
- Use latexmk to clean where possible
- clean the sans-serif as well
- failing rm will output a non-stopping error now
* Cleanup and comment makefile
For clarity, also move things around
* Add an mrproper target
clean now only removes intermediate files, keeps pdf and ebook in there.
Mr proper will remove evrything
* Add dependency of figures for ebook
* Add default rules you expect
make will build the pdf
make all will build all
* Add a make help command
Gives list of useful targets and their action
* Use latexmk to build TikZ pictures
* Use latexmk for building ebooks
* Let latexmk handle dependencies
would get it wrong otherwise...
* Add rule for sans serif ebook
* Add dependencies on TikZ figures for ebooks
* add mk4 file for the sans_serif version of ebook
symlink to the other one as they should be the same.
* Reorder the makefile variables declaration
Looks like I did not fully understood how it works..
Also added some PHONY targets and comments
* Add missing actions in clean target
Some file got forgotten... clean the makefile as well.
* Split the clean in a clean ebook section
* Clean the ebook before building the pdf
Not idel but I have no idea how to have the intermediate files in
another directory with tex4ebook
205 lines
6.1 KiB
Makefile
205 lines
6.1 KiB
Makefile
# Macros for commands
|
|
LATEX := latexmk -cd -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make
|
|
EBOOK := tex4ebook -c tex4ebook.cfg
|
|
CLEAN := latexmk -cd -c -use-make
|
|
|
|
# List all files that are dependencies
|
|
SRC_FIGURES := $(wildcard figures/fig-*.tex)
|
|
# 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_FIGURES := $(wildcard figures/fig-*.tex)
|
|
|
|
SRC_TEX := $(foreach directory, $(CHAPTERS), $(wildcard $(directory)/*.tex))
|
|
SRC_TEX := $(SRC_TEX) book.tex book_sans_serif.tex references.bib
|
|
|
|
IMAGES := $(wildcard images/*/*.jpg)
|
|
IMAGES := $(IMAGES) $(wildcard images/*/*.png)
|
|
IMAGES := $(IMAGES) $(foreach directory, $(CHAPTERS), $(wildcard $(directory)/*.jpg))
|
|
IMAGES := $(IMAGES) $(foreach directory, $(CHAPTERS), $(wildcard $(directory)/*.png))
|
|
|
|
TGT_FIGURES := $(patsubst %.tex, %.pdf,$(SRC_FIGURES))
|
|
SRC_ALL := $(SRC_TEX) $(SRC_FIGURES) $(SRC_TABLES) tex4ebook.cfg book.mk4 $(IMAGES)
|
|
|
|
# Default rules for pdf and ebooks, getting overwritten when built in a
|
|
# sub-directory
|
|
%.pdf: %.tex
|
|
$(LATEX) $<
|
|
|
|
book_serif/book.pdf: clean_ebook_build $(SRC_ALL)
|
|
$(LATEX) -output-directory=book_serif book.tex
|
|
|
|
book_sans_serif/book_sans_serif.pdf: clean_ebook_build $(SRC_ALL)
|
|
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
|
|
|
book-epub/%.epub: %.tex $(SRC_ALL)
|
|
$(EBOOK) -f epub $<
|
|
|
|
book-mobi/%.mobi: %.tex $(SRC_ALL)
|
|
# not sure why, but I have to generate the mobi twice for the release
|
|
# command to properly work.
|
|
$(EBOOK) -f mobi $<
|
|
$(EBOOK) -f mobi $<
|
|
|
|
book-azw3/%.azw3: %.tex $(SRC_ALL)
|
|
$(EBOOK) -f azw3 $<
|
|
|
|
# Not sure if there is a better way with a wildcard?
|
|
book_sans_serif-epub/%.epub: %.tex $(SRC_ALL)
|
|
$(EBOOK) -f epub $<
|
|
|
|
book_sans_serif-mobi/%.mobi: %.tex $(SRC_ALL)
|
|
# not sure why, but I have to generate the mobi twice for the release
|
|
# command to properly work.
|
|
$(EBOOK) -f mobi $<
|
|
$(EBOOK) -f mobi $<
|
|
|
|
book_sans_serif-azw3/%.azw3: %.tex $(SRC_ALL)
|
|
$(EBOOK) -f azw3 $<
|
|
|
|
# Now with the rules
|
|
# Expected usual rules first
|
|
|
|
.PHONY: default
|
|
default: build_pdf
|
|
|
|
.PHONY: all
|
|
all: bake
|
|
|
|
.PHONY: help
|
|
help:
|
|
@echo ""
|
|
@echo "default: builds the book in pdf format (serif)"
|
|
@echo ""
|
|
@echo "all: pdf and ebooks serif and sans-serif accessible version, same as build release"
|
|
@echo "bake: same as build all"
|
|
@echo "release_default: same as build all"
|
|
@echo ""
|
|
@echo "clean: delete all intermediate files keep targets (pdf/ebook)"
|
|
@echo "mrproper: delete all generated files intermediate and pdf/ebooks"
|
|
@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 ""
|
|
@echo "build_sans_serif_ebook: build accessible ebook only"
|
|
@echo "build_sans_serif_pdf: build accessible pdf only"
|
|
@echo ""
|
|
@echo "figures: build TikZ figures"
|
|
|
|
# Finally project specif targets
|
|
.PHONY: build_pdf
|
|
build_pdf: build_serif_pdf build_sans_serif_pdf
|
|
|
|
.PHONY: build_serif_pdf
|
|
build_serif_pdf: book_serif/book.pdf
|
|
|
|
.PHONY: build_sans_serif_pdf
|
|
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
|
|
|
|
.PHONY: build_ebook
|
|
build_ebook: build_serif_ebook build_sans_serif_ebook
|
|
|
|
.PHONY: build_serif_ebook
|
|
build_serif_ebook: $(TGT_FIGURES) book-epub/book.epub book-mobi/book.mobi book-azw3/book.azw3 | make_release_dir
|
|
|
|
.PHONY: build_sans_serif_ebook
|
|
build_sans_serif_ebook: $(TGT_FIGURES) book_sans_serif-epub/book_sans_serif.epub \
|
|
book_sans_serif-mobi/book_sans_serif.mobi \
|
|
book_sans_serif-azw3/book_sans_serif.azw3 | make_release_dir
|
|
|
|
.PHONY: export_figures
|
|
# Requires that you have docker running on your computer.
|
|
export_figures:
|
|
cd figures/ && bash export_figures.sh
|
|
|
|
.PHONY: figures
|
|
figures: $(SRC_FIGURES)
|
|
$(LATEX) $<
|
|
|
|
.PHONY: clean_figures
|
|
clean_figures:
|
|
$(CLEAN) $(SRC_FIGURES)
|
|
|
|
.PHONY: clean_ebook_build
|
|
clean_ebook_build:
|
|
-rm book*.aux
|
|
-rm book*.run.xml
|
|
-rm book*.bcf
|
|
-rm book*.blg
|
|
-rm book*.log
|
|
-rm book*.4tc
|
|
-rm book*.4ct
|
|
-rm book*.dvi
|
|
-rm book*.epub
|
|
-rm book.css
|
|
-rm book_sans_serif.css
|
|
-rm book*.idv
|
|
-rm book*.lg
|
|
-rm book*.ncx
|
|
-rm book*.tmp
|
|
-rm book*.xref
|
|
-rm book*.html
|
|
-rm book*.fls
|
|
-rm book*.fdb_latexmk
|
|
-rm book*.bbl
|
|
-rm content.opf
|
|
|
|
.PHONY: clean
|
|
clean: clean_ebook_build clean_figures
|
|
$(CLEAN) -output-directory=book_serif book.tex
|
|
$(CLEAN) -output-directory=book_sans_serif book_sans_serif.tex
|
|
-rm book*/*.bbl
|
|
-rm book*/*.run.xml
|
|
-rm -rf book*-epub/META-INF
|
|
-rm -rf book*-epub/OEBPS
|
|
-rm book*-epub/mimetype
|
|
-rm -rf book*-mobi/META-INF
|
|
-rm -rf book*-mobi/OEBPS
|
|
-rm book*-mobi/mimetype
|
|
-rm book*-mobi/book.epub
|
|
-rm -rf book*-mobi/META-INF
|
|
-rm -rf book*-azw3/OEBPS
|
|
-rm -rf book*-azw3/META-INF
|
|
-rm book*-azw3/book.epub
|
|
-rm book*-azw3/mimetype
|
|
|
|
.PHONY: mrproper
|
|
mrproper: clean
|
|
$(CLEAN) -C $(SRC_FIGURES)
|
|
$(CLEAN) -C -output-directory=book_serif book.tex
|
|
$(CLEAN) -C -output-directory=book_sans_serif book_sans_serif.tex
|
|
-rm figures/*.pdf
|
|
-rm figures/*.png
|
|
rm -rf book*-mobi/
|
|
rm -rf book*-azw3/
|
|
rm -rf book*-epub/
|
|
rm -rf release/
|
|
rm -rf release/
|
|
rm -rf release_sans_serif/
|
|
rm -rf release_sans_serif/
|
|
|
|
.PHONY: bake
|
|
bake: release_default 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
|
|
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
|
cp book-mobi/book.mobi release/TheBreadCode-The-Sourdough-Framework.mobi
|
|
cp book-epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
|
cp book-azw3/book.azw3 release/TheBreadCode-The-Sourdough-Framework.azw3
|
|
|
|
.PHONY: release_sans_serif
|
|
release_sans_serif: build_sans_serif_pdf build_sans_serif_ebook | make_release_dir
|
|
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
|
cp book_sans_serif-mobi/book_sans_serif.mobi release/TheBreadCode-The-Sourdough-Framework-sans-serif.mobi
|
|
cp book_sans_serif-epub/book_sans_serif.epub release/TheBreadCode-The-Sourdough-Framework-sans-serif.epub
|
|
cp book_sans_serif-azw3/book_sans_serif.azw3 release/TheBreadCode-The-Sourdough-Framework-sans-serif.azw3
|