Add 'html' target.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 21 Dec 2011 23:23:40 +0200
changeset 66 be91c79007e9
parent 65 2137ea6bb456
child 67 5166ffffd608
Add 'html' target.
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.