Makefile
changeset 249 22e93995e88a
parent 234 420c06da8fd1
child 275 2f79af90c708
--- a/Makefile	Fri Oct 28 02:07:16 2011 +0300
+++ b/Makefile	Fri Oct 28 02:07:42 2011 +0300
@@ -10,8 +10,8 @@
 # Default target.
 .DEFAULT_GOAL = help
 
-.PHONY: all
-all:
+################################################################
+# Platform definition.
 
 ifeq '' '$(HOME)'
   $(error HOME env var not set!)
@@ -19,7 +19,15 @@
 
 host_os = linux
 ifneq '' '$(COMSPEC)'
-  host_os = windows
+  host_os = cygwin
+endif
+
+################################################################
+# Build tool definition/switches.
+
+RST2HTML = rst2html
+ifeq '$(host_os)' 'cygwin'
+  RST2HTML = rst2html.py
 endif
 
 ################################################################
@@ -35,6 +43,15 @@
 MANUALINSTALL_ITEMS = .mc
 IFNONEXIST_ITEMS = .wgetrc .subversion
 
+RST_FILES = $(wildcard *.rst)
+HTML_FILES = $(RST_FILES:.rst=.html)
+
+################################################################
+# Build targets.
+
+.PHONY: all
+all:
+
 ################################################################
 # Install/uninstall targets.
 
@@ -72,7 +89,7 @@
 	done
 	mkdir -p $(HOME)/.mc
 	install -m 640 .mc/bashrc $(HOME)/.mc
-ifeq '$(host_os)' 'windows'
+ifeq '$(host_os)' 'cygwin'
 	install -m 640 .mc/bindings.cygwin $(HOME)/.mc/bindings
 else
 	install -m 640 .mc/bindings $(HOME)/.mc/bindings
@@ -98,10 +115,21 @@
 	rmdir $(HOME)/.mc || :
 
 ################################################################
+# Docs targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+# --stylesheet=rst.css
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) $*.rst $@
+
+################################################################
 # Clean targets.
 
 .PHONY: clean
 clean:
+	rm -f $(HTML_FILES)
 
 .PHONY: distclean
 distclean: clean