Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # A wrapper for kati which generates build.ninja mainly for Android. |
| 4 | # |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | kati_dir=$(cd $(dirname $0) && pwd) |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 9 | extra_flags= |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 10 | goma_flag= |
| 11 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 12 | while [ x"$1" != x"" ]; do |
| 13 | case "$1" in |
| 14 | --help) |
| 15 | cat - <<EOF |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 16 | Usage: |
| 17 | m2n # for full-build |
Shinichiro Hamaji | d34c0e1 | 2015-06-04 16:53:47 +0900 | [diff] [blame] | 18 | m2n --goma # use goma. \$HOME/goma must exist |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 19 | m2n bionic # works like mmm |
| 20 | EOF |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 21 | exit 1 |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 22 | ;; |
Shinichiro Hamaji | e85764a | 2015-06-04 17:08:27 +0900 | [diff] [blame] | 23 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 24 | --goma) |
| 25 | if [ ! -e $HOME/goma/goma_ctl.py ]; then |
| 26 | echo "$HOME/goma/goma_ctl.py should exist to use goma" |
| 27 | exit 1 |
| 28 | fi |
| 29 | $HOME/goma/goma_ctl.py ensure_start |
| 30 | goma_flag=--goma_dir=$HOME/goma |
| 31 | ;; |
| 32 | |
| 33 | --*) |
| 34 | extra_flags+=" $1" |
| 35 | shift |
| 36 | ;; |
| 37 | |
| 38 | *) |
Shinichiro Hamaji | e85764a | 2015-06-04 17:08:27 +0900 | [diff] [blame] | 39 | target=$1 |
| 40 | shift |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 41 | ;; |
| 42 | esac |
| 43 | done |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 44 | |
| 45 | kati=${kati_dir}/kati |
| 46 | |
| 47 | if [ x"${target}" != x"" ]; then |
| 48 | export ONE_SHOT_MAKEFILE=${target}/Android.mk |
| 49 | echo ONE_SHOT_MAKEFILE=${ONE_SHOT_MAKEFILE} |
| 50 | fi |
| 51 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 52 | ${kati} --ninja --ignore_optional_include=out/%.P ${goma_flag} ${extra_flags} |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 53 | |
| 54 | echo ninja.sh and build.ninja were generated, please run ./ninja.sh |