1#!/bin/bash 2# 3# Copyright 2018 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 18mk="$@" 19 20cat <<EOF >Makefile 21all: secondary_dep 22 23secondary_dep: secondary 24 @touch \$@ 25 @echo Made \$@ 26 27primary: .KATI_IMPLICIT_OUTPUTS := secondary 28primary: 29 @touch primary secondary 30 @echo Made primary+secondary 31EOF 32 33if [[ "${mk}" =~ ^make ]]; then 34 echo Made primary+secondary 35 echo Made secondary_dep 36 echo Made secondary_dep 37 echo Nothing to do 38else 39 ${mk} -j1 40 ./ninja.sh -j1 -w dupbuild=err; 41 sleep 1 42 touch secondary 43 ./ninja.sh -j1 -w dupbuild=err; 44 sleep 1 45 echo Nothing to do 46 touch primary 47 ./ninja.sh -j1 -w dupbuild=err; 48fi 49