$(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB): $(XMLFILE) $(EPUBSCRIPT) $(XSLFILES)
cd $(AONROOTDIR) && perl $(EPUBSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME)
-$(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB)
+$(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB)
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
cp -p $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) .
# Regenerate to include the covers properly within the Ebook and fix the EPUB
ebook-convert $(EPUB) regen_$(EPUB) --cover $(COVERIMAGE)
# Generate the mobi file from the ePub (Mobipocket format)
mobi: $(MOBI)
%.mobi: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the pdb file from the ePub (eReader / Palm Media format)
%.pdb: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the lrf file from the ePub (Broadband eBooks (BBeB) format)
%.lrf: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the lit file from the ePub (Microsoft LIT format for Microsoft Reader)
%.lit: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the pdf file from the ePub
%.pdf: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the snb file from the ePub
%.snb: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the pml file from the ePub
%.pml: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Generate the fb2 file from the ePub (Fictionbook format used by BeBook, PocketBook, Cybook, Papyre and others)
-%.fb2: %.epub
+%.fb2: %.epub
+ @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; }
ebook-convert $< $@
# Alternative build for the ePub format using open source tools instead
-# of our script:
+# of our script.
+# Sample Makefile code:
#
#DOCBOOK_XSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/epub/docbook.xsl
-#$(BOOK): $(XMLFILE) $(DOCBOOK_XSL)
+#$(EPUB): $(XMLFILE) $(DOCBOOK_XSL)
+# @[ -x `which dbtoepub` ] || { echo "ERROR: Cannot find 'dbtoepub', please install this package" >&2; exit 1; }
# if [ -x /usr/bin/dbtoepub ] ; then \
-# dbtoepub -o $(BOOK) $(XMLFILE) >$(BOOK).log 2>&1; \
+# dbtoepub -o $(EPUB) $(XMLFILE) >$(BOOK).log 2>&1; \
# else \
# xsltproc $(DOCBOOK_XSL) $< >$(BOOK).log 2>&1; \
# echo "application/epub+zip" > mimetype ; \
distclean: clean
-rm -rf $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/
-.PHONY: all install publish clean distclean epub mobi
+.PHONY: all install publish clean distclean epub mobi ebook-convert