3 AONROOTREL := ../../../
4 AONROOTDIR = $(realpath $(AONROOTREL))
5 # Base directory we will install into
6 INSTALLDIR := $(AONROOTDIR)/../PUBLISH/$(BLANG)/
7 # Relative location of the XML files
8 RELXMLDIR := $(AONROOTDIR)/$(BLANG)/xml/
9 # Relative location of the scripts
10 RELSCRIPT := $(AONROOTDIR)/common/scripts
11 # Relative location of the xsl files
12 RELXSLDIR := $(AONROOTDIR)/common/xsl
13 EPUBSCRIPT := $(RELSCRIPT)/gbtoepub.pl
14 COVERIMAGE := $(AONROOTDIR)/$(BLANG)/jpeg/$(SERIES)/$(BASENAME)/skins/ebook/cover.jpg
16 # -------------------------------- BEGIN FONT SELECTION -----------------------------------------------------------
17 # Location of the font files, this is adjustable here in order to make it possible to run
18 # the build scripts as not all developers might have the Souvernir fonts.
20 # Option 1 (to be used for official builds) - Souvenir font
21 # ---------------------------------------------------------
22 # Use this when using Souvenir fonts and make sure the font is available in the directory you configure here.
23 # Note that the fontfiles are *not* available in Project Aon's SVN repository as they are not under
26 # If using this configure, please make sure the following fonts are available in this directory:
27 # SouvenirStd-DemiItalic.otf SouvenirStd-Demi.otf SouvenirStd-LightItalic.otf SouvenirStd-Light.otf
29 # FONTDIR := $(AONROOTDIR)/../fontfiles/
31 # Option 2 (to be used for test builds) - Carlito font
32 # ---------------------------------------------------------
33 # Use this when running test builds and you do not have the Souvenir font available.
34 # This will build the documents using the fonts available in the SVN repository which
35 # (at the time of this writting) are the Carlito font, which is distributed with an Open Font license.
37 FONTDIR := $(AONROOTDIR)/common/fonts/
39 # --------------------------------- END FONT SELECTION -----------------------------------------------------------
46 EBOOKS=$(EPUB) $(MOBI) $(PDB) $(LRF) $(FB2)
47 # To build only epub books:
50 # Formats we are compiling to
51 FORMATS=$(subst $(BASENAME).,,$(EBOOKS))
58 XMLFILE=$(patsubst %.epub,$(RELXMLDIR)/%.xml,$(BOOK))
60 # XSL files the ePubs depend on. If these are modified the
61 # ePub file needs to be regenerated
62 XSLFILES=$(RELXSLDIR)/epub-opf-metadata.xsl $(RELXSLDIR)/epub-xhtml.xsl \
63 $(RELXSLDIR)/epub-ncx.xsl $(RELXSLDIR)/epub-opf-spine.xsl
65 # Generate the ePub file from the XML file
67 $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB): $(XMLFILE) $(EPUBSCRIPT) $(XSLFILES)
68 cd $(AONROOTDIR) && perl $(EPUBSCRIPT) --language=$(BLANG) --font-files=$(FONTDIR) $(BASENAME)
70 $(EPUB): $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB)
71 cp -p $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/$(EPUB) .
72 # Regenerate to include the covers properly within the Ebook and fix the EPUB
73 ebook-convert $(EPUB) regen_$(EPUB) --cover $(COVERIMAGE)
74 mv regen_$(EPUB) $(EPUB)
75 -rm -f cover.jpg $(BASENAME).opf
78 # Convert to other formats. For a full list of format that we can convert to using
79 # Calibre see http://manual.calibre-ebook.com/cli/ebook-convert.html
81 # Generate the mobi file from the ePub (Mobipocket format)
86 # Generate the pdb file from the ePub (eReader / Palm Media format)
90 # Generate the lrf file from the ePub (Broadband eBooks (BBeB) format)
94 # Generate the lit file from the ePub (Microsoft LIT format for Microsoft Reader)
98 # Generate the pdf file from the ePub
102 # Generate the snb file from the ePub
106 # Generate the pml file from the ePub
110 # Generate the fb2 file from the ePub (Fictionbook format used by BeBook, PocketBook, Cybook, Papyre and others)
115 # Alternative build for the ePub format using open source tools instead
118 #DOCBOOK_XSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/epub/docbook.xsl
119 #$(BOOK): $(XMLFILE) $(DOCBOOK_XSL)
120 # if [ -x /usr/bin/dbtoepub ] ; then \
121 # dbtoepub -o $(BOOK) $(XMLFILE) >$(BOOK).log 2>&1; \
123 # xsltproc $(DOCBOOK_XSL) $< >$(BOOK).log 2>&1; \
124 # echo "application/epub+zip" > mimetype ; \
125 # zip -0Xq $@ mimetype; \
126 # zip -Xr9D $@ META-INF/* OEBPS/* ; \
129 # Embed font in dbtoepub using -f
132 java -jar epubcheck.jar $<
135 # Final installation step of generate ebooks
136 install: $(INSTALLDIR) $(EBOOKS)
137 @for format in $(FORMATS); do \
138 PUBLISHDIR="$(INSTALLDIR)/$$format/$(SERIES)" ; \
139 file=$(BASENAME).$$format ; \
140 [ ! -e "$$PUBLISHDIR" ] && \
141 mkdir -p "$$PUBLISHDIR" ; \
142 echo "Copying $$file to $$PUBLISHDIR" ; \
143 cp -p $$file $$PUBLISHDIR && \
144 chmod 664 $$PUBLISHDIR/$$file ; \
152 -rm -f $(EBOOKS) $(EPUB).log regen_$(EPUB) cover.jpg $(BASENAME).opf
155 -rm -rf $(AONROOTDIR)/$(BLANG)/epub/$(SERIES)/$(BASENAME)/
157 .PHONY: all install publish clean distclean epub mobi