1 HTMLDIR ?= ./html 2 PDFDIR ?= ./pdf 3 4 # The CIL Reference Guide first part 5 CIL_REF_GUIDE = CIL_Reference_Guide.xml 6 # All the docbook files that make up the guide: 7 FILE_LIST ?= $(CIL_REF_GUIDE) $(wildcard cil*.xml) 8 # xmlto generates a *.proc file that can be removed. 9 PROC_FILE = CIL_Reference_Guide.proc 10 11 # look for xmlto and dblatex packages 12 XMLTO = $(shell which xmlto 2> /dev/null | grep / | head -n1) 13 DBLATEX = $(shell which dblatex 2> /dev/null | grep / | head -n1) 14 15 # If no xmlto then exit as cannot proceed. 16 ifeq ($(XMLTO),) 17 $(error xmlto package not found - install package.) 18 endif 19 20 all: html pdf 21 22 html: $(FILE_LIST) 23 $(XMLTO) html $(CIL_REF_GUIDE) 24 @mkdir -p $(HTMLDIR) 25 @for m in *.html; do if [ -f $$m ]; then mv $$m $(HTMLDIR); fi; done 26 @rm -f $(PROC_FILE) 27 28 29 pdf: $(FILE_LIST) 30 # Check if dblatex is available 31 ifeq ($(DBLATEX),) 32 $(error dblatex package not found - install package for a pdf document.) 33 endif 34 $(XMLTO) --with-dblatex pdf $(CIL_REF_GUIDE) 35 @mkdir -p $(PDFDIR) 36 @for m in *.pdf; do if [ -f $$m ]; then mv $$m $(PDFDIR); fi; done 37 @rm -f $(PROC_FILE) 38 39 clean: 40 @rm -rf html/ 41 @rm -rf pdf/ 42