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