summaryrefslogtreecommitdiffstats
path: root/src/explain.h
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2012-04-13 23:55:37 (GMT)
committerScott Graham <scottmg@chromium.org>2012-04-13 23:55:37 (GMT)
commit1aae1bc765acf6a21b2fcb088f44bba8f3badec7 (patch)
tree1b6097fa397d37bb8d5725f203dcc4df9e31d866 /src/explain.h
parent16cab01cccf0b3ccadb150cd54f760929b3cc07e (diff)
downloadNinja-1aae1bc765acf6a21b2fcb088f44bba8f3badec7.zip
Ninja-1aae1bc765acf6a21b2fcb088f44bba8f3badec7.tar.gz
Ninja-1aae1bc765acf6a21b2fcb088f44bba8f3badec7.tar.bz2
add support for -d explain to help debug why rules are running
Diffstat (limited to 'src/explain.h')
-rw-r--r--src/explain.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/explain.h b/src/explain.h
new file mode 100644
index 0000000..021f0d4
--- /dev/null
+++ b/src/explain.h
@@ -0,0 +1,22 @@
+// Copyright 2012 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.
+
+#include <stdio.h>
+
+#define EXPLAIN(fmt, ...) { \
+ if (g_explaining) \
+ fprintf(stderr, "ninja explain: " fmt "\n", __VA_ARGS__); \
+}
+
+extern bool g_explaining;