diff -r 139665dd6ada -r 034e9cfcc17c Makefile --- a/Makefile Sun Oct 16 01:14:02 2011 +0300 +++ b/Makefile Sun Nov 20 20:14:17 2011 +0200 @@ -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,14 +45,28 @@ 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 +################################################################ +# Install/uninstall targets. + .PHONY: install-all install-all: install cp .emacs-pre $(HOME)/.emacs-pre @@ -55,7 +75,7 @@ .PHONY: install install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL) for file in .emacs-pre .emacs-post; do \ - if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \ + [ -f $(HOME)/$$file ] || cp $$file $(HOME)/$$file; \ done cp .emacs $(HOME)/.emacs cp .emacs-my $(HOME)/.emacs-my @@ -70,15 +90,28 @@ .PHONY: uninstall uninstall: - @echo !!! Nothing done !!! + rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen + rm -f -r $(HOME)/.emacs.d/my-lisp .PHONY: tar tar: 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 distclean: clean .PHONY: clean clean: - rm -f dot-emacs.tar + rm -f dot-emacs.tar $(HTML_FILES)