Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Shinichiro Hamaji | b69bf8a | 2015-06-10 14:52:06 +0900 | [diff] [blame] | 3 | # Copyright 2015 Google Inc. All rights reserved |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 17 | # A wrapper for kati which generates build.ninja mainly for Android. |
| 18 | # |
| 19 | |
| 20 | set -e |
| 21 | |
| 22 | kati_dir=$(cd $(dirname $0) && pwd) |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 23 | extra_flags= |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 24 | goma_flag= |
| 25 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 26 | while [ x"$1" != x"" ]; do |
| 27 | case "$1" in |
| 28 | --help) |
| 29 | cat - <<EOF |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 30 | Usage: |
| 31 | m2n # for full-build |
Shinichiro Hamaji | d34c0e1 | 2015-06-04 16:53:47 +0900 | [diff] [blame] | 32 | m2n --goma # use goma. \$HOME/goma must exist |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 33 | m2n bionic # works like mmm |
| 34 | EOF |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 35 | exit 1 |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 36 | ;; |
Shinichiro Hamaji | e85764a | 2015-06-04 17:08:27 +0900 | [diff] [blame] | 37 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 38 | --goma) |
| 39 | if [ ! -e $HOME/goma/goma_ctl.py ]; then |
| 40 | echo "$HOME/goma/goma_ctl.py should exist to use goma" |
| 41 | exit 1 |
| 42 | fi |
| 43 | $HOME/goma/goma_ctl.py ensure_start |
| 44 | goma_flag=--goma_dir=$HOME/goma |
Shinichiro Hamaji | b740b72 | 2015-06-08 14:23:52 +0900 | [diff] [blame] | 45 | shift |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 46 | ;; |
| 47 | |
| 48 | --*) |
| 49 | extra_flags+=" $1" |
| 50 | shift |
| 51 | ;; |
| 52 | |
| 53 | *) |
Shinichiro Hamaji | e85764a | 2015-06-04 17:08:27 +0900 | [diff] [blame] | 54 | target=$1 |
| 55 | shift |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 56 | ;; |
| 57 | esac |
| 58 | done |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 59 | |
| 60 | kati=${kati_dir}/kati |
| 61 | |
| 62 | if [ x"${target}" != x"" ]; then |
| 63 | export ONE_SHOT_MAKEFILE=${target}/Android.mk |
| 64 | echo ONE_SHOT_MAKEFILE=${ONE_SHOT_MAKEFILE} |
| 65 | fi |
| 66 | |
Shinichiro Hamaji | 2eac768 | 2015-06-05 13:27:56 +0900 | [diff] [blame] | 67 | ${kati} --ninja --ignore_optional_include=out/%.P ${goma_flag} ${extra_flags} |
Shinichiro Hamaji | 5fb5257 | 2015-06-04 16:20:32 +0900 | [diff] [blame] | 68 | |
| 69 | echo ninja.sh and build.ninja were generated, please run ./ninja.sh |