1 #!/bin/bash 2 # 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 17 set -e 18 19 sleep_if_necessary() { 20 if [ x"${TRAVIS}" != x"" ]; then 21 sleep "$@" 22 fi 23 } 24 25 mk="$@" 26 if echo "${mk}" | grep kati > /dev/null; then 27 mk="${mk} --use_find_emulator" 28 fi 29 function build() { 30 ${mk} $@ 2> /dev/null 31 if [ -e ninja.sh ]; then ./ninja.sh -j1 $@; fi 32 } 33 34 cat <<EOF > Makefile 35 V := \$(shell find -L linkdir/d/link) 36 all: 37 @echo \$(V) 38 EOF 39 40 mkdir -p dir1 dir2 linkdir/d 41 touch dir1/file1 dir2/file2 42 ln -s ../../dir1 linkdir/d/link 43 build 44 45 sleep_if_necessary 1 46 touch dir1/file1_2 47 build 48 49 rm linkdir/d/link 50 ln -s ../../dir2 linkdir/d/link 51 build 52