Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 04 Aug 2016 15:20:07 +0300
changeset 78 093ee7c2985f
parent 77 df763e1c3fe6
child 79 a0f224c26f08
permissions -rw-r--r--
Generate sitemap.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
     1
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
     2
################################################################
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
     3
# Standard GNU Makefile settings.
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
     4
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
SHELL = /bin/sh
3
194bc8d6504a Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
     6
export PATH := /bin:/usr/bin:${PATH}
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
# Disable built in pattern rules.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
MAKEFLAGS += -r
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
# Disable built in variables.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
MAKEFLAGS += -R
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
# Disable built in suffix rules.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
.SUFFIXES:
44
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
    14
# Delete target file if command fails.
e7fc05196363 Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 40
diff changeset
    15
.DELETE_ON_ERROR:
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
# Default target.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
.DEFAULT_GOAL = all
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
################################################################
7
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    20
# Platform definition.
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    21
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    22
host_os := linux
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    23
ifneq '' '$(WINDIR)'
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    24
  host_os := cygwin
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    25
endif
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    26
target_os := $(host_os)
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    27
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    28
################################################################
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    29
# Build tool definition/switches.
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    30
12
2d3d783b1b75 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 11
diff changeset
    31
RST2HTML := rst2html
7
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    32
ifeq '$(host_os)' 'cygwin'
12
2d3d783b1b75 small fix
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 11
diff changeset
    33
  RST2HTML := rst2html.py
7
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    34
endif
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    35
11
00d3a2f1f32b Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 10
diff changeset
    36
RST_WARNING_FLAGS := --halt warning
76
2100455aae72 Set initial header level to <h2> explicitly because after removing
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
    37
RST_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=MathJax --initial-header-level=2
68
46721724e2a3 Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 67
diff changeset
    38
RST_FLAGS := $(RST_WARNING_FLAGS) $(RST_RENDER_FLAGS)
11
00d3a2f1f32b Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 10
diff changeset
    39
7
6a41484fd3a4 Port to Debian.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 5
diff changeset
    40
################################################################
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
# Proj dirs/files.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
74
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
    43
RST_FILES := $(wildcard *.rst)
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
HTML_DIR := tips-html
8
d07c0496cdfe Split values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 7
diff changeset
    46
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
10
992d7c458bbb Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
    47
HTML_FILES := $(RST_HTML_FILES) \
65
6e28048f3e74 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 64
diff changeset
    48
        $(HTML_DIR)/index.html $(HTML_DIR)/iframe.html
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    50
CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    51
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
DIRS := $(HTML_DIR)
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
################################################################
14
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    55
# Deploy targets.
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    56
78
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
    57
WWW_SRV_NAME := tips.defun.work
61
cba303c0ad38 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 60
diff changeset
    58
WWW_SRV_USER := user
cba303c0ad38 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 60
diff changeset
    59
HG_SRV_NAME := hg.defun.work
cba303c0ad38 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 60
diff changeset
    60
HG_SRV_USER := user
69
f82b136921b7 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
    61
LOCAL_DIR := /srv/www/tips
61
cba303c0ad38 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 60
diff changeset
    62
22
a2914ae81c6d Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    63
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
74
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
    64
  $(shell rm -f $(HTML_DIR)/rst.tmpl)
22
a2914ae81c6d Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    65
endif
a2914ae81c6d Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    66
14
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    67
.PHONY: deploy
60
387dd3541a06 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 59
diff changeset
    68
deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
57
66fd832dee47 Deploy to defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 44
diff changeset
    69
65
6e28048f3e74 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 64
diff changeset
    70
# Will be accessible via: http://tips.defun.work/
57
66fd832dee47 Deploy to defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 44
diff changeset
    71
.PHONY: deploy2defun-web
78
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
    72
deploy2defun-web: www
77
df763e1c3fe6 Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    73
	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
14
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    74
60
387dd3541a06 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 59
diff changeset
    75
.PHONY: deploy2defun-hg
387dd3541a06 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 59
diff changeset
    76
deploy2defun-hg:
61
cba303c0ad38 Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 60
diff changeset
    77
	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
60
387dd3541a06 Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 59
diff changeset
    78
65
6e28048f3e74 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 64
diff changeset
    79
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
36
7fb39a216cef Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 35
diff changeset
    80
.PHONY: deploy2sf-web
78
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
    81
deploy2sf-web: www
77
df763e1c3fe6 Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    82
	rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
14
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    83
36
7fb39a216cef Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 35
diff changeset
    84
.PHONY: deploy2sf-hg
7fb39a216cef Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 35
diff changeset
    85
deploy2sf-hg:
39
fb55f2e84db1 If 'hg' found no changes it report error code 1. Ignore them as it is valid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 36
diff changeset
    86
	hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ]
36
7fb39a216cef Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 35
diff changeset
    87
69
f82b136921b7 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
    88
.PHONY: deploy2local
f82b136921b7 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
    89
deploy2local: html
77
df763e1c3fe6 Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 76
diff changeset
    90
	rsync --delete -avP $(HTML_DIR)/ $(LOCAL_DIR)
69
f82b136921b7 Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
    91
14
a36529d7dc2b Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    92
################################################################
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
# Build targets.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
.PHONY: all
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
all:
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
78
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
    98
.PHONY: www
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
    99
