Build html version of tips.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 20 Jul 2011 12:37:29 +0300
changeset 0 6ee132e4cd5f
child 1 fd4cd9134e53
Build html version of tips.
Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,62 @@
+
+SHELL = /bin/sh
+
+# Disable built in pattern rules.
+MAKEFLAGS += -r
+# Disable built in variables.
+MAKEFLAGS += -R
+# Disable built in suffix rules.
+.SUFFIXES:
+# Default target.
+.DEFAULT_GOAL = all
+
+################################################################
+# Proj dirs/files.
+
+RST_FILES := $(wildcard *.rst)
+TXT_FILES := $(wildcard *.txt)
+
+HTML_DIR := tips-html
+HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) $(HTML_DIR)/index.html $(HTML_DIR)/index-frame.html
+TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
+
+DIRS := $(HTML_DIR)
+
+################################################################
+# Build targets.
+
+.PHONY: all
+all:
+
+.PHONY: html
+html: $(HTML_FILES) $(TXT__FILES)
+
+$(HTML_DIR)/%.html: %.rst | $(HTML_DIR)
+	rst2html.py --stylesheet=rst.css $*.rst $@
+
+$(HTML_DIR)/index.html: index.sh | $(HTML_DIR)
+	./index.sh >$@
+
+$(HTML_DIR)/%.html: %.html | $(HTML_DIR)
+	cp $< $@
+
+$(HTML_DIR)/%.txt: %.txt | $(HTML_DIR)
+	cp $< $@
+
+################################################################
+# Init targets.
+
+$(DIRS):
+	mkdir -p $@
+
+################################################################
+# Clean targets.
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: clean
+clean:
+	rm -r -f $(DIRS)
+
+