2016-01-04 16:55:20 +03:00
2014-04-25 14:43:08 +04:00
# based on https://github.com/jhradilek/publican-makefile 87dc33d7e1
2009-10-22 10:13:30 +04:00
2014-04-25 14:43:08 +04:00
# General settings; change the path to the publican executable, the lang-
# uage in which the document is authored, the default configuration file,
# or the main file of your DocBook project:
PUBLICAN = publican
LANGUAGE = ru-RU
CONFIG = publican.cfg
MAINFILE = $( if $( findstring Book_Info.xml, $( wildcard $( XML_LANG) /*.xml) ) ,Book,Article) _Info.xml
# Known file extensions:
FILEEXTS = XML xml ENT ent PO po
IMAGEEXTS = BMP bmp CGM cgm DVI dvi EPS eps EQN eqn FAX fax GIF gif IGS \
igs PCX pcx PDF pdf PIC pic PNG png SVG svg SWF swf TLB tbl \
TEX tex WMF wmf WPG wpg PS ps SGML sgml TIFF tiff
# Known directories:
FILEDIR := $( LANGUAGE)
BUILDDIR := tmp/$( LANGUAGE)
2014-05-12 15:07:53 +04:00
PROJECT = doc
2014-04-25 14:43:08 +04:00
#docdir = /usr/local/share/doc/$(PROJECT)
docdir = /tmp/$( PROJECT)
2009-10-22 10:13:30 +04:00
DESTDIR =
2009-10-22 13:02:17 +04:00
INSTALL = install
INSTALL_DATA = $( INSTALL) -m 644
2014-04-25 14:43:08 +04:00
# Essential prerequisites:
ALL := $( shell find ru-RU \( -name '.*' -prune \) -o -type f -print)
FILES := $( foreach ext, $( FILEEXTS) , $( filter %.$( ext) , $( ALL) ) )
IMAGES := $( foreach ext, $( IMAGEEXTS) , $( filter %.$( ext) , $( ALL) ) )
# Helper functions:
getoption = $( shell ( grep -qe '^[ \t]*$(1):' $( CONFIG) && sed -ne 's/^[ \t]*$(1):[ \t]*"\?\([a-zA-Z0-9._ -]\+\).*/\1/p' $( CONFIG) || sed -ne 's/^.*<$(2)>\(.\+\)<\/$(2)>.*/\1/ip' $( XML_LANG) /$( MAINFILE) ) | sed -e 's/[ \t]*$$//' )
# Helper variables:
EMPTY :=
SPACE := $( EMPTY) $( EMPTY)
XML_LANG := $( subst $( SPACE) ,_,$( call getoption,xml_lang,NULL) )
# The following are the make rules. Do not edit the rules unless you really
# know what you are doing:
.PHONY : html -single
html-single : $( BUILDDIR ) /html -single
.PHONY : html -desktop
html-desktop : $( BUILDDIR ) /html -desktop
.PHONY : html
html : $( BUILDDIR ) /html
.PHONY : epub
epub : $( BUILDDIR ) /epub
.PHONY : pdf
pdf : $( BUILDDIR ) /pdf
2009-10-22 13:02:17 +04:00
2014-04-25 14:43:08 +04:00
.PHONY : txt
txt : $( BUILDDIR ) /txt
.PHONY : all
all : html -desktop html -single html epub pdf txt
install : html -single $( wildcard html -desktop )
2014-05-12 15:08:31 +04:00
$( INSTALL) -d $( DESTDIR) $( docdir) /ru-RU/Common_Content/css/
$( INSTALL) -d $( DESTDIR) $( docdir) /ru-RU/Common_Content/images/
$( INSTALL) -d $( DESTDIR) $( docdir) /ru-RU/images/
$( INSTALL_DATA) publish/home/ru-RU/Common_Content/css/* $( DESTDIR) $( docdir) /ru-RU/Common_Content/css/
$( INSTALL_DATA) publish/home/ru-RU/Common_Content/images/* $( DESTDIR) $( docdir) /ru-RU/Common_Content/images/
$( INSTALL_DATA) publish/home/ru-RU/images/* $( DESTDIR) $( docdir) /ru-RU/images/
$( INSTALL_DATA) publish/home/ru-RU/splash.html $( DESTDIR) $( docdir) /ru-RU/index.html
$( INSTALL_DATA) index.html $( DESTDIR) $( docdir) /
2014-04-25 14:43:08 +04:00
.PHONY : clean
2009-10-22 13:02:17 +04:00
clean :
2014-04-25 14:43:08 +04:00
$( PUBLICAN) clean
.PHONY : test
test : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats test
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/html-desktop : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats html-desktop --publish && touch $@
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/html-single : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats html-single --publish && touch $@
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/html : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats html --publish && touch $@
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/epub : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats epub && touch $@
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/pdf : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats pdf && touch $@
2014-04-25 14:43:08 +04:00
$(BUILDDIR)/txt : $( FILES ) $( IMAGES ) $( CONFIG )
2016-03-02 14:17:56 +03:00
$( PUBLICAN) build --config $( CONFIG) --brand_dir= ru-RU/Common_Content/altlinux-brand --langs $( LANGUAGE) --formats txt && touch $@