From 4af8163c5a3386e8dc517b0c3ea7786ddc0f61e5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 23 May 2011 10:42:47 -0400 Subject: makefile stuffs, to generate pngs --- Makefile | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 86f6bda..39c5af1 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,34 @@ # $Id$ -chapters = chapter_*.xml +chapters := $(wildcard chapter_*.xml) -book.html: build.sh main.xml $(chapters) +imgs_ps := $(wildcard ps-imgs/*.eps) +imgs_png := $(addsuffix .png,$(addprefix png/,$(basename $(notdir $(imgs_ps))))) + + +list_imgs: + @echo $(imgs_ps) + @echo $(imgs_png) + +define png_template +$(1): $(2) + mkdir -p $(CWD)png && \ + convert $(2) -antialias -flatten $(1) +endef + +# this is a little voodoo, to iterate over the *.eps files, +# and create a make target of the png output name, that will +# build those *.png files +# :) --vbatts +$(foreach ps,$(imgs_ps),$(eval $(call png_template,$(addsuffix .png,$(addprefix png/,$(basename $(notdir $(ps))))),$(ps)))) + +images: $(imgs_png) + +book.html: build.sh main.xml $(chapters) $(imgs_png) .clean.html sh build.sh && \ ls -l $@ -book.pdf: main.xml $(chapters) .dblatex +book.pdf: main.xml $(chapters) $(imgs_png) .dblatex .clean.pdf dblatex \ --pdf \ -x'-xinclude' \ @@ -20,11 +42,24 @@ view.html: book.html xdg-open $< .dblatex: - $(shell which dblatex 2>/dev/null || echo "ERROR: 'dblatex' REQUIRED, SEE http://github.com/vbatts/SlackBuilds/ FOR THE SlackBuild") + $(shell which dblatex 2>/dev/null >/dev/null || echo "ERROR: 'dblatex' REQUIRED, SEE http://github.com/vbatts/SlackBuilds/ FOR THE SlackBuild") + + +.PHONY: .clean.html +.clean.html: + rm -f book.html +.PHONY: .clean.pdf +.clean.pdf: + rm -f book.pdf + +.PHONY: .clean.images +.clean.images: + rm -fr png/ .PHONY: clean -clean: - rm -f book.html book.pdf +clean: .clean.pdf .clean.html .clean.images + .DEFAULT_GOAL := book.html + -- cgit v1.2.3