summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Seplowitz <mseplowitz@bloomberg.net>2015-10-21 18:37:50 -0400
committerMike Seplowitz <mseplowitz@bloomberg.net>2015-10-22 10:05:44 -0400
commitaa14d6e067c6491555150c1f40de1388c3491124 (patch)
treec0f21c59b032df406c35ec5aea5773942903a2b5
parentcdab57de00ab7ce157f1fdd601ce242588fcadce (diff)
downloadninja-aa14d6e067c6491555150c1f40de1388c3491124.tar.gz
Separate bootstrapped build from final build
AIX does not support rebuilding ninja in-place from the bootstrapped ninja.
-rw-r--r--.gitignore1
-rwxr-xr-xconfigure.py33
2 files changed, 24 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index f7fc044..5a85203 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ TAGS
/build
/build.ninja
/ninja
+/ninja.bootstrap
/build_log_perftest
/canon_perftest
/depfile_parser_perftest
diff --git a/configure.py b/configure.py
index 611030f..1a6d51c 100755
--- a/configure.py
+++ b/configure.py
@@ -105,6 +105,8 @@ class Platform(object):
and not self.is_solaris()
and not self.is_aix())
+ def can_rebuild_in_place(self):
+ return not (self.is_windows() or self.is_aix())
class Bootstrap:
"""API shim for ninja_syntax.Writer that instead runs the commands.
@@ -639,17 +641,28 @@ n.build('all', 'phony', all_targets)
n.close()
print('wrote %s.' % BUILD_FILENAME)
-verbose = ''
-if options.verbose:
- verbose = ' -v'
-
if options.bootstrap:
print('bootstrap complete. rebuilding...')
- if platform.is_windows():
- bootstrap_exe = 'ninja.bootstrap.exe'
+
+ rebuild_args = []
+
+ if platform.can_rebuild_in_place():
+ rebuild_args.append('./ninja')
+ else:
+ if platform.is_windows():
+ bootstrap_exe = 'ninja.bootstrap.exe'
+ final_exe = 'ninja.exe'
+ else:
+ bootstrap_exe = './ninja.bootstrap'
+ final_exe = './ninja'
+
if os.path.exists(bootstrap_exe):
os.unlink(bootstrap_exe)
- os.rename('ninja.exe', bootstrap_exe)
- subprocess.check_call('ninja.bootstrap.exe%s' % verbose, shell=True)
- else:
- subprocess.check_call('./ninja%s' % verbose, shell=True)
+ os.rename(final_exe, bootstrap_exe)
+
+ rebuild_args.append(bootstrap_exe)
+
+ if options.verbose:
+ rebuild_args.append('-v')
+
+ subprocess.check_call(rebuild_args)