summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorVincent Batts <vbatts@hashbangbash.com>2011-05-23 10:42:47 -0400
committerVincent Batts <vbatts@hashbangbash.com>2011-05-23 10:42:47 -0400
commit4af8163c5a3386e8dc517b0c3ea7786ddc0f61e5 (patch)
tree5dbc8360a97fa0b49a4b72ff138a1f3b43c5d434 /Makefile
parent52f66278589666914a66b54daaad00f4724c921e (diff)
downloadslackbook-4af8163c5a3386e8dc517b0c3ea7786ddc0f61e5.tar.xz
makefile stuffs, to generate pngs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 41 insertions, 6 deletions
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
+