Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 21 Sep 2016 22:09:37 +0300
changeset 565 ac68f2680ea0
parent 564 93d0bdb815a1
child 587 caf484e75e19
permissions -rw-r--r--
Add syntax to add related words. Add separators between ant/syn/rel in generated output.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
0ff3715e6176 To build dictionary you need to install...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
     1
# To build dictionary you need to install:
0ff3715e6176 To build dictionary you need to install...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
     2
#
0ff3715e6176 To build dictionary you need to install...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
     3
#    $ sudo apt-get install dictfmt
0ff3715e6176 To build dictionary you need to install...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 68
diff changeset
     4
#
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     5
# Available target:
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     6
#
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     7
#   all         build dictionaries
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     8
#   install     install dictionaries, so they been available in stardict, may require root permission
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     9
#   uninstall   remove dictionaries, they been unavailable in stardict, may require root permission
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    10
#
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    11
# You can override such variables in Makefile.config:
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    12
#
121
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    13
#   SF_USER     SourceForge user name.
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    14
#   prefix      Prefix to install path.
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    15
260
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    16
################################################################
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    17
# Standard GNU Makefile settings.
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    18
287
d01045b55e04 Avoid names inlining.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 276
diff changeset
    19
SHELL = /bin/bash
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    20
export PATH := /bin:/usr/bin:${PATH}
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    21
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    22
# Disable built in pattern rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    23
MAKEFLAGS += -r
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    24
# Disable built in variables.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    25
MAKEFLAGS += -R
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    26
# Disable built in suffix rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    27
.SUFFIXES:
260
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    28
# Delete target file if command fails.
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    29
.DELETE_ON_ERROR:
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    30
# Default target.
106
092b25d032af Set 'help' as default target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 105
diff changeset
    31
.DEFAULT_GOAL = help
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    32
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
    33
################################################################
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    34
# Build script definitions.
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    35
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
    36
BUILD_SCRIPTS := $(firstword $(MAKEFILE_LIST))
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    37
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    38
ifneq '' '$(wildcard Makefile.config)'
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    39
  include Makefile.config
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
    40
  BUILD_SCRIPTS += Makefile.config
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    41
endif
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    42
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    43
################################################################
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    44
# Version extracting/generation.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    45
480
4413ccc9e216 Include VERSION file into source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 479
diff changeset
    46
VER_FILE := VERSION
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
    47
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
    48
# Prevent making distribution with wrong version.
133
60e2090b7462 Rebuild VERSION file for 'dist' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 132
diff changeset
    49
ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    50
  ifeq '' '$(MAKE_RESTARTS)'
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
    51
    $(shell rm -f $(VER_FILE))
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    52
  endif
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    53
endif
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    54
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    55
# Here are vmajor and vminor. Look README section "Versioning rules."
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
    56
-include $(VER_FILE)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    57
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
    58
$(VER_FILE): | $(dir $(VER_FILE))
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    59
	\
482
fefea56726d2 Warn if build done without version file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 481
diff changeset
    60
[ -d .hg/ ] || { echo We miss VERSION file!!; exit 0; }; \
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    61
vtagdist=$$(hg log -r . --template '{latesttagdistance}'); \
141
4b799e3f9a70 Allow release from commit that tag release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 137
diff changeset
    62
vatrelease=$$([ $$vtagdist -le 1 ] && echo yes || echo no); \
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    63
vtag=$$(hg log -r . --template '{latesttag}'); \
311
47ae3d88a59d Use more conventional tag naming schema.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 308
diff changeset
    64
vmajor=$${vtag#v}; \
151
206fb46e793d Make code more genetic.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 150
diff changeset
    65
vmajor=$${vmajor%%.*}; \
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    66
vminor=$${vtag#*.}; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    67
vrev=$$(hg id -i); \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    68
visclean=$$(case $$vrev in *+) echo no;; *) echo yes;; esac); \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    69
vrev=$${vrev%+}; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    70
{ \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    71
echo "vrev=$$vrev"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    72
echo "vtag=$$vtag"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    73
echo "vtagdist=$$vtagdist"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    74
echo "visclean=$$visclean"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    75
echo "vatrelease=$$vatrelease"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    76
echo "vmajor=$$vmajor"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    77
echo "vminor=$$vminor"; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
    78
} >$@
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    79
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    80
################################################################
106
092b25d032af Set 'help' as default target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 105
diff changeset
    81
# Determine platform/environment.
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    82
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    83
host_os = unix
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    84
ifneq '' '$(COMSPEC)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    85
  ifneq '' '$(WINDIR)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    86
    # Probably under Windows.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    87
    host_os = windows
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    88
    ifneq '' '$(wildcard /etc/setup/*cygwin*)'
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    89
      # Probably under Cygwin.
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    90
      host_os = cygwin
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    91
    endif
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    92
  endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    93
endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    94
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    95
################################################################
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    96
# Build tools definition/switches.
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    97
121
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    98
INSTALL = install
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    99
INSTALL_PROGRAM = $(INSTALL)
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
   100
INSTALL_DATA = $(INSTALL) -m 644
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
   101
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   102
RST_WARNING_FLAGS := --halt warning
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   103
RST_FLAGS := --strip-comments
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   104
RST_FLAGS += $(RST_WARNING_FLAGS)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   105
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   106
RST2HTML := rst2html
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   107
ifeq '$(host_os)' 'cygwin'
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   108
  RST2HTML := rst2html.py
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   109
endif
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   110
RST2HTML_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=HTML --initial-header-level=2
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   111
RST2HTML_FLAGS := $(RST_FLAGS) $(RST2HTML_RENDER_FLAGS)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   112
308
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   113
LATEX2PDF := pdflatex
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   114
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   115
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   116
# Install paths.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   118
ifeq '$(origin prefix)' 'undefined'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   119
  ifeq '$(shell id -u)' '0'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   120
    prefix = /usr/local
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   121
  else
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   122
    prefix = $(HOME)/usr
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   123
  endif
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   124
endif
388
d98d8f8cdef9 Eliminate "DESTDIR", "prefix" variable should be sufficient.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 387
diff changeset
   125
datarootdir := $(prefix)/share
389
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   126
datadir := $(datarootdir)/dictd
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   127
elispdir := $(datarootdir)/emacs/site-lisp
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   129
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   130
# Project dirs/files.
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
   131
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   132
pkgname = gadict
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   133
fullpkgname = $(pkgname)-$(vmajor).$(vminor)
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   134
401
791994f95561 Add dependency on py files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 396
diff changeset
   135
PY_FILES := $(wildcard py/gadict*.py)
791994f95561 Add dependency on py files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 396
diff changeset
   136
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   137
GADICT_FILES := $(wildcard *.gadict)
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   138
410
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   139
C5_FILES := dist/dictd/gadict_en-ru+uk.c5 dist/dictd/gadict_voa.c5
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   140
ALL_C5_FILES := $(C5_FILES) dist/dictd/gadict_en-ru.c5 dist/dictd/gadict_en-uk.c5
387
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   141
DICT_FILES := $(C5_FILES:.c5=.dict)
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   142
DICTDZ_FILES := $(C5_FILES:.c5=.dict.dz)
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   143
INDEX_FILES := $(C5_FILES:.c5=.index)
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   144
536
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   145
SRS_TAB_FILES := $(patsubst %.gadict,dist/srs/%.tab.txt,$(GADICT_FILES))
555
4a3188fc8951 Generating Packaged Anki Desk files for Anki space repetition software.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
   146
SRS_ANKI_FILES := $(patsubst %.gadict,dist/srs/%.apkg,$(GADICT_FILES))
536
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   147
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   148
RST_TMPL_FILE = dist/misc/rst.tmpl
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   149
RST_CSS_FILE = www/tmpl/rst.css
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   150
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   151
RST_FILES := $(wildcard www/*.rst)
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   152
RST_HTML_FILES := $(patsubst www/%.rst,dist/www/%.html,$(RST_FILES))
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   153
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   154
INDEX_HTML_FILE := dist/www/index.html
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   155
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   156
STAT_RST_FILE := dist/misc/STAT.rst
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   157
STAT_HTML_FILE := dist/www/STAT.html
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   158
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   159
HTML_FILES := $(RST_HTML_FILES) $(INDEX_HTML_FILE) $(STAT_HTML_FILE)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   160
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   161
LOGO_NAME := logo
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   162
LOGO_SVG := $(LOGO_NAME).svg
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   163
LOGO_DIM := 32x32 48x48 64x64
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   164
LOGO_PNG_FILES := $(patsubst %,$(LOGO_NAME)-%.png,$(LOGO_DIM))
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   165
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   166
DISTREL_TARBALLS = dist/$(fullpkgname).tar.gz dist/$(fullpkgname).zip
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   167
DISTSRC_TARBALLS = dist/$(fullpkgname)_src.tar.gz # dist/$(fullpkgname)_src.zip
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   168
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   169
################################################################
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   170
# Deploy/release targets.
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   171
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   172
.PHONY: deploy
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   173
deploy: deploy2defun deploy2sf
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   174
558
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   175
.PHONY: deploy-hg
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   176
deploy-hg: deploy2defun-hg deploy2sf-hg
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   177
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   178
.PHONY: release
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   179
release: release2defun release2sf
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   180
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   181
.PHONY: release2defun
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   182
release2defun: validate-release deploy2defun
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   183
505
4ce3ced9057e Fix dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 503
diff changeset
   184
.PHONY: release2sf
4ce3ced9057e Fix dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 503
diff changeset
   185
release2sf: validate-release deploy2sf
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   186
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   187
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   188
DEFUN_USER ?= user
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   189
DEFUN_HG_SRV ?= hg.defun.work
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   190
DEFUN_HG_DIR ?= /srv/hg/gadict
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   191
DEFUN_WWW_SRV ?= defun.work
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   192
DEFUN_WWW_DIR ?= /srv/www/gadict
493
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   193
DEFUN_REL_DIR ?= /srv/www/gadict/download
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   194
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   195
.PHONY: deploy2defun
558
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   196
deploy2defun: deploy2defun-www deploy2defun-dist deploy2defun-hg
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
   197
558
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   198
.PHONY: deploy2defun-hg
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   199
deploy2defun-hg:
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   200
	hg push ssh://$(DEFUN_USER)@$(DEFUN_HG_SRV)/$(DEFUN_HG_DIR) || [ $$? = 1 ]
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   201
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   202
.PHONY: deploy2defun-www
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   203
deploy2defun-www: $(HTML_FILES)
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   204
	( \
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   205
echo 'cd $(DEFUN_WWW_DIR)'; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   206
for f in $(HTML_FILES); do \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   207
  n=$${f##*/}; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   208
  echo "put $$f $$n"; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   209
  echo "chmod 644 $$n"; \
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   210
done; \
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   211
echo 'quit'; \
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   212
) | sftp -b - $(DEFUN_USER)@$(DEFUN_WWW_SRV)
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   213
494
f931ef10c1b0 Rename target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 493
diff changeset
   214
