Makefile
changeset 752 079c2e27357a
parent 750 db9827b0fdf5
child 816 ad19fb10943e
--- a/Makefile	Mon Oct 24 02:56:25 2011 +0300
+++ b/Makefile	Mon Oct 24 02:56:48 2011 +0300
@@ -28,9 +28,15 @@
 
 host_os = unix
 ifneq '' '$(COMSPEC)'
-  host_os = windows
+  ifneq '' '$(WINDIR)'
+    # Probably under Windows.
+    host_os = windows
+  endif
 endif
 
+################################################################
+# Build tool definition/switches.
+
 EMACS = emacs
 # I prefer native Windows Emacs, so use it if available.
 ifeq 'windows' '$(host_os)'
@@ -39,11 +45,22 @@
   endif
 endif
 
+RST2HTML = rst2html
+ifeq '$(host_os)' 'windows'
+  RST2HTML = rst2html.py
+endif
+
+################################################################
+# Proj dirs/files.
+
+FILES_MODE_EL := $(wildcard *-mode.el)
+
+RST_FILES := $(wildcard *.rst)
+HTML_FILES := $(RST_FILES:.rst=.html)
+
 ################################################################
 # Targets.
 
-FILES_MODE_EL := $(wildcard *-mode.el)
-
 .PHONY: all
 all: install
 
@@ -80,6 +97,15 @@
 	tar cf dot-emacs.tar .emacs .emacs-my
 
 ################################################################
+# Documentation targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) --stylesheet=rst.css $*.rst $@
+
+################################################################
 # Clean targets.
 
 .PHONY: distclean
@@ -87,4 +113,4 @@
 
 .PHONY: clean
 clean:
-	rm -f dot-emacs.tar
+	rm -f dot-emacs.tar $(HTML_FILES)