-
Notifications
You must be signed in to change notification settings - Fork 145
/
Makefile
73 lines (58 loc) · 1.7 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
72
73
ifeq ($(SRCDIR),)
SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
endif
# Tips: you can set OUTPUT to Rime user directory in the command line
ifeq ($(OUTPUT),)
OUTPUT := $(SRCDIR)/output
endif
ifeq ($(PREFIX),)
PREFIX := /usr
endif
ifeq ($(RIME_DATA_DIR),)
RIME_DATA_DIR := $(PREFIX)/share/rime-data
endif
.DEFAULT_GOAL := preset
preset extra all: clean
bash $(SRCDIR)/scripts/install-packages.sh :$@ $(OUTPUT)
minimal: clean
bash $(SRCDIR)/scripts/minimal-build.sh $(OUTPUT)
preset-bin: preset
$(MAKE) build
all-bin: all
$(MAKE) build
minimal-bin: minimal
$(MAKE) build
build:
rime_deployer --build $(OUTPUT)
rm $(OUTPUT)/user.yaml
install:
@echo "Installing Rime data to '$(DESTDIR)$(RIME_DATA_DIR)'."
@install -d $(DESTDIR)$(RIME_DATA_DIR)
@install -m 644 $(OUTPUT)/*.* $(DESTDIR)$(RIME_DATA_DIR)
@if [ -d "$(OUTPUT)/build" ]; then \
install -d $(DESTDIR)$(RIME_DATA_DIR)/build; \
install -m 644 $(OUTPUT)/build/*.* $(DESTDIR)$(RIME_DATA_DIR)/build; \
fi
@if [ -d "$(OUTPUT)/opencc" ]; then \
install -d $(DESTDIR)$(RIME_DATA_DIR)/opencc; \
install -m 644 $(OUTPUT)/opencc/*.* $(DESTDIR)$(RIME_DATA_DIR)/opencc; \
fi
clean:
rm -rf $(OUTPUT) > /dev/null 2>&1 || true
VERSION = $(shell date "+%Y%m%d")
# A source tarball that includes all data packages.
# To reproduce package contents of the release, set `no_update=1`:
# tar xzf plum-YYYYMMDD.tar.gz
# cd plum
# no_update=1 make
# sudo make install
dist:
$(MAKE) OUTPUT=$(OUTPUT) all
tar czf plum-$(VERSION).tar.gz \
--exclude=.git \
--exclude=output \
--exclude='plum-*.tar.gz' \
-C .. plum
.PHONY: preset extra all minimal \
preset-bin all-bin minimal-bin \
build install clean dist