Skip to content

Commit

Permalink
refactor(Makefile): rename makefiles and change build directories
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Mar 9, 2019
1 parent 2cacc69 commit fcf36bc
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 153 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
build/
build-static/
debug-build/
xbuild/
xdebug/
debug/
build.log
data/*
thirdparty/include/*
Expand Down
44 changes: 32 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,73 @@ RIME_ROOT = $(CURDIR)
sharedir = $(DESTDIR)/usr/share
bindir = $(DESTDIR)/usr/bin

.PHONY: all thirdparty clean librime librime-static install-librime uninstall-librime release install uninstall debug install-debug uninstall-debug test
.PHONY: all thirdparty xcode clean\
librime librime-static install-librime uninstall-librime \
release debug test install uninstall install-debug uninstall-debug

all: release

thirdparty:
make -f Makefile.thirdparty
make -f thirdparty.mk

thirdparty/%:
make -f Makefile.thirdparty $(@:thirdparty/%=%)
make -f thirdparty.mk $(@:thirdparty/%=%)

xcode:
make -f xcode.mk

xcode/%:
make -f xcode.mk $(@:xcode/%=%)

clean:
rm -Rf build build-static debug-build
rm -Rf build build-static debug

librime: release
install-librime: install
uninstall-librime: uninstall

librime-static:
cmake . -Bbuild-static -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF
cmake . -Bbuild-static \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STATIC=ON \
-DBUILD_SHARED_LIBS=OFF
cmake --build build-static

release:
cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_MERGED_PLUGINS=OFF
cmake . -Bbuild \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_MERGED_PLUGINS=OFF
cmake --build build

merged-plugins:
cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_MERGED_PLUGINS=ON
cmake . -Bbuild \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_MERGED_PLUGINS=ON
cmake --build build

debug:
cmake . -Bdebug-build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
cmake --build debug-build
cmake . -Bdebug \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Debug
cmake --build debug

install:
cmake --build build --target install

install-debug:
cmake --build debug-build --target install
cmake --build debug --target install

uninstall:
cmake --build build --target uninstall

uninstall-debug:
cmake --build debug-build --target uninstall
cmake --build debug --target uninstall

test: release
(cd build/test; ./rime_test)

test-debug: debug
(cd debug-build/test; ./rime_test)
(cd debug/test; ./rime_test)
65 changes: 0 additions & 65 deletions Makefile.thirdparty

This file was deleted.

33 changes: 0 additions & 33 deletions Makefile.xcode

This file was deleted.

74 changes: 47 additions & 27 deletions README-mac.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Rime with Mac
===
# Rime with Mac

Preparation
---
## Preparation

Install Xcode with command line tools.

Install other build tools:

``` sh
brew install cmake
brew install git
brew install cmake git
```

Install Boost:
Install Boost C++ libraries:

``` sh
brew install boost@1.60
brew link --force boost@1.60
Expand All @@ -33,45 +32,66 @@ brew link --force boost@1.60
When you manually download and build Boost libraries from source code, set shell
variable `BOOST_ROOT` to its top level directory prior to building librime.

Get the code
---
## Get the code

``` sh
git clone --recursive https://github.com/rime/librime.git
```
or [download from GitHub](https://github.com/rime/librime).

Build third-party libraries
---
## Build third-party libraries

``` sh
cd librime
make -f Makefile.xcode thirdparty
make xcode/thirdparty
```
This builds dependent libraries in `thirdparty/src/*`, and copies artifacts to `thirdparty/lib` and `thirdparty/bin`.

This builds dependent libraries in `thirdparty/src/*`, and copies artifacts to
`thirdparty/lib` and `thirdparty/bin`.

You can build an individual library, eg. opencc, with:

``` sh
make xcode/thirdparty/opencc
```

## Build librime

``` sh
make -f Makefile.xcode thirdparty/opencc
make xcode
```
This creates `build/lib/Release/librime.dylib` and command line tools
`build/bin/Release/rime_*`.

Or, create a debug build:

``` sh
make xcode/debug
```

## Run unit tests

Build librime
---
``` sh
make -f Makefile.xcode
make xcode/test
```
This creates `xbuild/lib/Release/librime.dylib` and command line tools `xbuild/bin/Release/rime_*`.

Or, make a debug build. This also creates a test in `xdebug/test/`.
Or, test the debug build:

``` sh
make -f Makefile.xcode debug
# run the test
(cd xdebug/test; ./Debug/rime_test)
make xcode/test-debug
```

Try it in the console
---
## Try it in the console

``` sh
(cd xdebug/bin; echo "congmingdeRime{space}shurufa" | Debug/rime_api_console)
(
cd debug/bin;
echo "congmingdeRime{space}shurufa" | Debug/rime_api_console
)
```

# REPL, quit with Control+d
(cd xdebug/bin; ./Debug/rime_api_console)
Use it as REPL, quit with <kbd>Control+d</kbd>:

``` sh
(cd debug/bin; ./Debug/rime_api_console)
```
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RIME: Rime Input Method Engine
[![GitHub release](https://img.shields.io/github/release/rime/librime.svg)](https://github.com/rime/librime/releases)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

rimes with your keystrokes.
Rime with your keystrokes.

Project home
---
Expand All @@ -19,11 +19,16 @@ License

Features
===
- A modular, extensible input method engine in cross-platform C++ code, built on top of open-source technologies
- Covering features found in a large variety of Chinese input methods, either shape-based or phonetic-based
- Built with native support for Traditional Chinese, conversion to Simplified Chinese and other regional standards via OpenCC
- Rime input schema, a DSL in YAML syntax for fast trying out innovative ideas of input method design
- Spelling Algebra, a mechanism to create variant spelling, especially useful for Chinese dialects
- A modular, extensible input method engine in cross-platform C++ code,
built on top of open-source technologies
- Covering features found in a large variety of Chinese input methods,
either shape-based or phonetic-based
- Built with native support for Traditional Chinese, conversion to Simplified
Chinese and other regional standards via OpenCC
- Rime input schema, a DSL in YAML syntax for fast trying out innovative ideas
of input method design
- Spelling Algebra, a mechanism to create variant spelling, especially useful
for Chinese dialects
- Support for chord-typing with a generic Qwerty keyboard

Install
Expand Down Expand Up @@ -77,14 +82,17 @@ Third-party:

Plugins
===
- [librime-legacy](https://github.com/rime/librime-legacy) Legacy module with GPL-licensed code
- [librime-legacy](https://github.com/rime/librime-legacy) Legacy module with
GPL-licensed code

Related works
===
- [plum](https://github.com/rime/plum): Rime configuration manager and input schema repository
- [Combo Pinyin](https://github.com/rime/home/wiki/ComboPinyin): an innovative chord-typing practice to input Pinyin
- [plum](https://github.com/rime/plum): Rime configuration manager and input
schema repository
- [Combo Pinyin](https://github.com/rime/home/wiki/ComboPinyin): an innovative
chord-typing practice to input Pinyin
- essay: the vocabulary and language model for Rime
- [SCU](https://github.com/neolee/SCU/): Squirrel Configuration Utilities
- [SCU](https://github.com/neolee/SCU): Squirrel Configuration Utilities

Credits
===
Expand Down
Loading

0 comments on commit fcf36bc

Please sign in to comment.