Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 23 Oct 2013 23:37:55 +0300
changeset 274 f0b6d4c0ee97
parent 261 30c6f0eb02db
child 275 9f70f66ee2a1
permissions -rw-r--r--
Set transparent background for PNG logo.
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.
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    15
#   DESTDIR     Prefix to 'prefix' variable value.
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    16
260
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    17
################################################################
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    18
# Standard GNU Makefile settings.
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    19
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    20
SHELL = /bin/sh
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    21
export PATH := /bin:/usr/bin:${PATH}
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    22
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    23
# Disable built in pattern rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    24
MAKEFLAGS += -r
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    25
# Disable built in variables.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    26
MAKEFLAGS += -R
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    27
# Disable built in suffix rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    28
.SUFFIXES:
260
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    29
# Delete target file if command fails.
5f6befed263c Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
    30
.DELETE_ON_ERROR:
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    31
# Default target.
106
092b25d032af Set 'help' as default target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 105
diff changeset
    32
.DEFAULT_GOAL = help
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    33
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
    34
################################################################
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    35
# Build script definitions.
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    36
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
    37
BUILD_SCRIPTS := $(firstword $(MAKEFILE_LIST))
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    38
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    39
ifneq '' '$(wildcard Makefile.config)'
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    40
  include Makefile.config
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
    41
  BUILD_SCRIPTS += Makefile.config
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    42
endif
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    43
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
    44
################################################################
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    45
# Version extracting/generation.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    46
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    47
# Prevent from deploying and distributing with wrong version.
133
60e2090b7462 Rebuild VERSION file for 'dist' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 132
diff changeset
    48
ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    49
  ifeq '' '$(MAKE_RESTARTS)'