.PHONY: deploy2defun-dist
f931ef10c1b0 Rename target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 493
diff changeset
   215
deploy2defun-dist: $(DISTREL_TARBALLS) $(DISTSRC_TARBALLS)
493
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   216
	( \
496
9ddd305404e6 Fix: sftp: Couldn't create directory: Failure
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 494
diff changeset
   217
echo "-mkdir $(DEFUN_REL_DIR)"; \
9ddd305404e6 Fix: sftp: Couldn't create directory: Failure
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 494
diff changeset
   218
echo "-mkdir $(DEFUN_REL_DIR)/v$(vmajor).$(vminor)"; \
493
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   219
echo "cd $(DEFUN_REL_DIR)/v$(vmajor).$(vminor)"; \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   220
for f in $(DISTREL_TARBALLS) $(DISTSRC_TARBALLS); do \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   221
  n=$${f##*/}; \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   222
  echo "put $$f $$n"; \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   223
  echo "chmod 644 $$n"; \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   224
done; \
8bfe8d4ad4a4 deploy2defun-distrel
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 482
diff changeset
   225
) | sftp -b - $(DEFUN_USER)@$(DEFUN_WWW_SRV)
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   226
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   227
SF_USER ?= gavenkoa
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   228
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   229
# First time you deploy to SourceForge (sf) you need manually login to:
120
cb5ab06a72a7 Inline URL to make code more verbose.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 119
diff changeset
   230
#   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   231
# as it may require interactive input for accepting server public key.
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   232
# Next time any action fully automated.
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   233
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   234
.PHONY: deploy2sf
558
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   235
deploy2sf: deploy2sf-www deploy2sf-dist deploy2sf-voa deploy2sf-hg
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   236
558
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   237
.PHONY: deploy2sf-hg
53fd793e345d Add shortcut to deploy to HG repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 557
diff changeset
   238
deploy2sf-hg:
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   239
	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(pkgname)/code || [ $$? = 1 ]
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   240
119
20f1d1080886 Rename 'name' ==> 'pkgname'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 118
diff changeset
   241
# Will be accessed via http://$(pkgname).sourceforge.net
338
61a9d2de0e3e New home page. SF is used as mirror.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 313
diff changeset
   242
.PHONY: deploy2sf-www
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   243
deploy2sf-www: $(HTML_FILES)
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   244
	( echo 'cd htdocs'; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   245
for f in $(HTML_FILES); do \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   246
  n=$${f##*/}; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   247
  echo "put $$f $$n"; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   248
  echo "chmod 644 $$n"; \
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   249
done; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   250
echo 'quit'; \
120
cb5ab06a72a7 Inline URL to make code more verbose.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 119
diff changeset
   251
) | sftp -b - $(SF_USER),$(pkgname)@web.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   252
308
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   253
.PHONY: deploy2sf-voa
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   254
deploy2sf-voa: voa
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   255
	( echo 'cd htdocs'; \
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   256
  echo "put voa-special.pdf"; \
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   257
  echo "chmod 644 voa-special.pdf"; \
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   258
echo 'quit'; \
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   259
) | sftp -b - $(SF_USER),$(pkgname)@web.sourceforge.net
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   260
501
3ebfd12fc276 Enable release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 499
diff changeset
   261
.PHONY: deploy2sf-dist
3ebfd12fc276 Enable release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 499
diff changeset
   262
deploy2sf-dist: $(DISTREL_TARBALLS) $(DISTSRC_TARBALLS)
287
d01045b55e04 Avoid names inlining.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 276
diff changeset
   263
	( echo 'cd /home/frs/project/$(shell v=$(pkgname); echo $${v:0:1}/$${v:0:2})/$(pkgname)'; \
503
6a32a94eeab2 Fix dist release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   264
echo "put  www/README.rst"; \
115
1c6ffaecdf50 Fix sftp command usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 112
diff changeset
   265
echo "chmod 644 README.rst"; \
496
9ddd305404e6 Fix: sftp: Couldn't create directory: Failure
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 494
diff changeset
   266
echo "-mkdir v$(vmajor).$(vminor)"; \
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   267
echo "cd v$(vmajor).$(vminor)"; \
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   268
for f in $(DISTREL_TARBALLS) $(DISTSRC_TARBALLS); do \
503
6a32a94eeab2 Fix dist release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   269
  n=$${f##*/}; \
6a32a94eeab2 Fix dist release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   270
  echo "put $$f $$n"; \
6a32a94eeab2 Fix dist release to SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   271
  echo "chmod 644 $$n"; \
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   272
done; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   273
echo 'quit'; \
120
cb5ab06a72a7 Inline URL to make code more verbose.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 119
diff changeset
   274
) | sftp -b - $(SF_USER),$(pkgname)@frs.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   275
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   276
.PHONY: validate-release
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   277
validate-release:
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   278
	\
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   279
case ${visclean} in \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   280
  no) echo "Local changes found. Build stop."; \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   281
    exit 1;; \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   282
esac
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   283
	\
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   284
case $(vatrelease) in \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   285
  no) echo "We are not at release. Build stop."; \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   286
    exit 1;; \
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   287
esac
124
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   288
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   289
################################################################
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   290
# Dist targets.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   291
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   292
.PHONY: dist
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   293
dist: dist-rel dist-src
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   294
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   295
.PHONY: dist-rel
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   296
dist-rel: $(DISTREL_TARBALLS)
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   297
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   298
DISTREL_DICTDZ_FILES := $(patsubst %,dist/$(fullpkgname)/dictd/%,$(notdir $(DICTDZ_FILES)))
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   299
DISTREL_INDEX_FILES := $(patsubst %,dist/$(fullpkgname)/dictd/%,$(notdir $(INDEX_FILES)))
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   300
DISTREL_RST_FILES := $(patsubst %,dist/$(fullpkgname)/doc/txt/%,$(notdir $(RST_FILES)))
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   301
DISTREL_HTML_FILES := $(patsubst %,dist/$(fullpkgname)/doc/html/%,$(notdir $(RST_HTML_FILES)))
545
15e5f62b2f6f Include import files in tab format for SRS to release bundle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 536
diff changeset
   302
DISTREL_SRS_TAB_FILES := $(patsubst %,dist/$(fullpkgname)/srs/%,$(notdir $(SRS_TAB_FILES)))
557
d7a42a700255 Package Anki files to binary release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 555
diff changeset
   303
DISTREL_SRS_ANKI_FILES := $(patsubst %,dist/$(fullpkgname)/srs/%,$(notdir $(SRS_ANKI_FILES)))
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   304
557
d7a42a700255 Package Anki files to binary release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 555
diff changeset
   305
dist/$(fullpkgname).tar.gz: $(DISTREL_DICTDZ_FILES) $(DISTREL_INDEX_FILES) $(DISTREL_SRS_TAB_FILES) $(DISTREL_SRS_ANKI_FILES) $(DISTREL_RST_FILES) $(DISTREL_HTML_FILES) $(BUILD_SCRIPTS)
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   306
	rm -rf $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   307
	tar zcf $@ -C dist/ $(fullpkgname)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   308
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   309
dist/$(fullpkgname).zip: $(DISTREL_DICTDZ_FILES) $(DISTREL_INDEX_FILES) $(DISTREL_RST_FILES) $(DISTREL_HTML_FILES) $(BUILD_SCRIPTS)
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   310
	rm -rf $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   311
	cd $(dir $@) && zip -r $(notdir $@) $(fullpkgname)
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   312
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   313
$(DISTREL_DICTDZ_FILES) $(DISTREL_INDEX_FILES): dist/$(fullpkgname)/dictd/%: dist/dictd/% | dist/$(fullpkgname)/dictd/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   314
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   315
545
15e5f62b2f6f Include import files in tab format for SRS to release bundle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 536
diff changeset
   316
$(DISTREL_SRS_TAB_FILES): dist/$(fullpkgname)/srs/%: dist/srs/% | dist/$(fullpkgname)/srs/
15e5f62b2f6f Include import files in tab format for SRS to release bundle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 536
diff changeset
   317
	cp $< $@
15e5f62b2f6f Include import files in tab format for SRS to release bundle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 536
diff changeset
   318
557
d7a42a700255 Package Anki files to binary release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 555
diff changeset
   319
$(DISTREL_SRS_ANKI_FILES): dist/$(fullpkgname)/srs/%: dist/srs/% | dist/$(fullpkgname)/srs/
d7a42a700255 Package Anki files to binary release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 555
diff changeset
   320
	cp $< $@
d7a42a700255 Package Anki files to binary release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 555
diff changeset
   321
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   322
$(DISTREL_RST_FILES): dist/$(fullpkgname)/doc/txt/%: www/% | dist/$(fullpkgname)/doc/txt/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   323
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   324
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   325
$(DISTREL_HTML_FILES): dist/$(fullpkgname)/doc/html/%: dist/www/% | dist/$(fullpkgname)/doc/html/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   326
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   327
545
15e5f62b2f6f Include import files in tab format for SRS to release bundle.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 536
diff changeset
   328
$(patsubst %,dist/$(fullpkgname)/%, dictd/ srs/ doc/txt/ doc/html/):
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   329
	mkdir -p $@
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   330
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   331
.PHONY: dist-src
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   332
dist-src: $(DISTSRC_TARBALLS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   333
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   334
DISTSRC_GADICT_FILES := $(patsubst %,dist/$(fullpkgname)_src/%,$(GADICT_FILES))
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   335
DISTSRC_PY_FILES := $(patsubst %,dist/$(fullpkgname)_src/py/%,$(notdir $(PY_FILES)))
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   336
DISTSRC_RST_FILES := $(patsubst %,dist/$(fullpkgname)_src/www/%,$(notdir $(RST_FILES)))
481
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   337
DISTSRC_TMPL_FILES := $(patsubst %,dist/$(fullpkgname)_src/www/tmpl/%, rst.css rst.tmpl.in)
480
4413ccc9e216 Include VERSION file into source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 479
diff changeset
   338
DISTSRC_BUILD_SCRIPTS := $(patsubst %,dist/$(fullpkgname)_src/%, Makefile VERSION)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   339
481
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   340
dist/$(fullpkgname)_src.tar.gz: $(DISTSRC_GADICT_FILES) $(DISTSRC_PY_FILES) $(DISTSRC_RST_FILES) $(DISTSRC_TMPL_FILES) $(DISTSRC_BUILD_SCRIPTS) $(BUILD_SCRIPTS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   341
	rm -rf $@
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   342
	tar zcf $@ -C dist/ $(fullpkgname)_src
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   343
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   344
$(DISTSRC_GADICT_FILES): dist/$(fullpkgname)_src/%: % | dist/$(fullpkgname)_src/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   345
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   346
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   347
$(DISTSRC_PY_FILES): dist/$(fullpkgname)_src/py/%: py/% | dist/$(fullpkgname)_src/py/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   348
	cp $< $@
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   349
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   350
$(DISTSRC_RST_FILES): dist/$(fullpkgname)_src/www/%: www/% | dist/$(fullpkgname)_src/www/
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   351
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   352
481
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   353
$(DISTSRC_TMPL_FILES): dist/$(fullpkgname)_src/www/tmpl/%: www/tmpl/% | dist/$(fullpkgname)_src/www/tmpl/
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   354
	cp $< $@
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   355
480
4413ccc9e216 Include VERSION file into source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 479
diff changeset
   356
$(DISTSRC_BUILD_SCRIPTS): dist/$(fullpkgname)_src/%: % | dist/$(fullpkgname)_src/
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   357
	cp $< $@
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   358
481
f2b8c358716d Include HTML template to allow full build from distribution tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 480
diff changeset
   359
dist/$(fullpkgname)_src/ $(patsubst %,dist/$(fullpkgname)_src/%, py/ www/ www/tmpl/):
478
740943860879 Add new target for binary distribution and update target for source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 441
diff changeset
   360
	mkdir -p $@
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   361
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   362
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   363
# Build targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   364
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   365
.PHONY: all
245
5b9fac360762 Rename target to avoid disambiguate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 241
diff changeset
   366
all: dict
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   367
431
4ec7d0ea1602 Fix: ".name" and ".url" intermediate files for dictd automatically removed by GNU make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 429
diff changeset
   368
.PHONY: dict dictd c5
4ec7d0ea1602 Fix: ".name" and ".url" intermediate files for dictd automatically removed by GNU make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 429
diff changeset
   369
dictd c5: dict
245
5b9fac360762 Rename target to avoid disambiguate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 241
diff changeset
   370
dict: $(DICTDZ_FILES) $(INDEX_FILES)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   371
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   372
#  --case-sensitive
404
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   373
dist/dictd/%.dict dist/dictd/%.index: dist/dictd/%.c5 dist/dictd/%.c5.name dist/dictd/%.c5.url $(MAKEFILE_LIST)
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   374
	(cd dist/dictd; dictfmt  -c5 --headword-separator '; ' --break-headwords --utf8 --allchars -s "`cat $*.c5.name`" -u "`cat $*.c5.url`"  $*)  < $<
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   375
387
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   376
dist/dictd/%.dict.dz: dist/dictd/%.dict
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   377
	dictzip -c $< >$@
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   378
431
4ec7d0ea1602 Fix: ".name" and ".url" intermediate files for dictd automatically removed by GNU make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 429
diff changeset
   379
GADICT_SUFFIXES := en-ru+uk en-ru en-uk voa
4ec7d0ea1602 Fix: ".name" and ".url" intermediate files for dictd automatically removed by GNU make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 429
diff changeset
   380
.SECONDARY: $(patsubst %,dist/dictd/gadict_%.c5.name,$(GADICT_SUFFIXES))
4ec7d0ea1602 Fix: ".name" and ".url" intermediate files for dictd automatically removed by GNU make.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 429
diff changeset
   381
.SECONDARY: $(patsubst %,dist/dictd/gadict_%.c5.url,$(GADICT_SUFFIXES))
404
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   382
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   383
dist/dictd/%.c5.name dist/dictd/%.c5.url: dist/dictd/%.c5
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   384
	:
cdfa6dfa9072 Integrate dictionary metainfo line name and home page url into dictd build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 401
diff changeset
   385
396
4f16fb80b2a7 Suppress __pycache__ dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 393
diff changeset
   386
# -B  suppress __pycache__ dir
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   387
dist/dictd/gadict_en-ru+uk.c5: gadict_en-ru+uk.gadict py/gadict.py py/gadict_c5.py | dist/dictd/
410
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   388
	python3 -B py/gadict_c5.py  $< $@
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   389
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   390
dist/dictd/gadict_en-ru.c5: gadict_en-ru+uk.gadict py/gadict.py py/gadict_c5.py | dist/dictd/
410
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   391
	python3 -B py/gadict_c5.py  $< $@ ru
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   392
	echo "gadict En-Ru"> dist/dictd/gadict_en-ru.c5.name
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   393
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   394
dist/dictd/gadict_en-uk.c5: gadict_en-ru+uk.gadict py/gadict.py py/gadict_c5.py | dist/dictd/
410
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   395
	python3 -B py/gadict_c5.py  $< $@ uk
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   396
	echo "gadict En-Uk"> dist/dictd/gadict_en-uk.c5.name
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   397
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   398
dist/dictd/gadict_voa.c5: gadict_voa.gadict py/gadict.py py/gadict_c5.py | dist/dictd/
410
65b38ec04ea4 Include VOA in build. Make possible separate Ru/Uk build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   399
	python3 -B py/gadict_c5.py  $< $@ en
387
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   400
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   401
dist/dictd/:
387
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   402
	mkdir -p $@
1616fc7c1f09 Start using "gadict.py".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 384
diff changeset
   403
536
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   404
.PHONY: srs
555
4a3188fc8951 Generating Packaged Anki Desk files for Anki space repetition software.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
   405
srs: $(SRS_ANKI_FILES) $(SRS_TAB_FILES)
4a3188fc8951 Generating Packaged Anki Desk files for Anki space repetition software.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
   406
564
93d0bdb815a1 Separate target to build anki files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 558
diff changeset
   407
.PHONY: anki
93d0bdb815a1 Separate target to build anki files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 558
diff changeset
   408
anki: $(SRS_ANKI_FILES)
93d0bdb815a1 Separate target to build anki files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 558
diff changeset
   409
555
4a3188fc8951 Generating Packaged Anki Desk files for Anki space repetition software.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
   410
dist/srs/%.apkg: %.gadict py/gadict.py py/gadict_srs_anki.py $(MAKEFILE_LIST) | dist/srs/
4a3188fc8951 Generating Packaged Anki Desk files for Anki space repetition software.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
   411
	PYTHONPATH=/usr/share/anki: python -B py/gadict_srs_anki.py $< $@
536
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   412
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   413
dist/srs/gadict_en-ru+uk.tab.txt: gadict_en-ru+uk.gadict py/gadict.py py/gadict_srs_tab.py $(MAKEFILE_LIST) | dist/srs/
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   414
	python3 -B py/gadict_srs_tab.py  $< $@ ru,uk
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   415
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   416
dist/srs/gadict_voa.tab.txt: gadict_voa.gadict py/gadict.py py/gadict_srs_tab.py $(MAKEFILE_LIST) | dist/srs/
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   417
	python3 -B py/gadict_srs_tab.py  $< $@
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   418
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   419
dist/srs/:
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   420
	mkdir -p $@
c9f0064d8661 Generate import file for space repetition software in TAB format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 505
diff changeset
   421
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   422
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   423
# Install/uninstall targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   424
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   425
.PHONY: install
148
b0142666eeba Fix dependency for 'install' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 146
diff changeset
   426
install: $(DICTDZ_FILES) $(INDEX_FILES)
389
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   427
	mkdir -p $(datadir) $(elispdir)
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   428
	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
121
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
   429
		$(INSTALL_DATA) $$f $(datadir); \
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   430
	done
389
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   431
	$(INSTALL_DATA) contrib/gadict.el $(elispdir)
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   432
	emacs -batch -f batch-byte-compile $(elispdir)/gadict.el
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   433
384
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   434
OLD_DICT_FILES := gadict-abbr.dict-c5 gadict-adjective-en-ru.dict-c5 \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   435
gadict-adverb-en-ru.dict-c5 gadict-conjunction-en-ru.dict-c5            \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   436
gadict-en-ru.dict-c5 gadict-irregular-verbs-en-ru.dict-c5               \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   437
gadict-numeral-en-ru.dict-c5 gadict-phrasal-verbs-en-ru.dict-c5         \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   438
gadict-preposition-en-ru.dict-c5 gadict-pronoun-en-ru.dict-c5           \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   439
gadict-regular-verbs-en-ru.dict-c5
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   440
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   441
OLD_DICTDZ_FILES := $(OLD_DICT_FILES:.dict-c5=.dict.dz)
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   442
OLD_INDEX_FILES := $(OLD_DICT_FILES:.dict-c5=.index)
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   443
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   444
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   445
uninstall:
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   446
	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   447
		rm -f $(datadir)/$$f; \
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
   448
	done
384
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   449
	for f in $(OLD_DICTDZ_FILES) $(OLD_INDEX_FILES); do \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   450
		rm -f $(datadir)/$$f; \
3af39c0b5229 A way to uninstall old C5 dictionaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   451
	done
389
10020d94a315 Install/uninstall "gadict.el".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 388
diff changeset
   452
	rm -f $(elispdir)/gadict.el $(elispdir)/gadict.elc
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
   453
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   454
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   455
# Documentation targets.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   456
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   457
.PHONY: docs
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   458
docs: html
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   459
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   460
.PHONY: html
441
1a49797cea41 Build STAT.html file also on "html" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 439
diff changeset
   461
html: $(HTML_FILES)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   462
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   463
$(INDEX_HTML_FILE): dist/www/README.html
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   464
	cp $< $@
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   465
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   466
$(RST_HTML_FILES): dist/www/%.html: www/%.rst $(RST_CSS_FILE) $(RST_TMPL_FILE) $(BUILD_SCRIPTS) | dist/www/
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   467
	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=$(RST_CSS_FILE) --template=$(RST_TMPL_FILE)  www/$*.rst  $@
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   468
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   469
dist/www/:
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   470
	mkdir -p $@
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   471
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   472
$(RST_TMPL_FILE): www/tmpl/rst.tmpl.in $(BUILD_SCRIPTS) | $(dir $(RST_TMPL_FILE))
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   473
	\
482
fefea56726d2 Warn if build done without version file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 481
diff changeset
   474
[[ "${visclean}" = no ]] && warn1='<b>Warning</b>: Build done with local changes!' || :; \
fefea56726d2 Warn if build done without version file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 481
diff changeset
   475
[[ -z "${visclean}" ]] && warn1='<b>Warning</b>: Build done without <b>VERSION</b> file!' || :; \
fefea56726d2 Warn if build done without version file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 481
diff changeset
   476
[[ "${vatrelease}" = no ]] && warn2='<b>Warning</b>: Build is far from latest <tt>$(vtag)</tt> release state by $(vtagdist) changes.' || :; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   477
sed -e "s|{date}|$$(date +%F)|" -e "s|{rev}|$$(hg id -i)|" -e "s|{warn1}|$$warn1|" -e "s|{warn2}|$$warn2|" <$< >$@
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   478
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   479
################################################################
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   480
# Article statistics.
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   481
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   482
.PHONY: stat
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   483
stat: $(STAT_HTML_FILE)
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   484
547
f571a9e4e70c Fix: directory without trailing "/" is not created.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 545
diff changeset
   485
$(STAT_HTML_FILE): $(STAT_RST_FILE) $(RST_CSS_FILE) $(RST_TMPL_FILE) | $(dir $(STAT_HTML_FILE))
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   486
	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=$(RST_CSS_FILE) --template=$(RST_TMPL_FILE)  $<  $@
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   487
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   488
$(STAT_RST_FILE): $(GADICT_FILES) $(BUILD_SCRIPTS) | $(dir $(STAT_RST_FILE))
109
5bb58b8d87a7 Add version info into documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 108
diff changeset
   489
	{ \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   490
echo '==========================='; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   491
echo ' gadict project statistics'; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   492
echo '==========================='; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   493
echo '.. contents::'; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   494
echo '   :local:'; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   495
echo; \
429
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   496
echo "Entries count"; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   497
echo "============="; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   498
echo; \
428
8598efaef822 Align STAT table columns to the right.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 427
diff changeset
   499
echo '.. class:: right'; \
8598efaef822 Align STAT table columns to the right.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 427
diff changeset
   500
echo; \
427
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   501
echo '=================================== ======='; \
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   502
echo '        Dictionary                  Entries'; \
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   503
echo '=================================== ======='; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   504
total=0; \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   505
for dic in $(GADICT_FILES); do \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   506
  cnt=`grep '^__' $$dic | wc -l`; \
427
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   507
  printf '%35s %7s\n' $${dic%.dict-c5} $$cnt; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   508
  total=$$(($$total + $$cnt)); \
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   509
done; \
427
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   510
printf '%35s %7s\n' '**Total**' $$total; \
cc2a83d4d2f8 Make STAT table a little smaller.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 424
diff changeset
   511
echo '=================================== ======='; \
429
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   512
echo; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   513
echo "Translations count"; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   514
echo "=================="; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   515
echo; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   516
echo '.. class:: right'; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   517
echo; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   518
echo '==================== ============'; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   519
echo '   gadict_en-ru+uk   Translations'; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   520
echo '==================== ============'; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   521
ru_tr=`grep '^ru: ' gadict_en-ru+uk.gadict | wc -l`; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   522
uk_tr=`grep '^uk: ' gadict_en-ru+uk.gadict | wc -l`; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   523
printf '%20s Ru\n' $$ru_tr; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   524
printf '%20s Uk\n' $$uk_tr; \
e721e428b909 Translations count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   525
echo '==================== ============'; \
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   526
} >$@
276
66db1bbebe45 Generalise RST build code. Remove index.rst, use README.rst instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 275
diff changeset
   527
424
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   528
dist/misc/:
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   529
	mkdir -p $@
98c8f14fc972 Fix "stat" target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 410
diff changeset
   530
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   531
################################################################
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   532
# Misc targets.
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   533
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   534
.PHONY: logo
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   535
logo: logo-png
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   536
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   537
.PHONY: logo-png
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   538
logo-png: $(LOGO_PNG_FILES)
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   539
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   540
# Require:
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   541
#   $ sudo apt-get install imagemagick librsvg2-bin
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   542
$(LOGO_PNG_FILES): $(LOGO_NAME)-%.png: $(LOGO_SVG)
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   543
	convert +antialias -background transparent $< -resize $* $@
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   544
308
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   545
.PHONY: voa
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   546
voa: voa-special.pdf
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   547
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   548
voa-special.pdf: contrib/voa-special.tex
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   549
	$(LATEX2PDF) -output-directory . $<
7a5f4265a581 Build and deploy VOA in PDF format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 287
diff changeset
   550
275
9f70f66ee2a1 Merge with 'ffead' project. Most significant is generating different sizes PNG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 274
diff changeset
   551
################################################################
108
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   552
# Helpers targets.
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   553
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   554
.PHONY: help
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   555
help:
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   556
	@\
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   557
echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   558
echo Current configuration:; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   559
echo; \
480
4413ccc9e216 Include VERSION file into source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 479
diff changeset
   560
sed 's=^=  =' <$(VER_FILE)
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   561
	@if [ -f Makefile.config ]; then \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   562
		echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   563
		echo User configuration:; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   564
		echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   565
		sed 's=^=  =' <Makefile.config; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   566
	fi
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   567
	@\
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   568
echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   569
echo Supported targets:; \
123
49f373dba523 Fix output sanity.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 122
diff changeset
   570
echo; \
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
   571
sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPTS)
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   572
249
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   573
.PHONY: todo
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   574
todo:
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   575
	grep -nH 'TODO\|XXX' $(RST_FILES) $(C5_FILES)
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   576
241
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   577
.PHONY: logo-png
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   578
logo-png: logo-64x64.png
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   579
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   580
# Require:
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   581
#   $ sudo apt-get install imagemagick librsvg2-bin
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   582
%.png: %.svg
274
f0b6d4c0ee97 Set transparent background for PNG logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 261
diff changeset
   583
	convert +antialias -background transparent $< $@
241
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   584
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   585
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   586
# Clean targets.
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   587
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   588
.PHONY: distclean
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   589
distclean: clean
480
4413ccc9e216 Include VERSION file into source distribution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 479
diff changeset
   590
	rm -rf $(VER_FILE)
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
   591
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   592
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   593
clean:
339
4d8d46bbe30d Move RST files to separate directory. Build HTML files out of sources
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   594
	rm -rf dist/
63
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   595