summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-02-14 15:01:54 +0200
committerTor Lillqvist <tlillqvist@novell.com>2011-02-15 04:55:02 +0200
commit138df361fa85bdb418656474a474c490110ba7e2 (patch)
tree0e7defd95939c191881ac51296e1c9e4236e4483 /python
parentb7491dd511f62c5d348683cec3afa019b569b38c (diff)
Py_DEBUG mangling for Windows
Diffstat (limited to 'python')
-rw-r--r--python/makefile.mk11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/makefile.mk b/python/makefile.mk
index d401785892c1..00f79cee8741 100644
--- a/python/makefile.mk
+++ b/python/makefile.mk
@@ -161,6 +161,17 @@ $(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
-rm -f $@
cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
+# We know that the only thing guarded with #ifdef _DEBUG in PC/pyconfig.h is
+# the line defining Py_DEBUG.
+.IF "$(debug)"!=""
+# If Python is built with debugging, then the modules we build need to be built with
+# Py_DEBUG defined too because of the Py_InitModule4 redefining magic in modsupport.h
+ sed -e 's/^#ifdef _DEBUG$/#if 1/' <$@ >$@.new && mv $@.new $@
+.ELSE
+# Correspondingly, if Python is not built with debugging, it won't use the Py_InitModule4 redefining
+# magic, so our Python modules should not be built to provide that either.
+ sed -e 's/^#ifdef _DEBUG$/#if 0/' <$@ >$@.new && mv $@.new $@
+.ENDIF
.ENDIF
.ENDIF