Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 12 Jan 2012 23:01:02 +0200
changeset 105 35cc545ec03d
parent 103 b5b1dc62bdc0
child 106 092b25d032af
permissions -rw-r--r--
'clean'-like targets delete artefacts after 'dist' targets.
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
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    10
#   install-local install dictionaries in user HOME dir, so they been available in stardict for that user
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    11
#   uninstall-local remove dictionaries from user HOME directory
26
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    12
#   install-local-symlink create symlink from installed dir to user HOME dir, so dictionaries been available in stardict
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    13
#   uninstall-local-symlink remove symlink from user HOME directory
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    14
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    15
SHELL = /bin/sh
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    16
export PATH := /bin:/usr/bin:${PATH}
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    17
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    18
# Disable built in pattern rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    19
MAKEFLAGS += -r
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    20
# Disable built in variables.
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 suffix rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    23
.SUFFIXES:
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    24
# Default target.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    25
.DEFAULT_GOAL = all
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    26
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
    27
################################################################
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    28
# Version extracting/generation.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    29
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    30
# Prevent from deploying and distributing with wrong version.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    31
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    32
  ifeq '' '$(MAKE_RESTARTS)'
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    33
    $(info $(shell rm VERSION))
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    34
  endif
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    35
endif
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    36
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    37
# Here are vmajor and vminor. Look README section "Versioning rules."
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    38
-include VERSION
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    39
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    40
VERSION:
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    41
	ver=$$(hg log -r . --template '{latesttag}'); \
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    42
ver=$${ver#t}; \
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    43
major=$${ver%.*}; \
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    44
minor=$${ver#*.}; \
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    45
printf "vmajor=%s\nvminor=%s\n" $$major $$minor >VERSION
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    46
	# is_release=`hg log --template '{latesttagdistance}'`
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    47
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    48
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    49
# Platform/environment definition.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    50
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    51
host_os = unix
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    52
ifneq '' '$(COMSPEC)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    53
  ifneq '' '$(WINDIR)'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    54
    # Probably under Windows.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    55
    host_os = windows
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    56
  endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    57
endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    58
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    59
################################################################
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    60
# Build tool definition/switches.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    61
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    62
RST2HTML = rst2html
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    63
ifeq '$(host_os)' 'windows'
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    64
  RST2HTML = rst2html.py
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    65
endif
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    67
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
    68
# Install paths.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    70
ifeq '$(origin prefix)' 'undefined'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    71
  ifeq '$(shell id -u)' '0'
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    72
    prefix = /usr/local
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    73
  else
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    74
    prefix = $(HOME)/usr
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    75
  endif
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    76
endif
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
datarootdir = $(prefix)/share
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    78
datadir = $(datarootdir)/dictd
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
    80
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    81
# Project dirs/files.
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    82
50
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
    83
C5_FILES := $(wildcard *.dict-c5)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
    84
DICT_FILES := $(C5_FILES:.dict-c5=.dict)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
    85
DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
    86
INDEX_FILES := $(C5_FILES:.dict-c5=.index)
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    87
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    88
RST_FILES := $(wildcard *.rst)
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    89
HTML_FILES := $(RST_FILES:.rst=.html)
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
    90
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    91
name = gadict
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    92
fullpkgname = $(name)-$(vmajor).$(vminor)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    93
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    94
DIST_DIR = $(fullpkgname)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    95
DISTSRC_DIR = $(fullpkgname)_src
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    96
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    97
DIST_FILES = $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_FILES) VERSION
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    98
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
    99
DISTSRC_HELPER_FILES = VERSION Makefile rst.css .dir-locals.el
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   100
DISTSRC_FILES = $(HTML_FILES) $(RST_FILES) $(DISTSRC_HELPER_FILES)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   101
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   102
################################################################
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   103
# Dist targets.
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   104
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   105
.PHONY: dist
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   106
dist: dist-dictd dist-src
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   107
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   108
DIST_TARBALLS = $(DIST_DIR).tar.gz $(DIST_DIR).tar.bz2
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   109
DISTSRC_TARBALLS = $(DISTSRC_DIR).tar.gz $(DISTSRC_DIR).tar.bz2
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   110
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   111
.PHONY: dist-dictd
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   112
dist-dictd: $(DIST_TARBALLS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   113
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   114
.PHONY: dist-src
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   115
dist-src: $(DISTSRC_TARBALLS)
103
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   116
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   117
%.tar.gz: %
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   118
	tar zcf $*.tar.gz $*
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   119
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   120
%.tar.bz2: %
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   121
	tar jcf $*.tar.bz2 $*
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   122
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   123
$(DIST_DIR): $(DIST_FILES)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   124
	rm -rf $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   125
	mkdir $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   126
	cp $(DIST_FILES) $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   127
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   128
$(DISTSRC_DIR): $(DISTSRC_FILES)
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   129
	rm -rf $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   130
	mkdir $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   131
	cp $(DISTSRC_FILES) $@
b5b1dc62bdc0 Add 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 94
diff changeset
   132
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   133
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   134
# Build targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   136
.PHONY: all
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
all: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   139
.PHONY: dist
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   140
dist: $(DICTDZ_FILES) $(INDEX_FILES)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   142
#  --case-sensitive
50
37931fbb857f Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 46
diff changeset
   143
%.dict %.index: %.dict-c5
46
86c0184efac7 Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
   144
	sed '/^#/d' $< | dictfmt  -c5 \
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   145
	--headword-separator '; ' --break-headwords \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   146
	--utf8 --allchars \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   147
	-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
   148
	-s "`sed -n '/^ABOUT: /{s=ABOUT: ==;p;q;}' $<`" \
46
86c0184efac7 Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
   149
	$*
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   151
%.dict.dz: %.dict
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   152
	dictzip -c $< >$@
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   153
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   154
################################################################
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   155
# Install/uninstall targets.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   157
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   158
install: dist
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   159
	mkdir -p $(datadir)
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   160
	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   161
		install -m 644 $$f $(datadir); \
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   162
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   164
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
uninstall:
41
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   166
	for f in $(DICTDZ_FILES) $(INDEX_FILES); do \
8f1dc5d77f3d Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
   167
		rm -f $(datadir)/$$f; \
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
   168
	done
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
   169
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   170
################################################################
66
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   171
# Documentation targets.
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   172
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   173
.PHONY: html
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   174
html: $(HTML_FILES)
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   175
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   176
$(HTML_FILES): %.html: %.rst
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   177
	$(RST2HTML) --stylesheet=rst.css $*.rst $@
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   178
be91c79007e9 Add 'html' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   179
################################################################
94
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   180
# Statistics targets.
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   181
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   182
.PHONY: stat
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   183
stat:
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   184
	total=0; \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   185
	for dic in *.dict-c5; do \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   186
		cnt=`grep '^_____' $$dic | wc -l`; \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   187
		echo $$dic 'has  ' $$cnt words.; \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   188
		total=$$(($$total + $$cnt)); \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   189
	done; \
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   190
	echo Total words count is $$total.
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   191
1b2cf5b2b46c Add target that print statistics about word count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 85
diff changeset
   192
################################################################
54
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   193
# Clean targets.
12426df26196 Add headlines docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   194
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   195
.PHONY: distclean
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   196
distclean: clean
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   197
	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
   198
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   199
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   200
clean:
68
ce7aca59cb54 Clean .html files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 66
diff changeset
   201
	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES)
105
35cc545ec03d 'clean'-like targets delete artefacts after 'dist' targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 103
diff changeset
   202
	rm -rf $(DIST_DIR) $(DISTSRC_DIR) $(DIST_TARBALLS) $(DISTSRC_TARBALLS)
63
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   203
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   204
################################################################
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   205
# Helper target.
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   206
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   207
.PHONY: help
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   208
help:
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   209
	@echo
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   210
	@echo Supported targets:
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   211
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
f1bd82604661 Add help target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 56
diff changeset
   212