forked from tuberry/dict-ecdict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (31 loc) · 1020 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
PKGNAME=ecdict
CSVNAME=ultimate.csv
FILENAME=ecdict-ultimate-csv.zip
URL=https://github.com/skywind3000/ECDICT-ultimate
ifndef VERSION
VERSION=1.0.0
endif
ifndef MINI
MINI=true
endif
all: $(PKGNAME).index $(PKGNAME).dict.dz
$(FILENAME):
curl -kLO $(URL)/releases/download/$(VERSION)/$(FILENAME)
$(PKGNAME).csv: $(FILENAME)
unzip $(FILENAME) && cp $(CSVNAME) $(PKGNAME).csv
$(PKGNAME).txt: $(PKGNAME).csv
ifeq ($(MINI),true)
python ./$(PKGNAME).py -i ./$(PKGNAME).csv -o $(PKGNAME).txt
else
python ./$(PKGNAME).py -i ./$(PKGNAME).csv -o $(PKGNAME).txt --no-mini
endif
$(PKGNAME).index $(PKGNAME).dict.dz &: $(PKGNAME).txt
dictfmt --utf8 --allchars -s ECDICT -u $(URL) -j $(PKGNAME) < ./$(PKGNAME).txt && dictzip $(PKGNAME).dict
install: $(PKGNAME).index $(PKGNAME).dict.dz
install -Dm644 $(PKGNAME).index -t $(DESTDIR)/usr/share/dictd/
install -Dm644 $(PKGNAME).dict.dz -t $(DESTDIR)/usr/share/dictd/
_clean:
rm -f $(PKGNAME).{index,dict.dz,txt,csv}
clean: _clean
rm -f $(CSVNAME)
rm -f $(FILENAME)