www: html $(HTML_DIR)/sitemap.xml
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   100
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
.PHONY: html
71
ca442493062e TXT files no longer used.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 69
diff changeset
   102
html: $(HTML_FILES)
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
74
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
   104
$(HTML_DIR)/%.html: %.rst rst.css rst-multi.css $(HTML_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
   105
	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css,rst-multi.css --template=$(HTML_DIR)/rst.tmpl $*.rst $@
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
62
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   107
$(HTML_DIR)/iframe.html: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
17
c7017f58585c Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
   108
	{ \
67
78cb29831702 set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 66
diff changeset
   109
echo '<html><head>'; \
78cb29831702 set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 66
diff changeset
   110
echo '<meta charset="utf-8">'; \
78cb29831702 set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 66
diff changeset
   111
echo '<style>'; \
64
e1866d4fdbad Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   112
echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \
66
edb06d57511f Highlight links on hover.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 65
diff changeset
   113
echo 'a:hover { opacity: .5; }'; \
64
e1866d4fdbad Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   114
echo '</style></head><body>'; \
62
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   115
echo '<ul style="padding-left: 1em;">'; \
64
e1866d4fdbad Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   116
for f in $(sort $(RST_FILES)); do \
62
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   117
  n=$${f%.rst}; \
65
6e28048f3e74 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 64
diff changeset
   118
  printf '<li><a target="_parent" href="%s.html">%s</a></li>\n' $$n $$n; \
62
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   119
done; \
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   120
echo '</ul>'; \
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   121
echo '</body></html>'; \
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   122
} >$@
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   123
74
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
   124
$(HTML_DIR)/rst.tmpl: rst.tmpl $(MAKEFILE_LIST)
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
   125
	sed -e "s|{date}|$$(date +%F)|" -e "s|{rev}|$$(hg id -i)|"  <$< >$@
17
c7017f58585c Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
   126
62
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   127
$(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR)
83c835137c2e Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 61
diff changeset
   128
	cp $< $@
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   130
.PHONY: chm
65
6e28048f3e74 Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 64
diff changeset
   131
chm: html $(CHM_FILES) $(HTML_DIR)/iframe.html
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   132
	cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   133
13
245100f28fc0 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   134
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   135
	cp $< $@
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   136
13
245100f28fc0 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   137
$(HTML_DIR)/chm.hhp: chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR)
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   138
	./chm-hhp.sh >$@
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   139
13
245100f28fc0 Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   140
$(HTML_DIR)/chm.hhc: chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR)
1
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   141
	./chm-hhc.sh >$@
fd4cd9134e53 Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   142
72
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   143
.PHONY: single-html
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   144
single-html: $(HTML_DIR)/single.html
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   145
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   146
$(HTML_DIR)/single.html: $(HTML_DIR)/single.rest rst.css rst-single.css $(RST_FILES)
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   147
	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css,rst-single.css $(HTML_DIR)/single.rest $@
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   148
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   149
$(HTML_DIR)/single.rest: $(RST_FILES) $(MAKEFILE_LIST)
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   150
	{ \
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   151
echo ".. contents::"; \
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   152
echo "   :local:"; \
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   153
echo; \
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   154
for f in *.rst; do echo ".. include:: ../$$f"; done; \
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   155
} >$@
6cc2c19c8995 Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 71
diff changeset
   156
78
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   157
$(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST)
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   158
	{ \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   159
echo '<?xml version="1.0" encoding="UTF-8"?>'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   160
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   161
for f in *.rst iframe; do \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   162
  echo '<url>'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   163
  echo "  <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   164
  echo '  <changefreq>weekly</changefreq>'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   165
  echo '</url>'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   166
done; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   167
echo '</urlset>'; \
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   168
} >$@
093ee7c2985f Generate sitemap.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   169
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
################################################################
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   171
# Init targets.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   172
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   173
$(DIRS):
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   174
	mkdir -p $@
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   175
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   176
################################################################
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   177
# Clean targets.
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   178
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   179
.PHONY: distclean
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   180
distclean: clean
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   181
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   182
.PHONY: clean
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   183
clean:
74
69323ee4fd3a Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 73
diff changeset
   184
	rm -r -f $(DIRS)
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   185
5
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   186
################################################################
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   187
# Helper target.
0
6ee132e4cd5f Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   188
35
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   189
.PHONY: help
5
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   190
help:
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   191
	@echo Supported targets:
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   192
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   193
35
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   194
.PHONY: check-format-policy
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   195
check-format-policy:
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   196
	\
73
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   197
for f in $(RST_FILES); do \
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   198
  if grep '^.. -\*- coding: utf-8; -\*-' $$f >/dev/null; then :; else \
35
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   199
    echo $$f:1:" Has no 'coding: utf-8' directive."; \
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   200
  fi; \
73
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   201
  if grep '^.. contents::' $$f >/dev/null; then :; else \
35
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   202
    echo $$f:7:" Has no 'contents::' directive."; \
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   203
  fi; \
73
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   204
  if grep '^   :local:' $$f >/dev/null; then :; else \
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   205
    echo $$f:7:" Has no ':local:' directive."; \
7ed63a934571 Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
   206
  fi; \
35
648d3bf5204d Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   207
done
5
3fce7236e888 Add 'help' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 4
diff changeset
   208