mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-11-18 09:01:12 -06:00
Simplify and fix spelling mistakes in makefile
- Factorize PHONY targets - Add comments
This commit is contained in:
@@ -6,7 +6,7 @@ CLEAN := latexmk -cd -lualatex -c -use-make
|
||||
CHECK_1 := lacheck
|
||||
CHECK_2 := chktex
|
||||
|
||||
# we want bash as shell
|
||||
# We want bash as shell
|
||||
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
||||
else echo sh; fi; fi)
|
||||
@@ -48,8 +48,8 @@ ruby_pkg := ../website/Gemfile ../website/Gemfile.lock
|
||||
|
||||
tgt_figures := $(patsubst %.tex, %.png,$(src_figures))
|
||||
|
||||
# Default target is not all becuse most of the time we just want a pdf...
|
||||
# ebook take a long time to build.
|
||||
# Default target is not all because most of the time we just want a pdf...
|
||||
# and ebook take a long time to build.
|
||||
.DEFAULT_GOAL := build_serif_pdf
|
||||
|
||||
# Default rules for pdf and ebooks, getting overwritten when built in a
|
||||
@@ -133,27 +133,25 @@ help:
|
||||
@echo "set DEBUG i.e make DEBUG=1 build_ebook to add debug flags to commands"
|
||||
|
||||
|
||||
# Finally project specif targets
|
||||
.PHONY: build_pdf
|
||||
# Finally actual project targets (i.e. build pdf and ebooks)
|
||||
.PHONY: build_pdf build_serif_pdf build_sans_serif_pdf build_ebook
|
||||
|
||||
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: epub/book.epub | make_release_dir
|
||||
|
||||
.PHONY: export_figures
|
||||
|
||||
.PHONY: export_figures check
|
||||
# Requires that you have docker running on your computer.
|
||||
export_figures: build_pdf $(tgt_figures)
|
||||
cd figures/ && bash export_figures.sh
|
||||
|
||||
# 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
|
||||
PHONY: check
|
||||
check: $(SRC_TEX)
|
||||
@echo "Running: " $(CHECK_1)
|
||||
$(CHECK_1) book.tex
|
||||
@@ -161,7 +159,9 @@ check: $(SRC_TEX)
|
||||
@echo "Running: " $(CHECK_2)
|
||||
$(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) $(patsubst %.tex, %.png.in, $(src_figures))
|
||||
- rm $(patsubst %.tex, %.png.pdf, $(src_figures))
|
||||
@@ -169,7 +169,6 @@ clean_figures:
|
||||
- rm $(wildcard figures/*.png.*)
|
||||
- rm cover/cover-page.xbb
|
||||
|
||||
.PHONY: clean_ebook_build
|
||||
clean_ebook_build:
|
||||
-rm book*.{4ct,4tc,aux,bbl,bcf,blg,dvi,fdb_latexmk,fls,html}
|
||||
-rm book*.{idv,lg,loc,log,ncx,run.xml,tmp,xref}
|
||||
@@ -177,13 +176,11 @@ clean_ebook_build:
|
||||
-rm book.css
|
||||
-rm content.opf
|
||||
|
||||
.PHONY: clean_website_build
|
||||
clean_website_build: clean_ebook_build
|
||||
-rm book-*.svg
|
||||
-rm book.{loc,dlog}
|
||||
-rm $(subst $(website_dir)/,, $(wildcard $(website_dir)/*.html))
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean_ebook_build clean_figures clean_website_build
|
||||
$(CLEAN) -output-directory=book_serif book.tex
|
||||
$(CLEAN) -output-directory=book_sans_serif book_sans_serif.tex
|
||||
@@ -192,7 +189,6 @@ clean: clean_ebook_build clean_figures clean_website_build
|
||||
-rm -rf book*-epub/OEBPS
|
||||
-rm book*-epub/mimetype
|
||||
|
||||
.PHONY: mrproper
|
||||
mrproper: clean
|
||||
$(CLEAN) -C $(src_figures)
|
||||
$(CLEAN) -C -output-directory=book_serif book.tex
|
||||
@@ -207,27 +203,26 @@ mrproper: clean
|
||||
-rm -rf book-epub/
|
||||
-rm -rf $(website_dir)
|
||||
|
||||
.PHONY: bake
|
||||
# top level releases rules
|
||||
.PHONY: bake make_release_dir release_serif release_sans_serif
|
||||
|
||||
bake: release_serif release_sans_serif
|
||||
|
||||
.PHONY: make_release_dir
|
||||
make_release_dir:
|
||||
mkdir -p release
|
||||
|
||||
.PHONY: release_serif
|
||||
release_serif: build_serif_pdf build_ebook | make_release_dir
|
||||
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
||||
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
||||
|
||||
.PHONY: release_sans_serif
|
||||
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
|
||||
|
||||
# Website stuff
|
||||
.PHONY: html website
|
||||
$(website_dir)/book.html: $(website_src) cover/cover-page.xbb
|
||||
$(WEBSITE) -d $(website_dir) book.tex
|
||||
|
||||
.PHONY: html
|
||||
html: $(website_dir)/book.html
|
||||
cp $< $(website_dir)/index.html
|
||||
|
||||
@@ -239,18 +234,17 @@ html: $(website_dir)/book.html
|
||||
touch ../website/$@
|
||||
|
||||
# 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)
|
||||
cd ../website && ruby modify_build.rb
|
||||
|
||||
# Debug Stuff from now on
|
||||
.PHONY: quick show_tools_version printvars
|
||||
|
||||
# Those 2 targets allow fast debug cycles but not reolvig refrences etc
|
||||
quick: # run latex only once no biber, no references etc..
|
||||
# Those 2 targets allow fast debug cycles but not resolving references etc
|
||||
quick: # run latex only once no biber, no references etc...
|
||||
$(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
|
||||
|
||||
show_tools_version: # Show version of tools used on the build machine
|
||||
|
||||
Reference in New Issue
Block a user