# based on https://github.com/jhradilek/publican-makefile 87dc33d7e1 # 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) PROJECT = doc #docdir = /usr/local/share/doc/$(PROJECT) docdir = /tmp/$(PROJECT) DESTDIR = INSTALL = install INSTALL_DATA = $(INSTALL) -m 644 # 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 .PHONY: txt txt: $(BUILDDIR)/txt .PHONY: all all: html-desktop html-single html epub pdf txt install: html-single $(wildcard html-desktop) $(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) tmp/ru-RU/html-single/Common_Content/css/* $(DESTDIR)$(docdir)/ru-RU/Common_Content/css/ $(INSTALL_DATA) tmp/ru-RU/html-single/Common_Content/images/* $(DESTDIR)$(docdir)/ru-RU/Common_Content/images/ $(INSTALL_DATA) tmp/ru-RU/html-single/images/* $(DESTDIR)$(docdir)/ru-RU/images/ $(INSTALL_DATA) tmp/ru-RU/html-single/index.html $(DESTDIR)$(docdir)/ru-RU/index.html $(INSTALL_DATA) index.html $(DESTDIR)$(docdir)/ .PHONY: clean clean: $(PUBLICAN) clean --brand_dir=ru-RU/Common_Content/altlinux-brand .PHONY: test test: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats test $(BUILDDIR)/html-desktop: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats html-desktop --publish && touch $@ $(BUILDDIR)/html-single: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats html-single --publish && touch $@ $(BUILDDIR)/html: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats html --publish && touch $@ $(BUILDDIR)/epub: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats epub && touch $@ $(BUILDDIR)/pdf: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats pdf && touch $@ $(BUILDDIR)/txt: $(FILES) $(IMAGES) $(CONFIG) $(PUBLICAN) build --config $(CONFIG) --brand_dir=ru-RU/Common_Content/altlinux-brand --langs $(LANGUAGE) --formats txt && touch $@