Skip to content

Commit 71f9ed1

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 c6d53d0 commit 71f9ed1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

book/makefile

Lines changed: 13 additions & 10 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
###################################

0 commit comments

Comments
 (0)