forked from emptyhua/bash-pinyin-completion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (41 loc) · 1.29 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
LINUX_BASHCD=$(DESTDIR)/etc/bash_completion.d
LINUX_BIN=$(DESTDIR)/usr/bin
XCODE_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
PLATFORM=$(shell uname)
ifeq ($(PLATFORM),Darwin)
CFLAGS=-isysroot $(XCODE_SDK)
else
CFLAGS=
endif
all:pinyinmatch
build:pinyinmatch
pinyinmatch:pinyinmatch.o pinyin.o utf8vector.o linereader.o
gcc -Wall $(CFLAGS) -std=c99 pinyinmatch.o pinyin.o utf8vector.o linereader.o -o pinyinmatch
%.o:%.c
gcc -Wall $(CFLAGS) -std=c99 -c $< -o ./$@
install:
if [ "`uname`" = "Darwin" ];then \
echo macos; \
test ! -e "/usr/local/etc/bash_completion.d" && echo 需要安装bash-completion && exit 1; \
cp pinyinmatch /usr/local/bin ;\
cp pinyin_completion /usr/local/etc/bash_completion.d/ ;\
elif [ "`uname`" = "Linux" ];then \
echo linux; \
install -d $(LINUX_BASHCD) ;\
install -d $(LINUX_BIN) ;\
install ./pinyin_completion $(LINUX_BASHCD) ;\
install ./pinyinmatch $(LINUX_BIN) ;\
fi
uninstall:
if [ "`uname`" = "Darwin" ];then \
echo macos; \
rm /usr/local/bin/pinyinmatch ;\
rm /usr/local/etc/bash_completion.d/pinyin_completion ;\
elif [ "`uname`" = "Linux" ];then \
echo linux; \
rm $(LINUX_BASHCD)/pinyin_completion ;\
rm $(LINUX_BIN)/pinyinmatch ;\
fi
clean:
-rm *.o
-rm pinyinmatch