Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 13:02:27 +0200
changeset 1907 f4b078cbff20
parent 1902 1dd434abf745
child 1908 0260f8ffef35
permissions -rw-r--r--
TXT files no longer used.
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
1901
12a7d89c74a9 Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1898
diff changeset
    37
RST_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=MathJax
12a7d89c74a9 Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1898
diff changeset
    38
RST_FLAGS := $(RST_WARNING_FLAGS) $(RST_RENDER_FLAGS)
1109
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
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
HTML_DIR := tips-html
1077
509886d148b2 Split values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1030
diff changeset
    46
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
1103
53b2adcc631e Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    47
HTML_FILES := $(RST_HTML_FILES) \
1893
da0024f4f068 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1891
diff changeset
    48
        $(HTML_DIR)/index.html $(HTML_DIR)/iframe.html
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
    50
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
    51
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
DIRS := $(HTML_DIR)
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
################################################################
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    55
# Deploy targets.
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    56
1883
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    57
WWW_SRV_NAME := defun.work
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    58
WWW_SRV_USER := user
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    59
HG_SRV_NAME := hg.defun.work
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    60
HG_SRV_USER := user
1902
1dd434abf745 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1901
diff changeset
    61
LOCAL_DIR := /srv/www/tips
1883
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    62
1343
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    63
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    64
  $(shell rm -f HEADER.rst)
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    65
endif
98bd3c148847 Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
    66
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    67
.PHONY: deploy
1843
8ad4fe7443f2 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1839
diff changeset
    68
deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
1786
e96e62e31370 Deploy to defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
    69
1893
da0024f4f068 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1891
diff changeset
    70
# Will be accessible via: http://tips.defun.work/
1786
e96e62e31370 Deploy to defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
    71
.PHONY: deploy2defun-web
e96e62e31370 Deploy to defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
    72
deploy2defun-web: html
1883
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    73
	rsync --delete -avP -e ssh tips-html/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    74
1843
8ad4fe7443f2 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1839
diff changeset
    75
.PHONY: deploy2defun-hg
8ad4fe7443f2 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1839
diff changeset
    76
deploy2defun-hg:
1883
2e2b67e76e55 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1843
diff changeset
    77
	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
1843
8ad4fe7443f2 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1839
diff changeset
    78
1893
da0024f4f068 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1891
diff changeset
    79
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    80
.PHONY: deploy2sf-web
1367
b36747c6a74e Fix typo in target name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
    81
deploy2sf-web: html
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    82
	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
    83
1349
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    84
.PHONY: deploy2sf-hg
b4e60ae7e4bf Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1345
diff changeset
    85
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
    86
	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
    87
1902
1dd434abf745 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1901
diff changeset
    88
.PHONY: deploy2local
1dd434abf745 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1901
diff changeset
    89
deploy2local: html
1dd434abf745 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1901
diff changeset
    90
	rsync --delete -avP tips-html/ $(LOCAL_DIR)
1dd434abf745 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1901
diff changeset
    91
1296
6b365616ac9e Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
    92
################################################################
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
# Build targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
.PHONY: all
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
all:
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
.PHONY: html
1907
f4b078cbff20 TXT files no longer used.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1902
diff changeset
    99
html: $(HTML_FILES)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
1901
12a7d89c74a9 Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1898
diff changeset
   101
$(HTML_DIR)/%.html: %.rst HEADER.rst rst.css rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
12a7d89c74a9 Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1898
diff changeset
   102
	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css --template=rst.tmpl $*.rst $@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
1889
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   104
$(HTML_DIR)/iframe.html: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   105
	{ \
1898
2a18c31747dc set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1897
diff changeset
   106
echo '<html><head>'; \
2a18c31747dc set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1897
diff changeset
   107
echo '<meta charset="utf-8">'; \
2a18c31747dc set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1897
diff changeset
   108
echo '<style>'; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   109
echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \
1897
200fac373cf9 Highlight links on hover.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1893
diff changeset
   110
echo 'a:hover { opacity: .5; }'; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   111
echo '</style></head><body>'; \
1889
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   112
echo '<ul style="padding-left: 1em;">'; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   113
for f in $(sort $(RST_FILES)); do \
1889
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   114
  n=$${f%.rst}; \
1893
da0024f4f068 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1891
diff changeset
   115
  printf '<li><a target="_parent" href="%s.html">%s</a></li>\n' $$n $$n; \
1889
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   116
done; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   117
echo '</ul>'; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   118
echo '</body></html>'; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   119
} >$@
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   120
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   121
HEADER.rst: $(MAKEFILE_LIST)
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   122
	{ \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   123
echo '.. raw:: html'; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   124
echo; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   125
echo '  <div id="sidebar"><iframe src="iframe.html"></iframe></div>'; \
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   126
echo; \
1341
e45ca3c87690 Fix links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1340
diff changeset
   127
echo '.. _About: README.html'; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   128
echo '.. _`Contacts`: http://resume.defun.work/'; \
1839
248ed4d46099 Point to HTTP, as HTTPS uses in-house certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1787
diff changeset
   129
echo '.. _`Oleksandr Gavenko`: http://resume.defun.work/'; \
248ed4d46099 Point to HTTP, as HTTPS uses in-house certificate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1787
diff changeset
   130
echo '.. _`gavenkoa`: http://resume.defun.work/'; \
1337
2bd47e0a87fa Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
   131
echo '.. _Licence: README.html#tips-licence'; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   132
echo; \
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   133
echo '.. container:: header'; \
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   134
echo; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   135
echo '  [ About_ | Licence_ | `Contacts`_ ]'; \
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   136
echo '.. container:: header small'; \
1338
4e268948ba99 Sign each document with author name and build info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
   137
echo; \
1891
471406f3c69c Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1890
diff changeset
   138
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
   139
} >$@
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   140
1889
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   141
$(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR)
265b8d0f6149 Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1883
diff changeset
   142
	cp $< $@
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   144
$(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   147
$(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR)
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
	cp $< $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   150
.PHONY: chm
1893
da0024f4f068 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1891
diff changeset
   151
chm: html $(CHM_FILES) $(HTML_DIR)/iframe.html
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   152
	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
   153
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   154
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
903
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   155
	cp $< $@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   156
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   157
$(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
   158
	./chm-hhp.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   159
1111
e1a7f1896571 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1110
diff changeset
   160
$(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
   161
	./chm-hhc.sh >$@
9ead7d97be34 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
   162
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   164
# Init targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   166
$(DIRS):
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   167
	mkdir -p $@
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   168
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   169
################################################################
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
# Clean targets.
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   171
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   172
.PHONY: distclean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   173
distclean: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   174
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   175
.PHONY: clean
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   176
clean:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
   177
	rm -r -f $(DIRS) HEADER.rst
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   178
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   179
################################################################
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   180
# Helper target.
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   181
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   182
.PHONY: help
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   183
help:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   184
	@echo Supported targets:
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   185
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   186
1345
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   187
.PHONY: check-format-policy
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   188
check-format-policy:
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   189
	\
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   190
for f in *.rst; do \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   191
  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
   192
    echo $$f:1:" Has no 'coding: utf-8' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   193
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   194
  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
   195
    echo $$f:2:" Has no 'include:: HEADER.rst' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   196
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   197
  if grep '.. contents::' $$f >/dev/null; then :; else \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   198
    echo $$f:7:" Has no 'contents::' directive."; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   199
  fi; \
a1dffeaaf6e4 Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
   200
done
928
05c1f958d465 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
   201