X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fepub%2FMakefile.common;h=633416fd7f7abf56c494677f820f6ec90099ea94;hp=66201daefee7016d13b38fd8cb79387c4aa2aed1;hb=0cf6555c4e596a4b07eccb406d8dd3d2d8e116e0;hpb=0dc16339f5c6a05f1e5fa0fea65debf6e633d3f9 diff --git a/common/epub/Makefile.common b/common/epub/Makefile.common index 66201da..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,14 +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) +$(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