Skip to content

Commit 5d2c791

Browse files
committed
Fix epub build and remove redudant mkdir calls
1) ebook was still using the old target 2) Do not call mkdir -p for every single image conversion
1 parent 19df154 commit 5d2c791

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

book/makefile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ website_dir := static_website_html
8383
website_assets := $(wildcard ../website/assets/*)
8484
ruby_src := ../website/modify_build.rb $(website_assets)
8585
ruby_pkg := ../website/Gemfile ../website/Gemfile.lock
86-
#}}}
86+
# }}}
8787

8888
# Internal build rules {{{
8989
# Flowcharts {{{
@@ -118,7 +118,7 @@ book_sans_serif/book_sans_serif.pdf: $(src_all)
118118
epub/%.epub: %.tex $(ebook_src) cover/cover-page.xbb
119119
$(EBOOK) $<
120120

121-
copy_ebook_files: build_ebook
121+
copy_ebook_files: ebook
122122
$(RSYNC) --exclude '*.png' epub_build/book-epub/ bw-book-epub/
123123

124124
# Now that we have built the ebook we will generate 2 more versions
@@ -130,30 +130,33 @@ copy_ebook_files: build_ebook
130130

131131
# We do not convert SVG to B&W or lower res for now as they are super small
132132
# anyway
133-
bw-book-epub/OEBPS/%.jpg: %.jpg
134-
mkdir -p $(dir $@)
133+
bw-book-epub-dir:
134+
mkdir -p bw-book-epub/OEBPS
135+
136+
bw-book-epub/OEBPS/%.jpg: %.jpg | bw-book-epub-dir
135137
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
136138

137-
bw-book-epub/OEBPS/%.png: %.png
138-
mkdir -p $(dir $@)
139+
bw-book-epub/OEBPS/%.png: %.png | bw-book-epub-dir
139140
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
140141

141142
epub/bw_book.epub: copy_ebook_files $(bw_images)
142143
cd bw-book-epub; zip -q0X ../epub/bw_book.epub mimetype
143144
cd bw-book-epub; zip -q9XrD ../epub/bw_book.epub ./
144145

145-
# Now the low res
146+
# Now the low res | low-res-book-epub-dir
147+
low-res-book-epub-dir:
148+
mkdir -p low-res-book-epub/OEBPS
149+
146150
copy_ebook_files_low_res: ebook
147151
$(RSYNC) epub_build/book-epub/ low-res-book-epub/
148152

149-
low-res-book-epub/OEBPS/%.jpg: %.jpg
150-
mkdir -p $(dir $@)
153+
low-res-book-epub/OEBPS/%.jpg: %.jpg | low-res-book-epub-dir
151154
$(CONVERT_PIC) $< $(REDUCE_PIC_COLOR) $@
152155

153156
epub/low_res_book.epub: copy_ebook_files_low_res $(low_res_images)
154157
cd low-res-book-epub; zip -q0X ../epub/low_res_book.epub mimetype
155158
cd low-res-book-epub; zip -q9XrD ../epub/low_res_book.epub ./
156-
#}}}
159+
# }}}
157160

158161
# Website {{{
159162
###################################
@@ -186,7 +189,7 @@ export_figures: pdf $(tgt_figures)
186189
# }}}
187190

188191
# User level targets {{{
189-
# Build targets{{{
192+
# Build targets {{{
190193
.PHONY: all
191194
all: bake
192195

@@ -200,9 +203,9 @@ sans_serif: book_sans_serif/book_sans_serif.pdf
200203
ebook: epub/book.epub
201204
bw_ebook: epub/bw_book.epub
202205
low_res_ebook: epub/low_res_book.epub
203-
#}}}
206+
# }}}
204207

205-
# Old target names are disabled with helpful help message #{{{
208+
# Old target names are disabled with helpful help message {{{
206209
build_pdf:
207210
@echo "build_pdf target is not supported anymore, please use make pdf"
208211
@exit
@@ -221,7 +224,7 @@ build_bw_ebook:
221224
build_low_res_ebook:
222225
@echo "build_low_res_ebook target is not supported anymore, please use make low_res_ebook"
223226
@exit
224-
#}}}
227+
# }}}
225228

226229
# Top level releases rules {{{
227230
.PHONY: bake release_serif release_sans_serif
@@ -282,7 +285,7 @@ mrproper: clean
282285
-rm -rf book_serif/ book_sans_serif/
283286
-rm -rf epub/ epub_build/ bw-book-epub/ low-res-book-epub/
284287
-rm -rf website_build/ $(website_dir)
285-
#}}}
288+
# }}}
286289

287290
# Help {{{
288291
###################################

0 commit comments

Comments
 (0)