# HG changeset patch
# User Oleksandr Gavenko <gavenkoa@gmail.com>
# Date 1324502620 -7200
# Node ID be91c79007e91748caf5879267b12514d91defa5
# Parent  2137ea6bb456773ac805ebad14154a21c02e092a
Add 'html' target.

diff -r 2137ea6bb456 -r be91c79007e9 Makefile
--- a/Makefile	Wed Dec 21 23:16:32 2011 +0200
+++ b/Makefile	Wed Dec 21 23:23:40 2011 +0200
@@ -21,6 +21,25 @@
 .DEFAULT_GOAL = all
 
 ################################################################
+# Platform/environment definition.
+
+host_os = unix
+ifneq '' '$(COMSPEC)'
+  ifneq '' '$(WINDIR)'
+    # Probably under Windows.
+    host_os = windows
+  endif
+endif
+
+################################################################
+# Build tool definition/switches.
+
+RST2HTML = rst2html
+ifeq '$(host_os)' 'windows'
+  RST2HTML = rst2html.py
+endif
+
+################################################################
 # Install paths.
 
 ifeq '$(origin prefix)' 'undefined'
@@ -34,13 +53,16 @@
 datadir = $(datarootdir)/dictd
 
 ################################################################
-# Project files.
+# Project dirs/files.
 
 C5_FILES := $(wildcard *.dict-c5)
 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
 
+RST_FILES := $(wildcard *.rst)
+HTML_FILES := $(RST_FILES:.rst=.html)
+
 ################################################################
 # Build targets.
 
@@ -79,6 +101,15 @@
 	done
 
 ################################################################
+# Documentation targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) --stylesheet=rst.css $*.rst $@
+
+################################################################
 # Clean targets.
 
 .PHONY: distclean
@@ -86,7 +117,7 @@
 
 .PHONY: clean
 clean:
-	rm -f $(DICTDZ_FILES) $(INDEX_FILES);
+	rm -f $(DICTDZ_FILES) $(INDEX_FILES)
 
 ################################################################
 # Helper target.