6 # install-local install dictionaries in user HOME dir, so they been available in stardict for that user |
6 # install-local install dictionaries in user HOME dir, so they been available in stardict for that user |
7 # uninstall-local remove dictionaries from user HOME directory |
7 # uninstall-local remove dictionaries from user HOME directory |
8 # install-local-symlink create symlink from installed dir to user HOME dir, so dictionaries been available in stardict |
8 # install-local-symlink create symlink from installed dir to user HOME dir, so dictionaries been available in stardict |
9 # uninstall-local-symlink remove symlink from user HOME directory |
9 # uninstall-local-symlink remove symlink from user HOME directory |
10 |
10 |
|
11 DICTNAME_PREFIX = gadict |
11 |
12 |
12 # On Debian Etch 'stardict-tools' package not placed tools in any system bin dir. |
13 ifeq '$(origin prefix)' 'undefined' |
13 export PATH := $(PATH):/usr/lib/stardict-tools |
14 ifeq '$(shell id -u)' '0' |
|
15 prefix = /usr/local |
|
16 else |
|
17 prefix = $(HOME)/usr |
|
18 endif |
|
19 endif |
|
20 datarootdir = $(prefix)/share |
|
21 datadir = $(datarootdir)/dictd |
14 |
22 |
15 DICSETNAME = gavenkoa-dicts |
23 C5_FILES := $(wildcard *.c5) |
|
24 DICT_FILES := $(C5_FILES:.c5=.dict) |
|
25 DICTDZ_FILES := $(C5_FILES:.c5=.dict.dz) |
|
26 INDEX_FILES := $(C5_FILES:.c5=.index) |
16 |
27 |
17 prefix = /usr/local |
|
18 datarootdir = $(prefix)/share |
|
19 datadir = $(datarootdir)/stardict |
|
20 dicdir = $(datadir)/dic/$(DICSETNAME) |
|
21 |
|
22 # Per user dictionaries hold in user HOME directory. |
|
23 dicdir-local = $(HOME)/.stardict/dic/$(DICSETNAME) |
|
24 |
|
25 F_TAB_ = $(wildcard *.tab_) |
|
26 |
|
27 F_TAB = $(patsubst %.tab_,%.tab,$(F_TAB_)) |
|
28 FNAME = $(patsubst %.tab,%,$(F_TAB)) |
|
29 F_DICT = $(patsubst %.tab,%.dict.dz,$(F_TAB)) |
|
30 F_IFO = $(patsubst %.tab,%.ifo,$(F_TAB)) |
|
31 |
28 |
32 .PHONY: all |
29 .PHONY: all |
33 all: dist |
30 all: dist |
34 |
31 |
35 .PHONY: verify |
32 .PHONY: dist |
36 verify: dist |
33 dist: $(DICTDZ_FILES) $(INDEX_FILES) |
37 @echo |
|
38 @for dic in $(F_IFO); do \ |
|
39 stardict_verify $$dic; \ |
|
40 done |
|
41 |
34 |
42 .PHONY: dist |
35 # --case-sensitive |
43 dist: $(F_DICT) |
36 %.dict %.index: %.c5 |
|
37 dictfmt -c5 \ |
|
38 --headword-separator '; ' --break-headwords \ |
|
39 --utf8 --allchars \ |
|
40 -u "`sed -n '\|http://[[:print:]]\+/|{s=^.*\(http://\)=\1=;p;q;}' $<`" \ |
|
41 -s "`sed -n '/^ABOUT: /{s=ABOUT: ==;p;q;}' $<`" \ |
|
42 $* <$< |
44 |
43 |
45 %.tab: %.tab_ |
44 %.dict.dz: %.dict |
46 sed -e '/^#/d' -e 's_\\n _\\n_g' > $@ < $< |
45 dictzip -c $< >$@ |
47 |
|
48 %.dict.dz: %.tab %.descr |
|
49 tabfile $< |
|
50 /bin/sh update-ifo.sh $*.ifo |
|
51 |
46 |
52 .PHONY: install |
47 .PHONY: install |
53 install: dist |
48 install: dist |
54 mkdir -p $(dicdir) |
49 mkdir -p $(datadir) |
55 for dic in $(FNAME); do \ |
50 for f in $(DICTDZ_FILES) $(INDEX_FILES); do \ |
56 install -m 644 $$dic.dict.dz $(dicdir); \ |
51 install -m 644 $$f $(datadir); \ |
57 install -m 644 $$dic.idx $(dicdir); \ |
|
58 install -m 644 $$dic.ifo $(dicdir); \ |
|
59 done |
52 done |
60 |
53 |
61 .PHONY: uninstall |
54 .PHONY: uninstall |
62 uninstall: |
55 uninstall: |
63 rm -r -f $(dicdir) |
56 for f in $(DICTDZ_FILES) $(INDEX_FILES); do \ |
64 |
57 rm -f $(datadir)/$$f; \ |
65 .PHONY: install-local-symlink |
|
66 install-local-symlink: # Assume use run "make install" before. |
|
67 mkdir -p $(HOME)/.stardict/dic |
|
68 ln -s $(dicdir) $(HOME)/.stardict/dic/$(DICSETNAME) |
|
69 |
|
70 .PHONY: uninstall-local-symlink |
|
71 uninstall-local-symlink: # Assume use run "make uninstall" before. |
|
72 rm -f $(HOME)/.stardict/dic/$(DICSETNAME) |
|
73 |
|
74 .PHONY: install-local |
|
75 install-local: dist |
|
76 mkdir -p $(dicdir-local) |
|
77 for dic in $(FNAME); do \ |
|
78 install -m 644 $$dic.dict.dz $(dicdir-local); \ |
|
79 install -m 644 $$dic.idx $(dicdir-local); \ |
|
80 install -m 644 $$dic.ifo $(dicdir-local); \ |
|
81 done |
|
82 |
|
83 .PHONY: uninstall-local |
|
84 uninstall-local: |
|
85 rm -f -r $(HOME)/.stardict/dic/$(DICSETNAME) |
|
86 |
|
87 .PHONY: clean |
|
88 clean: |
|
89 for dic in $(FNAME); do \ |
|
90 rm -f $$dic.dict.dz $$dic.idx $$dic.ifo $$dic.tab; \ |
|
91 done |
58 done |
92 |
59 |
93 .PHONY: distclean |
60 .PHONY: distclean |
94 distclean: clean |
61 distclean: clean |
|
62 |
|
63 .PHONY: clean |
|
64 clean: |
|
65 rm -f $(DICTDZ_FILES) $(INDEX_FILES); |