Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 20 Jul 2011 12:37:29 +0300
changeset 0 6ee132e4cd5f
child 1 fd4cd9134e53
permissions -rwxr-xr-x
Build html version of tips.


SHELL = /bin/sh

# Disable built in pattern rules.
MAKEFLAGS += -r
# Disable built in variables.
MAKEFLAGS += -R
# Disable built in suffix rules.
.SUFFIXES:
# Default target.
.DEFAULT_GOAL = all

################################################################
# Proj dirs/files.

RST_FILES := $(wildcard *.rst)
TXT_FILES := $(wildcard *.txt)

HTML_DIR := tips-html
HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) $(HTML_DIR)/index.html $(HTML_DIR)/index-frame.html
TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))

DIRS := $(HTML_DIR)

################################################################
# Build targets.

.PHONY: all
all:

.PHONY: html
html: $(HTML_FILES) $(TXT__FILES)

$(HTML_DIR)/%.html: %.rst | $(HTML_DIR)
	rst2html.py --stylesheet=rst.css $*.rst $@

$(HTML_DIR)/index.html: index.sh | $(HTML_DIR)
	./index.sh >$@

$(HTML_DIR)/%.html: %.html | $(HTML_DIR)
	cp $< $@

$(HTML_DIR)/%.txt: %.txt | $(HTML_DIR)
	cp $< $@

################################################################
# Init targets.

$(DIRS):
	mkdir -p $@

################################################################
# Clean targets.

.PHONY: distclean
distclean: clean

.PHONY: clean
clean:
	rm -r -f $(DIRS)