diff options
-rwxr-xr-x | bootstrap.sh | 7 | ||||
-rw-r--r-- | build.ninja | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/bootstrap.sh b/bootstrap.sh index dadecfc..c36d533 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -2,6 +2,13 @@ set -e +cat >config.ninja <<EOT +# This file is generated by bootstrap.sh. +conf_cflags = -O2 +conf_ldflags = -s +# When developing: +# conf_cflags = -g -Wall +EOT srcs=$(ls src/*.cc | grep -v test) echo "Building stage 1..." g++ -Wno-deprecated -o ninja.bootstrap $srcs diff --git a/build.ninja b/build.ninja index ea23d71..683c94b 100644 --- a/build.ninja +++ b/build.ninja @@ -15,13 +15,17 @@ cflags = -g -Wall -Wno-deprecated -fno-exceptions -fvisibility=hidden -pipe # -rdynamic is needed for backtrace() ldflags = -g -rdynamic +# bootstrap.sh generates a "config" file, which contains more build +# flags. +include config.ninja + # Here we declare a "rule" named "cxx", which knows how to compile # C++ code. The variables indented below the rule are scoped to the # rule itself. The "command" and "depfile" variables in rule scope # are special; see the documentation. rule cxx depfile = $out.d - command = $cxx -MMD -MF $out.d $cflags -c $in -o $out + command = $cxx -MMD -MF $out.d $conf_cflags $cflags -c $in -o $out description = CC $out rule ar @@ -29,7 +33,7 @@ rule ar description = AR $out rule link - command = $cxx $ldflags -o $out $in + command = $cxx $conf_ldflags $ldflags -o $out $in description = LINK $out # These build rules build the ".o" files from the ".cc" files, |