summaryrefslogtreecommitdiffstats
path: root/bootstrap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap.sh')
-rwxr-xr-xbootstrap.sh22
1 files changed, 8 insertions, 14 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 7722c18..6ff90e5 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -18,30 +18,24 @@ set -e
SYSTEMNAME=`uname -s`
+# Compute system-specific CFLAGS/LDFLAGS as used in both in the below
+# g++ call as well as in the later gen-build-file.py.
if [ "${SYSTEMNAME}" = "Linux" ]; then
- EXTRA_CFLAGS=
- EXTRA_LDFLAGS=
+ export CFLAGS=
+ export LDFLAGS=
elif [ "${SYSTEMNAME}" = "FreeBSD" ]; then
- EXTRA_CFLAGS="-I/usr/local/include"
- EXTRA_LDFLAGS="-L/usr/local/lib"
+ export CFLAGS="-I/usr/local/include"
+ export LDFLAGS="-L/usr/local/lib"
fi
-cat >config.ninja <<EOT
-# This file is generated by bootstrap.sh.
-conf_cflags = -O2 ${EXTRA_CFLAGS}
-conf_ldflags = -s ${EXTRA_LDFLAGS}
-# When developing:
-# conf_cflags = -g -Wall ${EXTRA_CFLAGS}
-# conf_ldflags = ${EXTRA_LDFLAGS}
-EOT
-
echo "Building ninja manually..."
mkdir -p build
./src/inline.sh kBrowsePy < src/browse.py > build/browse_py.h
srcs=$(ls src/*.cc | grep -v test)
-g++ -Wno-deprecated ${EXTRA_CFLAGS} ${EXTRA_LDFLAGS} -o ninja.bootstrap $srcs
+g++ -Wno-deprecated ${CFLAGS} ${LDFLAGS} -o ninja.bootstrap $srcs
echo "Building ninja using itself..."
+./gen-build-file.py > build.ninja
./ninja.bootstrap ninja
rm ninja.bootstrap