X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fepub%2FMakefile.common;h=633416fd7f7abf56c494677f820f6ec90099ea94;hp=4f3e86e6e6196aed480b07e1990bb2f8a4d2adea;hb=600bebceef75b28a2e0a4723e09df73c179d66a8;hpb=21291e79cf4e2ef8abf1dd35f3a32c8d87c087cc diff --git a/common/epub/Makefile.common b/common/epub/Makefile.common index 4f3e86e..633416f 100644 --- a/common/epub/Makefile.common +++ b/common/epub/Makefile.common @@ -11,7 +11,9 @@ RELSCRIPT := $(AONROOTDIR)/common/scripts # Relative location of the xsl files RELXSLDIR := $(AONROOTDIR)/common/xsl EPUBSCRIPT := $(RELSCRIPT)/gbtoepub.pl +COVERSCRIPT := $(RELSCRIPT)/create-epub-cover.pl COVERIMAGE := $(AONROOTDIR)/$(BLANG)/jpeg/$(SERIES)/$(BASENAME)/skins/ebook/cover.jpg +ALTCOVERIMAGE := $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/OEBPS/cover.jpg # -------------------------------- BEGIN FONT SELECTION ----------------------------------------------------------- # Location of the font files, this is adjustable here in order to make it possible to run @@ -30,6 +32,9 @@ COVERIMAGE := $(AONROOTDIR)/$(BLANG)/jpeg/$(SERIES)/$(BASENAME)/skins/ebook/cove ifeq ($(SERIES), lw) FONTDIR := $(AONROOTDIR)/../fontfiles/ endif +ifeq ($(SERIES), ls) +FONTDIR := $(AONROOTDIR)/../fontfiles/ +endif ifeq ($(SERIES), gs) FONTDIR := $(AONROOTDIR)/../fontfiles/ endif @@ -89,13 +94,27 @@ XSLFILES=$(RELXSLDIR)/epub-opf-metadata.xsl $(RELXSLDIR)/epub-xhtml.xsl \ # Generate the ePub file from the XML file epub: $(EPUB) -$(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB): $(XMLFILE) $(EPUBSCRIPT) $(XSLFILES) +$(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB): $(XMLFILE) $(XSLFILES) cd $(AONROOTDIR) && perl $(EPUBSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME) +# Create cover page if not existing + @if [ ! -e $(COVERIMAGE) ] ; then \ + cd $(AONROOTDIR) && perl $(COVERSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME) ; \ + fi -$(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) ebook-convert +$(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) + @if [ -e $(ALTCOVERIMAGE) ] && [ ! -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) --cover $(ALTCOVERIMAGE) ; \ + fi + @if [ -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) --cover $(COVERIMAGE) ; \ + fi + @if [ ! -e $(ALTCOVERIMAGE) ] && [ ! -e $(COVERIMAGE) ] ; then \ + ebook-convert $(EPUB) regen_$(EPUB) ; \ + fi + mv regen_$(EPUB) $(EPUB) -rm -f cover.jpg $(BASENAME).opf @@ -103,40 +122,45 @@ $(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) ebook-convert # Convert to other formats. For a full list of format that we can convert to using # Calibre see http://manual.calibre-ebook.com/cli/ebook-convert.html -ebook-convert: - @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; } - # Generate the mobi file from the ePub (Mobipocket format) mobi: $(MOBI) -%.mobi: %.epub ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.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 ebook-convert +%.fb2: %.epub + @[ -x `which ebook-convert` ] || { echo "ERROR: Cannot find 'ebook-convert', please install Calibre" >&2; exit 1; } ebook-convert $< $@