Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 15 Jul 2012 14:50:25 +0300
changeset 1345 a1dffeaaf6e4
parent 1343 98bd3c148847
child 1349 b4e60ae7e4bf
permissions -rw-r--r--
Add 'check-format-policy' target.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
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
     2
export PATH := /bin:/usr/bin:${PATH}
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
# Disable built in pattern rules.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
MAKEFLAGS += -r
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
# Disable built in variables.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
MAKEFLAGS += -R
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
# Disable built in suffix rules.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
.SUFFIXES:
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
# Default target.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
.DEFAULT_GOAL = all
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
################################################################
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    14
# Platform definition.
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    15
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    16
host_os := linux
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    17
ifneq '' '$(WINDIR)'
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    18
  host_os := cygwin
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    19
endif
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    20
target_os := $(host_os)
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
################################################################
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    23
# Build tool definition/switches.
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    24
1110
6e71ffc71972 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1109
diff changeset
    25
RST2HTML := rst2html
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    26
ifeq '$(host_os)' 'cygwin'
1110
6e71ffc71972 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1109
diff changeset
    27
  RST2HTML := rst2html.py
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    28
endif
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    29
1109
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    30
RST_WARNING_FLAGS := --halt warning
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    31
RST_FLAGS := --strip-comments
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    32
RST_FLAGS += $(RST_WARNING_FLAGS)
9885f6be80f0 Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
    33
1030
9162afed7eda Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    34
################################################################
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
# Proj dirs/files.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    37
RST_FILES := $(filter-out HEADER.rst,$(wildcard *.rst))
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
TXT_FILES := $(wildcard *.txt)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
HTML_DIR := tips-html
1077
509886d148b2 Split values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1030
diff changeset
    41
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
1103
53b2adcc631e Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    42
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
    43
        $(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
    44
TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
    46
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
    47
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
DIRS := $(HTML_DIR)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
################################################################
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    51
# Deploy targets.
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    52
1343
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    53
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    54
  $(shell rm -f HEADER.rst)
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    55
endif
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    56
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    57
.PHONY: deploy
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    58
deploy: deploy2sourceforge
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    59
1332
50bb16a68693 Will be accessible via.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1296
diff changeset
    60
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/frame.html
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    61
.PHONY: deploy2sourceforge
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    62
deploy2sourceforge: html
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    63
	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
    64
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    65
################################################################
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
# Build targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
.PHONY: all
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
all:
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
.PHONY: html
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
html: $(HTML_FILES) $(TXT__FILES)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    74
$(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
    75
	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css $*.rst $@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    77
HEADER.rst: Makefile
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    78
	{ \
1340
7e7fc9c30158 Fix usability.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1338
diff changeset
    79
echo '.. _`Home`: index.html'; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    80
echo '.. _About: README.html'; \
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    81
echo '.. _`About author`: http://gavenkoa.users.sourceforge.net/'; \
1337
2bd47e0a87fa Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    82
echo '.. _Licence: README.html#tips-licence'; \
2bd47e0a87fa Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    83
echo '.. _`Contact`: gavenkoa@gmail.com'; \
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    84
echo; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    85
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
    86
echo; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
    87
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
    88
} >$@
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    89
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
    90
$(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
    91
	./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
    92
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
    93
$(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
    94
	./index.sh html >$@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
    96
$(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
    99
$(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   102
.PHONY: chm
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   103
chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   104
	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
   105
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   106
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   107
	cp $< $@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   108
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   109
$(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
   110
	./chm-hhp.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   111
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   112
$(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
   113
	./chm-hhc.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   114
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   115
$(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
   116
	./index.sh html >$@
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   117
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
# Init targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
$(DIRS):
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
	mkdir -p $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
# Clean targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
.PHONY: distclean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
distclean: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
.PHONY: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
clean:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   132
	rm -r -f $(DIRS) HEADER.rst
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   134
################################################################
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   135
# Helper target.
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   137
.PHONY: help
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   138
help:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   139
	@echo Supported targets:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   140
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   141
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   142
.PHONY: check-format-policy
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   143
check-format-policy:
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   144
	\
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   145
for f in *.rst; do \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   146
  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
   147
    echo $$f:1:" Has no 'coding: utf-8' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   148
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   149
  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
   150
    echo $$f:2:" Has no 'include:: HEADER.rst' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   151
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   152
  if grep '.. contents::' $$f >/dev/null; then :; else \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   153
    echo $$f:7:" Has no 'contents::' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   154
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   155
done
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   156