261
30c6f0eb02db Fix: rm: cannot remove `VERSION': No such file or directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 260
diff changeset
    50
    $(info $(shell rm -f VERSION))
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    51
  endif
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
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    54
# Here are vmajor and vminor. Look README section "Versioning rules."
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    55
-include VERSION
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    56
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    57
VERSION:
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    58
	\
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    59
vtagdist=$$(hg log -r . --template '{latesttagdistance}'); \
141
4b799e3f9a70 Allow release from commit that tag release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 137
diff changeset
    60
vatrelease=$$([ $$vtagdist -le 1 ] && echo yes || echo no); \
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    61
vtag=$$(hg log -r . --template '{latesttag}'); \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    62
vmajor=$${vtag#t}; \
151
206fb46e793d Make code more genetic.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 150
diff changeset
    63
vmajor=$${vmajor%%.*}; \
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    64
vminor=$${vtag#*.}; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    65
vrev=$$(hg id -i); \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    66
visclean=$$(case $$vrev in *+) echo no;; *) echo yes;; esac); \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    67
vrev=$${vrev%+}; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    68
{ \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    69
echo "vrev=$$vrev"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    70
echo "vtag=$$vtag"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    71
echo "vtagdist=$$vtagdist"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    72
echo "visclean=$$visclean"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    73
echo "vatrelease=$$vatrelease"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    74
echo "vmajor=$$vmajor"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    75
echo "vminor=$$vminor"; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
    76
} >VERSION
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    77
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    78
################################################################
106
092b25d032af Set 'help' as default target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 105
diff changeset
    79
# Determine platform/environment.
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    80
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    81
host_os = unix
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    82
ifneq '' '$(COMSPEC)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    83
  ifneq '' '$(WINDIR)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    84
    # Probably under Windows.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    85
    host_os = windows
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    86
    ifneq '' '$(wildcard /etc/setup/*cygwin*)'
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    87
      # Probably under Cygwin.
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    88
      host_os = cygwin
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    89
    endif
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    90
  endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    91
endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    92
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    93
################################################################
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    94
# Build tools definition/switches.
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
    95
121
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    96
INSTALL = install
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    97
INSTALL_PROGRAM = $(INSTALL)
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    98
INSTALL_DATA = $(INSTALL) -m 644
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
    99
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   100
RST_WARNING_FLAGS := --halt warning
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   101
RST_FLAGS := --strip-comments
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   102
RST_FLAGS += $(RST_WARNING_FLAGS)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   103
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   104
RST2HTML := rst2html
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   105
ifeq '$(host_os)' 'cygwin'
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   106
  RST2HTML := rst2html.py
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   107
endif
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   108
RST2HTML_FLAGS := $(RST_FLAGS)
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   109
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   110
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   111
# Install paths.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   113
ifeq '$(origin prefix)' 'undefined'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   114
  ifeq '$(shell id -u)' '0'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   115
    prefix = /usr/local
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   116
  else
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   117
    prefix = $(HOME)/usr
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   118
  endif
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   119
endif
121
38e8a1063673 Add 'DESTDIR' - prefix to 'prefix' variable value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
   120
datarootdir := $(DESTDIR)$(prefix)/share
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   121
datadir = $(datarootdir)/dictd
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   123
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   124
# Project dirs/files.
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
   125
50
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   126
C5_FILES := $(wildcard *.dict-c5)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   127
DICT_FILES := $(C5_FILES:.dict-c5=.dict)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   128
DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   129
INDEX_FILES := $(C5_FILES:.dict-c5=.index)
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   130
132
236e638526a5 Add dependency on STAT.rst and VERSION.rst.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
   131
RST_FILES := $(sort $(wildcard *.rst) STAT.rst VERSION.rst)
206
407f2a82ef26 Include common header for quick links. Exclude unnecessary .html files from build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 204
diff changeset
   132
HTML_FILES := $(filter-out VERSION.html header.html,$(RST_FILES:.rst=.html))
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   133
119
20f1d1080886 Rename 'name' ==> 'pkgname'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 118
diff changeset
   134
pkgname = gadict
20f1d1080886 Rename 'name' ==> 'pkgname'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 118
diff changeset
   135
fullpkgname = $(pkgname)-$(vmajor).$(vminor)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   136
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   137
DIST_DIR = $(fullpkgname)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   138
DISTSRC_DIR = $(fullpkgname)_src
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   139
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   140
DIST_FILES = $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_FILES) VERSION
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   141
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   142
DISTSRC_HELPER_FILES = VERSION Makefile rst.css .dir-locals.el
204
f93358e8be5b Exclude .html files from src bundle as they can be recreated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 152
diff changeset
   143
DISTSRC_FILES = $(C5_FILES) $(RST_FILES) $(DISTSRC_HELPER_FILES)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   144
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   145
DIST_TARBALLS = $(DIST_DIR).tar.gz $(DIST_DIR).tar.bz2
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   146
DISTSRC_TARBALLS = $(DISTSRC_DIR).tar.gz $(DISTSRC_DIR).tar.bz2
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   147
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   148
################################################################
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   149
# Deploy targets.
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   150
118
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
   151
ifeq '' '$(SF_USER)'
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
   152
  SF_USER := gavenkoa
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
   153
endif
c9ce7b6ae3bc Make SourceForge user name as configurable parameter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 115
diff changeset
   154
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   155
.PHONY: deploy
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   156
deploy: deploy2sf
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   157
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   158
# 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
   159
#   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   160
# as it may require interactive input for accepting server public key.
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   161
# Next time any action fully automated.
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   162
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   163
.PHONY: deploy2sf
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   164
deploy2sf: deploy2sf-doc deploy2sf-release deploy2sf-src
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   165
119
20f1d1080886 Rename 'name' ==> 'pkgname'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 118
diff changeset
   166
# Will be accessed via http://$(pkgname).sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   167
.PHONY: deploy2sf-doc
125
63b391bee058 Add dependency to 'deploy*' targets on 'deploy-check' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 124
diff changeset
   168
deploy2sf-doc: deploy-check $(HTML_FILES)
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   169
	( echo 'cd htdocs'; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   170
for f in $(HTML_FILES); do \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   171
  echo "put $$f"; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   172
  echo "chmod 644 $$f"; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   173
done; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   174
echo 'quit'; \
120
cb5ab06a72a7 Inline URL to make code more verbose.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 119
diff changeset
   175
) | sftp -b - $(SF_USER),$(pkgname)@web.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   176
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   177
.PHONY: deploy2sf-release
125
63b391bee058 Add dependency to 'deploy*' targets on 'deploy-check' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 124
diff changeset
   178
deploy2sf-release: deploy-check $(DIST_TARBALLS) $(DISTSRC_TARBALLS)
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   179
	( echo 'cd /home/frs/project/g/ga/gadict'; \
115
1c6ffaecdf50 Fix sftp command usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 112
diff changeset
   180
echo "put  README.rst"; \
1c6ffaecdf50 Fix sftp command usage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 112
diff changeset
   181
echo "chmod 644 README.rst"; \
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   182
echo "mkdir v$(vmajor).$(vminor)"; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   183
echo "cd v$(vmajor).$(vminor)"; \
142
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 141
diff changeset
   184
for f in $(DIST_TARBALLS) $(DISTSRC_TARBALLS); do \
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   185
	echo "put $$f"; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   186
	echo "chmod 644 $$f"; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   187
done; \
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   188
echo 'quit'; \
120
cb5ab06a72a7 Inline URL to make code more verbose.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 119
diff changeset
   189
) | sftp -b - $(SF_USER),$(pkgname)@frs.sourceforge.net
111
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   190
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   191
.PHONY: deploy2sf-src
84fe35f49224 Add 'deploy' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 110
diff changeset
   192
deploy2sf-src:
239
acd65d2fff84 Ignore error code 1 to prevent build from fail as it mark "good" behaviour.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 228
diff changeset
   193
	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
   194
124
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   195
.PHONY: deploy-check
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   196
deploy-check:
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   197
	case ${visclean} in \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   198
		no) echo "Local changes found. Build stop."; \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   199
			exit 1;; \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   200
	esac
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   201
	case $(vatrelease) in \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   202
		no) echo "We are not at release. Build stop."; \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   203
			exit 1;; \
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   204
	esac
7d9f38580ed9 Add 'deploy-check' target to check source sanity before release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 123
diff changeset
   205
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   206
################################################################
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   207
# Dist targets.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   208
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   209
.PHONY: dist
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   210
dist: dist-dictd dist-src
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   211
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   212
.PHONY: dist-dictd
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   213
dist-dictd: $(DIST_TARBALLS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   214
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   215
.PHONY: dist-src
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   216
dist-src: $(DISTSRC_TARBALLS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   217
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   218
%.tar.gz: %
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   219
	tar zcf $*.tar.gz $*
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   220
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   221
%.tar.bz2: %
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   222
	tar jcf $*.tar.bz2 $*
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   223
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   224
$(DIST_DIR): $(DIST_FILES)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   225
	rm -rf $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   226
	mkdir $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   227
	cp $(DIST_FILES) $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   228
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   229
$(DISTSRC_DIR): $(DISTSRC_FILES)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   230
	rm -rf $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   231
	mkdir $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   232
	cp $(DISTSRC_FILES) $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   233
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   234
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   235
# Build targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   236
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   237
.PHONY: all
245
5b9fac360762 Rename target to avoid disambiguate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 241
diff changeset
   238
all: dict
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   239
245
5b9fac360762 Rename target to avoid disambiguate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 241
diff changeset
   240
.PHONY: dict
5b9fac360762 Rename target to avoid disambiguate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 241
diff changeset
   241
dict: $(DICTDZ_FILES) $(INDEX_FILES)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   242
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   243
#  --case-sensitive
50
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   244
%.dict %.index: %.dict-c5
46
86c0184efac7 Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
   245
	sed '/^#/d' $< | dictfmt  -c5 \
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   246
	--headword-separator '; ' --break-headwords \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   247
	--utf8 --allchars \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   248
	-u "`sed -n '\|http://[[:print:]]\+/|{s=^.*\(http://\)=\1=;p;q;}' $<`" \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   249
	-s "`sed -n '/^ABOUT: /{s=ABOUT: ==;p;q;}' $<`" \
46
86c0184efac7 Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
   250
	$*
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   251
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   252
%.dict.dz: %.dict
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   253
	dictzip -c $< >$@
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   254
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   255
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   256
# Install/uninstall targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   257
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   258
.PHONY: install
148
b0142666eeba Fix dependency for 'install' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 146
diff changeset
   259
install: $(DICTDZ_FILES) $(INDEX_FILES)
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   260
	mkdir -p $(datadir)
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   261
	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
   262
		$(INSTALL_DATA) $$f $(datadir); \
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   263
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   264
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   265
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   266
uninstall:
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   267
	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   268
		rm -f $(datadir)/$$f; \
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
   269
	done
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
   270
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   271
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   272
# Documentation targets.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   273
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   274
.PHONY: html
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   275
html: $(HTML_FILES)
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   276
206
407f2a82ef26 Include common header for quick links. Exclude unnecessary .html files from build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 204
diff changeset
   277
$(HTML_FILES): %.html: %.rst header.rst rst.css VERSION.rst $(BUILD_SCRIPTS)
107
4cfb94e11b5d Add warning flags to 'rst2html'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 106
diff changeset
   278
	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   279
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
   280
VERSION.rst: VERSION $(BUILD_SCRIPTS)
109
5bb58b8d87a7 Add version info into documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 108
diff changeset
   281
	{ \
127
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   282
	echo 'For ``$(pkgname)`` version: ``$(vmajor).$(vminor)``.'; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   283
	echo; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   284
	case ${visclean} in \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   285
		yes) echo 'Source files are at revision: ``$(vrev)``.';; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   286
		no) echo 'Some source files was modified from revision: ``$(vrev)``.';; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   287
	esac; \
109
5bb58b8d87a7 Add version info into documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 108
diff changeset
   288
	echo; \
127
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   289
	case ${vatrelease} in \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   290
		yes) echo 'Package is at release state.';; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   291
		no) echo 'Package is far from release state by $(vtagdist) changes.';; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   292
	esac; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   293
	echo; \
2fc0561f80ca Include source state info in documentation build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
   294
	echo 'Build date: ``'$$(date +%F)'``.'; \
109
5bb58b8d87a7 Add version info into documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 108
diff changeset
   295
	} >$@
5bb58b8d87a7 Add version info into documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 108
diff changeset
   296
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   297
################################################################
108
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   298
# Helpers targets.
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   299
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   300
.PHONY: help
1f1363141da7 Dump version info with 'version' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
   301
help:
122
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   302
	@\
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   303
echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   304
echo Current configuration:; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   305
echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   306
sed 's=^=  =' <VERSION
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   307
	@if [ -f Makefile.config ]; then \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   308
		echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   309
		echo User configuration:; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   310
		echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   311
		sed 's=^=  =' <Makefile.config; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   312
	fi
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   313
	@\
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   314
echo; \
003356f9e504 Gather all available version info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 121
diff changeset
   315
echo Supported targets:; \
123
49f373dba523 Fix output sanity.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 122
diff changeset
   316
echo; \
150
28cd06b06bb8 Rename BUILD_SCRIPT ==> BUILD_SCRIPTS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 148
diff changeset
   317
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
   318
249
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   319
.PHONY: todo
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   320
todo:
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   321
	grep -nH 'TODO\|XXX' $(RST_FILES) $(C5_FILES)
5ad075a475f2 TODO convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 245
diff changeset
   322
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   323
.PHONY: stat
128
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   324
stat: STAT.rst
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   325
206
407f2a82ef26 Include common header for quick links. Exclude unnecessary .html files from build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 204
diff changeset
   326
STAT.rst: $(C5_FILES) header.rst VERSION.rst $(BUILD_SCRIPTS)
128
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   327
	{ \
206
407f2a82ef26 Include common header for quick links. Exclude unnecessary .html files from build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 204
diff changeset
   328
echo '.. include:: header.rst'; \
407f2a82ef26 Include common header for quick links. Exclude unnecessary .html files from build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 204
diff changeset
   329
echo; \
128
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   330
echo '============================'; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   331
echo ' gadict project statistics.'; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   332
echo '============================'; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   333
echo '.. contents::'; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   334
echo; \
146
6be7851b9650 Inlcude version info in 'STAT.rst'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
   335
echo 'Document version.'; \
6be7851b9650 Inlcude version info in 'STAT.rst'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
   336
echo '================='; \
6be7851b9650 Inlcude version info in 'STAT.rst'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
   337
echo; \
6be7851b9650 Inlcude version info in 'STAT.rst'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
   338
echo '.. include:: VERSION.rst'; \
6be7851b9650 Inlcude version info in 'STAT.rst'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 142
diff changeset
   339
echo; \
222
242db5c0f8ce Add description what table are.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
   340
echo 'Statistics on count of articles in gadict dictionaries.'; \
242db5c0f8ce Add description what table are.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
   341
echo '======================================================='; \
242db5c0f8ce Add description what table are.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
   342
echo; \
242db5c0f8ce Add description what table are.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
   343
echo 'You must know that some words have articles (usually but not always same) in'; \
242db5c0f8ce Add description what table are.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
   344
echo 'several dictionaries. So real count of words is less then total count.'; \
128
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   345
echo; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   346
echo '======================================== ====='; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   347
echo '             Dictionary                  Count'; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   348
echo '======================================== ====='; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   349
total=0; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   350
for dic in $(C5_FILES); do \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   351
  cnt=`grep '^_____' $$dic | wc -l`; \
207
3c96103ced32 Exclude file prefixes from output to dict names shorter (and so more readable).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 206
diff changeset
   352
  printf '%40s %5s\n' $${dic%.dict-c5} $$cnt; \
128
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   353
  total=$$(($$total + $$cnt)); \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   354
done; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   355
printf '%40s %5s\n' '**Total**' $$total; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   356
echo '======================================== ====='; \
ca6ceff4941c Generate "gadict article count" statistic in RST format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 127
diff changeset
   357
} >$@
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   358
241
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   359
.PHONY: logo-png
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   360
logo-png: logo-64x64.png
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   361
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   362
# Require:
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   363
#   $ sudo apt-get install imagemagick librsvg2-bin
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   364
%.png: %.svg
274
f0b6d4c0ee97 Set transparent background for PNG logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 261
diff changeset
   365
	convert +antialias -background transparent $< $@
241
13fcad0b3a84 Add project logo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
   366
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   367
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   368
# Clean targets.
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   369
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   370
.PHONY: distclean
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   371
distclean: clean
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   372
	rm -f VERSION
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
   373
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   374
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   375
clean:
137
6c57b5559f84 Add 'VERSION.rst' to 'clean' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 136
diff changeset
   376
	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) STAT.rst VERSION.rst
110
bf134608773d Merge with Makefile from 'jdone' project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 109
diff changeset
   377
	rm -rf $(DIST_DIR) $(DIST_TARBALLS)
bf134608773d Merge with Makefile from 'jdone' project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 109
diff changeset
   378
	rm -rf $(DISTSRC_DIR) $(DISTSRC_TARBALLS)
63
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   379