-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
71 lines (59 loc) · 2.38 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# The old school Makefile, following are required targets. The Makefile is written
# to allow building multiple binaries. You are free to add more targets or change
# existing implementations, as long as the semantics are preserved.
#
# make - default to 'build' target
# make test - run unit test
# make build - build local binary targets
# make clean - clean up targets
#
# The makefile is also responsible to populate project version information.
#
# Tweak the variables based on your project.
#
SHELL := /bin/bash
# GREP is grep, using grep in Linux, ggrep in macOS
GREP := grep
ifeq ($(shell uname),Darwin)
GREP := ggrep
endif
# SED is sed, using sed in Linux, gsed in macOS
SED := sed
ifeq ($(shell uname),Darwin)
SED := gsed
endif
NOW_SHORT := $(shell date +%Y%m%d%H%M)
TODAY_DOT := $(shell date +%Y.%m.%d)
# Git commit sha.
COMMIT := $(strip $(shell git rev-parse --short HEAD 2>/dev/null))
COMMIT := $(COMMIT)$(shell [[ -z $$(git status -s) ]] || echo '-dirty')
COMMIT := $(if $(COMMIT),$(COMMIT),"Unknown")
# Current version of the project.
MAJOR_VERSION = 1
MINOR_VERSION = 0
PATCH_VERSION = 0
BUILD_VERSION = $(COMMIT)
VERSION ?= v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)-$(BUILD_VERSION)
ASCEL_BIN := ${HOME}/dev/my/ascel/ascel.py
#
# Define all targets. At least the following commands are required:
#
.PHONY: download download-wangluoliuxingxinci download-kaifadashenzhuanyongciku
download:
cat $(dict) | $(GREP) -v -P "\t" | sponge $(dict)
wget 'https://pinyin.sogou.com/d/dict/download_cell.php?id=$(id)&name=$(name)' -O $(name).scel
python3 $(ASCEL_BIN) $(name).scel >> $(dict)
rm $(name).scel
version=$(TODAY_DOT); $(SED) -i -E "s/^version: \".+\"$$/version: \"$$version\"/g" $(dict)
download-wangluoliuxingxinci: id = 4
download-wangluoliuxingxinci: dict = luna_pinyin.wangluoliuxingxinci.dict.yaml
download-wangluoliuxingxinci: name = 网络流行新词【官方推荐】
download-wangluoliuxingxinci: download
download-kaifadashenzhuanyongciku: id = 75228
download-kaifadashenzhuanyongciku: dict = luna_pinyin.kaifadashenzhuanyongciku.dict.yaml
download-kaifadashenzhuanyongciku: name = 开发大神专用词库【官方推荐】
download-kaifadashenzhuanyongciku: download
download-mingxing: id = 15209
download-mingxing: dict = luna_pinyin.mingxing.dict.yaml
download-mingxing: name = 明星【官方推荐】
download-mingxing: download