build: respect --debug configure switch
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 17 Jan 2012 22:02:15 +0000 (23:02 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 17 Jan 2012 22:03:21 +0000 (23:03 +0100)
.gitignore
Makefile
configure

index 3bc7efb..ebbd083 100644 (file)
@@ -31,6 +31,7 @@ ipch/
 *.sdf
 *.opensdf
 
+/config.mk
 /config.gypi
 *-nodegyp*
 /gyp-mac-tool
index 856b5a6..33c9e18 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+-include config.mk
+
 BUILDTYPE ?= Release
 PYTHON ?= python
 
index 5b13b5a..6a709c9 100755 (executable)
--- a/configure
+++ b/configure
@@ -266,13 +266,16 @@ output = {
 }
 pprint.pprint(output, indent=2)
 
-fn = os.path.join(root_dir, 'config.gypi')
-print "creating ", fn
-
-f = open(fn, 'w+')
-f.write("# Do not edit. Generated by the configure script.\n")
-pprint.pprint(output, stream=f, indent=2)
-f.write("\n")
-f.close()
+def write(filename, data):
+  filename = os.path.join(root_dir, filename)
+  print "creating ", filename
+  with open(filename, 'w+') as f:
+    f.write(data)
+
+write('config.gypi', "# Do not edit. Generated by the configure script.\n" +
+  pprint.pformat(output, indent=2))
+
+write('config.mk', "# Do not edit. Generated by the configure script.\n" +
+  ("BUILDTYPE=%s\n" % ('Debug' if options.debug else 'Release')))
 
 subprocess.call(['tools/gyp_node','-f', 'make'])