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