Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 1438 a53df7bd6722
child 1786 e96e62e31370
permissions -rw-r--r--
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1438
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
     1
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
     2
################################################################
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
     3
# Standard GNU Makefile settings.
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
     4
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
SHELL = /bin/sh
923
f3b193a0e566 Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
     6
export PATH := /bin:/usr/bin:${PATH}
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
# Disable built in pattern rules.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
MAKEFLAGS += -r
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
# Disable built in variables.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
MAKEFLAGS += -R
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
# Disable built in suffix rules.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
.SUFFIXES:
1438
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
    14
# Delete target file if command fails.
a53df7bd6722 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1367
diff changeset
    15
.DELETE_ON_ERROR:
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
# Default target.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
.DEFAULT_GOAL = all
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
################################################################
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    20
# Platform definition.
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    21
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    22
host_os := linux
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    23
ifneq '' '$(WINDIR)'
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    24
  host_os := cygwin
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    25
endif
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    26
target_os := $(host_os)
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    27
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    28
################################################################
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    29
# Build tool definition/switches.
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    30
1110
6e71ffc71972 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1109
diff changeset
    31
RST2HTML := rst2html
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    32
ifeq '$(host_os)' 'cygwin'
1110
6e71ffc71972 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1109
diff changeset
    33
  RST2HTML := rst2html.py
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    34
endif
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    35
1109
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    36
RST_WARNING_FLAGS := --halt warning
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    37
RST_FLAGS := --strip-comments
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    38
RST_FLAGS += $(RST_WARNING_FLAGS)
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    39
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    40
################################################################
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
# Proj dirs/files.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    43
RST_FILES := $(filter-out HEADER.rst,$(wildcard *.rst))
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
TXT_FILES := $(wildcard *.txt)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
HTML_DIR := tips-html
1077
509886d148b2 Split values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1030
diff changeset
    47
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
1103
53b2adcc631e Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    48
HTML_FILES := $(RST_HTML_FILES) \
1079
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1077
diff changeset
    49
        $(HTML_DIR)/index.html $(HTML_DIR)/frame.html $(HTML_DIR)/frame-index.html
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
    52
CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
    53
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
DIRS := $(HTML_DIR)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
################################################################
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    57
# Deploy targets.
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    58
1343
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    59
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    60
  $(shell rm -f HEADER.rst)
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    61
endif
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    62
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    63
.PHONY: deploy
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    64
deploy: deploy2sf-web deploy2sf-hg
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    65
1332
50bb16a68693 Will be accessible via.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1296
diff changeset
    66
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/frame.html
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    67
.PHONY: deploy2sf-web
1367
b36747c6a74e Fix typo in target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
    68
deploy2sf-web: html
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    69
	rsync --delete -avP -e ssh tips-html/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    70
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    71
.PHONY: deploy2sf-hg
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    72
deploy2sf-hg:
1366
c57cd27e840e If 'hg' found no changes it report error code 1. Ignore them as it is valid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
    73
	hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ]
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    74
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    75
################################################################
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
# Build targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
.PHONY: all
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
all:
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
.PHONY: html
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
html: $(HTML_FILES) $(TXT__FILES)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    84
$(HTML_DIR)/%.html: %.rst HEADER.rst rst.css $(MAKEFILE_LIST) | $(HTML_DIR)
1109
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    85
	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css $*.rst $@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    87
HEADER.rst: Makefile
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    88
	{ \
1340
7e7fc9c30158 Fix usability.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1338
diff changeset
    89
echo '.. _`Home`: index.html'; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    90
echo '.. _About: README.html'; \
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    91
echo '.. _`About author`: http://gavenkoa.users.sourceforge.net/'; \
1337
2bd47e0a87fa Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    92
echo '.. _Licence: README.html#tips-licence'; \
2bd47e0a87fa Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    93
echo '.. _`Contact`: gavenkoa@gmail.com'; \
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    94
echo; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    95
echo '[ Home_ | About_ | Licence_ | `About author`_ | `Contact`_ ]'; \
1338
4e268948ba99 Sign each document with author name and build info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
    96
echo; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    97
echo 'Written by Oleksandr Gavenko (AKA gavenkoa), compiled at ``'`date +%F`'`` from rev ``'`hg id -i`'``.'; \
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    98
} >$@
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    99
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   100
$(HTML_DIR)/frame-index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
1079
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1077
diff changeset
   101
	./index.sh frame >$@
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1077
diff changeset
   102
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   103
$(HTML_DIR)/index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
1079
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1077
diff changeset
   104
	./index.sh html >$@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   106
$(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   109
$(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   112
.PHONY: chm
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   113
chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   114
	cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   115
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   116
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   117
	cp $< $@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   118
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   119
$(HTML_DIR)/chm.hhp: chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR)
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   120
	./chm-hhp.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   121
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   122
$(HTML_DIR)/chm.hhc: chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR)
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   123
	./chm-hhc.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   124
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   125
$(HTML_DIR)/index-chm.html: index.sh $(MAKEFILE_LIST) | $(HTML_DIR)
1079
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1077
diff changeset
   126
	./index.sh html >$@
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   127
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
# Init targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
$(DIRS):
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
	mkdir -p $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
# Clean targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
.PHONY: distclean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
distclean: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
.PHONY: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
clean:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   142
	rm -r -f $(DIRS) HEADER.rst
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   144
################################################################
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   145
# Helper target.
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   147
.PHONY: help
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   148
help:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   149
	@echo Supported targets:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   150
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   151
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   152
.PHONY: check-format-policy
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   153
check-format-policy:
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   154
	\
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   155
for f in *.rst; do \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   156
  if grep '.. -\*- coding: utf-8; -\*-' $$f >/dev/null; then :; else \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   157
    echo $$f:1:" Has no 'coding: utf-8' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   158
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   159
  if grep '.. include:: HEADER.rst' $$f >/dev/null; then :; else \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   160
    echo $$f:2:" Has no 'include:: HEADER.rst' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   161
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   162
  if grep '.. contents::' $$f >/dev/null; then :; else \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   163
    echo $$f:7:" Has no 'contents::' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   164
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   165
done
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   166