summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-09 15:58:13 (GMT)
committerEvan Martin <martine@danga.com>2011-05-09 15:58:13 (GMT)
commitf685c540be9bc84d45667d8af229f0ae3fdcdebd (patch)
tree4cf014ac77531899c2a469578900f328e402fa02
parent18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb (diff)
downloadNinja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.zip
Ninja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.tar.gz
Ninja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.tar.bz2
make platform a command-line arg to configure
-rw-r--r--HACKING2
-rwxr-xr-xconfigure.py28
2 files changed, 20 insertions, 10 deletions
diff --git a/HACKING b/HACKING
index f70b2bf..48e695c 100644
--- a/HACKING
+++ b/HACKING
@@ -35,7 +35,7 @@ Documentation guidelines:
Windows development:
- sudo apt-get install gcc-mingw32 wine
-- NINJA_PLATFORM=mingw ./configure
+- ./configure.py --platform=mingw
- Build gtest:
- unpack it into your source dir
- ./configure CC=i586-mingw32msvc-cc CXX=i586-mingw32msvc-c++
diff --git a/configure.py b/configure.py
index 48b4ce1..1dc777e 100755
--- a/configure.py
+++ b/configure.py
@@ -19,21 +19,31 @@
Projects that use ninja themselves should either write a similar script
or use a meta-build system that supports Ninja output."""
+from optparse import OptionParser
import os
import sys
sys.path.insert(0, 'misc')
import ninja
-platform = os.environ.get('NINJA_PLATFORM', sys.platform)
-if platform.startswith('linux'):
- platform = 'linux'
-elif platform.startswith('freebsd'):
- platform = 'freebsd'
-elif platform.startswith('mingw'):
- platform = 'mingw'
-elif platform.startswith('win'):
- platform = 'windows'
+parser = OptionParser()
+platforms = ['linux', 'freebsd', 'mingw', 'windows']
+parser.add_option('--platform',
+ help='target platform (' + '/'.join(platforms) + ')',
+ choices=platforms)
+(options, args) = parser.parse_args()
+
+platform = options.platform
+if platform is None:
+ platform = sys.platform
+ if platform.startswith('linux'):
+ platform = 'linux'
+ elif platform.startswith('freebsd'):
+ platform = 'freebsd'
+ elif platform.startswith('mingw'):
+ platform = 'mingw'
+ elif platform.startswith('win'):
+ platform = 'windows'
BUILD_FILENAME = 'build.ninja'
buildfile = open(BUILD_FILENAME, 'w')