summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--HACKING8
-rwxr-xr-xbootstrap.py2
-rwxr-xr-xconfigure.py7
-rw-r--r--doc/manual.asciidoc6
-rw-r--r--src/depfile_parser.cc16
-rw-r--r--src/depfile_parser.in.cc2
-rw-r--r--src/depfile_parser_test.cc13
-rw-r--r--src/parsers.cc2
8 files changed, 41 insertions, 15 deletions
diff --git a/HACKING b/HACKING
index 786524f..4e01d49 100644
--- a/HACKING
+++ b/HACKING
@@ -2,6 +2,14 @@ Adjusting build flags:
CFLAGS=-O3 ./configure.py
and rebuild.
+Building tests requires gtest, to get it:
+ - On older Ubuntus you can apt-get install libgtest.
+ - On newer Ubuntus it's only distributed as source;
+ 1) apt-get install libgtest-dev
+ 2) ./configure --with-gtest=/usr/src/gtest
+ - Otherwise you need to download it, unpack it, and pass --with-gtest
+ as appropriate.
+
Test-driven development:
Set your build command to
./ninja ninja_test && ./ninja_test --gtest_filter=MyTest.Name
diff --git a/bootstrap.py b/bootstrap.py
index ad6f1eb..3aac647 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -21,6 +21,8 @@ import errno
import shlex
import subprocess
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
parser = OptionParser()
parser.add_option('--verbose', action='store_true',
help='enable verbose build',)
diff --git a/configure.py b/configure.py
index 5fb22fe..7839dae 100755
--- a/configure.py
+++ b/configure.py
@@ -74,8 +74,9 @@ n.comment('The arguments passed to configure.py, for rerunning it.')
n.variable('configure_args', ' '.join(sys.argv[1:]))
env_keys = set(['CXX', 'AR', 'CFLAGS', 'LDFLAGS'])
configure_env = dict((k, os.environ[k]) for k in os.environ if k in env_keys)
-n.variable('configure_env',
- ' '.join([k + '=' + configure_env[k] for k in configure_env]))
+if configure_env:
+ config_str = ' '.join([k + '=' + configure_env[k] for k in configure_env])
+ n.variable('configure_env', config_str + '$ ')
n.newline()
CXX = configure_env.get('CXX', 'g++')
@@ -366,7 +367,7 @@ n.newline()
if host != 'mingw':
n.comment('Regenerate build files if build script changes.')
n.rule('configure',
- command='$configure_env %s configure.py $configure_args' %
+ command='${configure_env}%s configure.py $configure_args' %
options.with_python,
generator=True)
n.build('build.ninja', 'configure',
diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc
index d9a6188..5de9638 100644
--- a/doc/manual.asciidoc
+++ b/doc/manual.asciidoc
@@ -123,7 +123,7 @@ but they are not part of make itself.)
you can print e.g. `CC foo.o` instead of a long command line while
building.
-* Builds are always run in parallel, based by defaulton the number of
+* Builds are always run in parallel, based by default on the number of
CPUs your system has. Underspecified build dependencies will result
in incorrect builds.
@@ -143,7 +143,7 @@ full details of the implementation -- like how to get C header
interdependencies correct and fast when using MSVC's compiler -- is
not yet complete.
-If your project is small, Ninja's speed impact is likely unnoticable.
+If your project is small, Ninja's speed impact is likely unnoticeable.
Some build timing numbers are included below. (However, even for
small projects it sometimes turns out that Ninja's limited syntax
forces simpler build rules that result in faster builds.) Another way
@@ -151,7 +151,7 @@ to say this is that if you're happy with the edit-compile cycle time
of your project already then Ninja won't help.
There are many other build systems that are more user-friendly or
-featureful than Ninja itself. For some recomendations: the Ninja
+featureful than Ninja itself. For some recommendations: the Ninja
author found http://gittup.org/tup/[the tup build system] influential
in Ninja's design, and thinks https://github.com/apenwarr/redo[redo]'s
design is quite clever.
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc
index 261893f..54b934c 100644
--- a/src/depfile_parser.cc
+++ b/src/depfile_parser.cc
@@ -54,7 +54,7 @@ bool DepfileParser::Parse(string* content, string* err) {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 128, 128, 128, 128, 128,
+ 128, 128, 0, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 0, 0, 0, 0, 0,
0, 128, 128, 128, 128, 128, 128, 128,
@@ -84,18 +84,21 @@ bool DepfileParser::Parse(string* content, string* err) {
};
yych = *in;
- if (yych <= '\\') {
- if (yych <= ':') {
+ if (yych <= '[') {
+ if (yych <= '*') {
if (yych <= 0x00) goto yy6;
- if (yych <= '*') goto yy8;
- goto yy4;
+ if (yych <= '\'') goto yy8;
+ if (yych <= ')') goto yy4;
+ goto yy8;
} else {
+ if (yych <= ':') goto yy4;
if (yych <= '@') goto yy8;
if (yych <= 'Z') goto yy4;
- if (yych <= '[') goto yy8;
+ goto yy8;
}
} else {
if (yych <= '`') {
+ if (yych <= '\\') goto yy2;
if (yych == '_') goto yy4;
goto yy8;
} else {
@@ -104,6 +107,7 @@ bool DepfileParser::Parse(string* content, string* err) {
goto yy8;
}
}
+yy2:
++in;
if ((yych = *in) <= '$') {
if (yych <= '\n') {
diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc
index 5e073df..8c415b9 100644
--- a/src/depfile_parser.in.cc
+++ b/src/depfile_parser.in.cc
@@ -68,7 +68,7 @@ bool DepfileParser::Parse(string* content, string* err) {
*out++ = yych;
continue;
}
- [a-zA-Z0-9+,/_:.~-]+ {
+ [a-zA-Z0-9+,/_:.~()-]+ {
// Got a span of plain text.
int len = in - start;
// Need to shift it over if we're overwriting backslashes.
diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc
index 9094283..fd76ae7 100644
--- a/src/depfile_parser_test.cc
+++ b/src/depfile_parser_test.cc
@@ -103,7 +103,18 @@ TEST_F(DepfileParserTest, Escapes) {
ASSERT_EQ(0u, parser_.ins_.size());
}
-TEST_F(DepfileParserTest, UnifyMultupleOutputs) {
+TEST_F(DepfileParserTest, SpecialChars) {
+ string err;
+ EXPECT_TRUE(Parse(
+"C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h:",
+ &err));
+ ASSERT_EQ("", err);
+ EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h",
+ parser_.out_.AsString());
+ ASSERT_EQ(0u, parser_.ins_.size());
+}
+
+TEST_F(DepfileParserTest, UnifyMultipleOutputs) {
// check that multiple duplicate targets are properly unified
string err;
EXPECT_TRUE(Parse("foo foo: x y z", &err));
diff --git a/src/parsers.cc b/src/parsers.cc
index c3844fb..bc76ba1 100644
--- a/src/parsers.cc
+++ b/src/parsers.cc
@@ -218,7 +218,7 @@ bool ManifestParser::ParseEdge(string* err) {
ins.push_back(in);
}
- // Add all order-only deps, counting how many as we go.
+ // Add all implicit deps, counting how many as we go.
int implicit = 0;
if (lexer_.PeekToken(Lexer::PIPE)) {
for (;;) {