diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2015-08-24 15:36:38 -0700 |
|---|---|---|
| committer | Dan Willemsen <dwillemsen@google.com> | 2016-02-10 11:19:32 -0800 |
| commit | 0b544c58579cf2214d19d2dce3e20dc246810628 (patch) | |
| tree | 810cfc2d88c9bc20b24164426e3d4bb3d63fa31f /testcase | |
| parent | 90e52cec561a406ad5683cd384148632273719d4 (diff) | |
[C++] Ninja: Detect and drop mkdir -p $(dir $@)
Ninja automatically creates the necessary output directories.
This also fixes the logic to remove the empty '(true) &&' that was added
for echo -> description detection.
Diffstat (limited to 'testcase')
| -rw-r--r-- | testcase/ninja_mkdir.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testcase/ninja_mkdir.sh b/testcase/ninja_mkdir.sh new file mode 100644 index 0000000..e54298d --- /dev/null +++ b/testcase/ninja_mkdir.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright 2016 Google Inc. All rights reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +log=/tmp/log +mk="$@" + +cat <<EOF > Makefile +test: a/b + +a/b: + @mkdir -p \$(dir \$@) + touch \$@ +EOF + +${mk} 2> ${log} +if [ -e ninja.sh ]; then + ./ninja.sh +fi +if [[ ! -d a ]]; then + echo "Created 'a'" +fi +if [ -e ninja.sh ]; then + if grep -q "mkdir -p" build.ninja; then + echo "Should not include 'mkdir -p' in build.ninja" + echo "Ninja will automatically create this directory" + fi +fi |
