author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 08 Jan 2012 22:55:55 +0200 | |
changeset 85 | 0ff3715e6176 |
parent 68 | ce7aca59cb54 |
child 94 | 1b2cf5b2b46c |
permissions | -rw-r--r-- |
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 | 27 |
################################################################ |
66 | 28 |
# Platform/environment definition. |
29 |
||
30 |
host_os = unix |
|
31 |
ifneq '' '$(COMSPEC)' |
|
32 |
ifneq '' '$(WINDIR)' |
|
33 |
# Probably under Windows. |
|
34 |
host_os = windows |
|
35 |
endif |
|
36 |
endif |
|
37 |
||
38 |
################################################################ |
|
39 |
# Build tool definition/switches. |
|
40 |
||
41 |
RST2HTML = rst2html |
|
42 |
ifeq '$(host_os)' 'windows' |
|
43 |
RST2HTML = rst2html.py |
|
44 |
endif |
|
45 |
||
46 |
################################################################ |
|
54 | 47 |
# Install paths. |
0 | 48 |
|
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
49 |
ifeq '$(origin prefix)' 'undefined' |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
50 |
ifeq '$(shell id -u)' '0' |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
51 |
prefix = /usr/local |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
52 |
else |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
53 |
prefix = $(HOME)/usr |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
54 |
endif |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
55 |
endif |
0 | 56 |
datarootdir = $(prefix)/share |
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
57 |
datadir = $(datarootdir)/dictd |
0 | 58 |
|
54 | 59 |
################################################################ |
66 | 60 |
# Project dirs/files. |
21
d4b27e5b7a4b
Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
20
diff
changeset
|
61 |
|
50
37931fbb857f
Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
46
diff
changeset
|
62 |
C5_FILES := $(wildcard *.dict-c5) |
37931fbb857f
Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
46
diff
changeset
|
63 |
DICT_FILES := $(C5_FILES:.dict-c5=.dict) |
37931fbb857f
Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
46
diff
changeset
|
64 |
DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz) |
37931fbb857f
Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
46
diff
changeset
|
65 |
INDEX_FILES := $(C5_FILES:.dict-c5=.index) |
1
b23e948de24a
Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
66 |
|
66 | 67 |
RST_FILES := $(wildcard *.rst) |
68 |
HTML_FILES := $(RST_FILES:.rst=.html) |
|
69 |
||
54 | 70 |
################################################################ |
71 |
# Build targets. |
|
0 | 72 |
|
23
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
73 |
.PHONY: all |
0 | 74 |
all: dist |
75 |
||
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
76 |
.PHONY: dist |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
77 |
dist: $(DICTDZ_FILES) $(INDEX_FILES) |
0 | 78 |
|
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
79 |
# --case-sensitive |
50
37931fbb857f
Switch from ambiguous extension to unambiguous.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
46
diff
changeset
|
80 |
%.dict %.index: %.dict-c5 |
46
86c0184efac7
Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
41
diff
changeset
|
81 |
sed '/^#/d' $< | dictfmt -c5 \ |
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
82 |
--headword-separator '; ' --break-headwords \ |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
83 |
--utf8 --allchars \ |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
84 |
-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
|
85 |
-s "`sed -n '/^ABOUT: /{s=ABOUT: ==;p;q;}' $<`" \ |
46
86c0184efac7
Comment syntax convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
41
diff
changeset
|
86 |
$* |
0 | 87 |
|
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
88 |
%.dict.dz: %.dict |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
89 |
dictzip -c $< >$@ |
1
b23e948de24a
Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
0
diff
changeset
|
90 |
|
54 | 91 |
################################################################ |
92 |
# Install/uninstall targets. |
|
0 | 93 |
|
23
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
94 |
.PHONY: install |
0 | 95 |
install: dist |
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
96 |
mkdir -p $(datadir) |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
97 |
for f in $(DICTDZ_FILES) $(INDEX_FILES); do \ |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
98 |
install -m 644 $$f $(datadir); \ |
0 | 99 |
done |
100 |
||
23
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
101 |
.PHONY: uninstall |
0 | 102 |
uninstall: |
41
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
103 |
for f in $(DICTDZ_FILES) $(INDEX_FILES); do \ |
8f1dc5d77f3d
Switch dictionary to dictd -c5 format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
28
diff
changeset
|
104 |
rm -f $(datadir)/$$f; \ |
21
d4b27e5b7a4b
Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
20
diff
changeset
|
105 |
done |
13
d0e948499faf
Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
9
diff
changeset
|
106 |
|
54 | 107 |
################################################################ |
66 | 108 |
# Documentation targets. |
109 |
||
110 |
.PHONY: html |
|
111 |
html: $(HTML_FILES) |
|
112 |
||
113 |
$(HTML_FILES): %.html: %.rst |
|
114 |
$(RST2HTML) --stylesheet=rst.css $*.rst $@ |
|
115 |
||
116 |
################################################################ |
|
54 | 117 |
# Clean targets. |
118 |
||
23
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
119 |
.PHONY: distclean |
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
120 |
distclean: clean |
13
d0e948499faf
Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
9
diff
changeset
|
121 |
|
23
946ae4b96419
Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
22
diff
changeset
|
122 |
.PHONY: clean |
0 | 123 |
clean: |
68 | 124 |
rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) |
63 | 125 |
|
126 |
################################################################ |
|
127 |
# Helper target. |
|
128 |
||
129 |
.PHONY: help |
|
130 |
help: |
|
131 |
@echo |
|
132 |
@echo Supported targets: |
|
133 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
134 |