Debian Codegraph @

Makefile

raw symbols SCIP
1 #
2 # Open Chinese Convert
3 #
4 # Copyright 2010-2020 Carbo Kuo <[email protected]>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18
19 PREFIX = /usr
20 REL_BUILD_DOCUMENTATION ?= OFF
21
22 .PHONY: bazel build clean doc node test xcode-build
23
24 build:
25 mkdir -p build/rel
26 (cd build/rel; cmake \
27 -DBUILD_DOCUMENTATION:BOOL=${REL_BUILD_DOCUMENTATION} \
28 -DENABLE_GTEST:BOOL=OFF \
29 -DENABLE_BENCHMARK:BOOL=OFF \
30 -DCMAKE_BUILD_TYPE=Release \
31 -DCMAKE_INSTALL_PREFIX=${PREFIX} \
32 ../..)
33 make -C build/rel VERBOSE=${VERBOSE} PREFIX=${PREFIX}
34
35 doc:
36 mkdir -p build/doc
37 (cd build/doc; cmake \
38 -DBUILD_DOCUMENTATION:BOOL=ON \
39 -DENABLE_GTEST:BOOL=OFF \
40 -DENABLE_BENCHMARK:BOOL=OFF \
41 -DCMAKE_BUILD_TYPE=Release \
42 -DCMAKE_INSTALL_PREFIX=${PREFIX} \
43 ../..)
44 make -C build/doc apidoc VERBOSE=${VERBOSE} PREFIX=${PREFIX}
45
46 package: build
47 make -C build/rel package_source VERBOSE=${VERBOSE}
48 make -C build/rel package_source VERBOSE=${VERBOSE} PREFIX=${PREFIX}
49
50 test:
51 mkdir -p build/dbg/root
52 (cd build/dbg; cmake \
53 -DBUILD_DOCUMENTATION:BOOL=OFF \
54 -DENABLE_GTEST:BOOL=ON \
55 -DENABLE_BENCHMARK:BOOL=OFF \
56 -DCMAKE_BUILD_TYPE=Debug \
57 -DCMAKE_INSTALL_PREFIX=`pwd`/root \
58 ../..)
59 make -C build/dbg VERBOSE=${VERBOSE}
60 (cd build/dbg; ctest --verbose)
61 make -C build/dbg install VERBOSE=${VERBOSE}
62
63 benchmark:
64 mkdir -p build/perf
65 (cd build/perf; cmake \
66 -DBUILD_DOCUMENTATION:BOOL=OFF \
67 -DENABLE_GTEST:BOOL=OFF \
68 -DENABLE_BENCHMARK:BOOL=ON \
69 -DBUILD_OPENCC_JIEBA_PLUGIN:BOOL=ON \
70 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
71 -DCMAKE_INSTALL_PREFIX=`pwd`/root \
72 ../..)
73 make -C build/perf VERBOSE=${VERBOSE} PREFIX=${PREFIX}
74 (cd build/perf; ctest --verbose)
75
76 node:
77 node-gyp configure
78 node-gyp build
79
80 node-test: node
81 npm test
82
83 xcode-build:
84 mkdir -p xcode
85 (cd xcode; cmake \
86 -G "Xcode" \
87 -DBUILD_DOCUMENTATION:BOOL=OFF \
88 -DENABLE_GTEST:BOOL=ON \
89 -DENABLE_BENCHMARK:BOOL=ON \
90 ..; \
91 xcodebuild build)
92
93 python-build:
94 echo "No need to build"
95
96 python-install: python-build
97 python -m pip install .
98
99 python-dist: python-build
100 python -m build
101
102 python-test: python-build
103 cd python; pytest .
104
105 test-all: test node-test python-test
106
107 format:
108 find "src" "node" "test" -iname "*.hpp" -o -iname "*.cpp" -o -iname "*.cc" \
109 -o -iname "*.c" -o -iname "*.h" \
110 | xargs clang-format -i
111
112 clean:
113 rm -rf build xcode python/opencc/clib *.egg-info bazel-*
114
115 install: build
116 make -C build/rel install VERBOSE=${VERBOSE} PREFIX=${PREFIX}
117
118 bazel:
119 bazel build //:opencc
120 bazel test --test_output=all //src/... //data/... //test/...
121
122 bazel-clean:
123 bazel clean --expunge