blob: e37b516e3b059ee1546ca8057b6b8904880ec035 [file] [log] [blame]
Python uses a hand-rolled Makefile parser to pick out important build-related
environment variables and stash them in the `sysconfig` module. Crucially, it'll
take a Makefile that looks like
```
FOO = 1
BAR = $(FOO) $(BAZ) $(QUX)
```
...And given an environment of {'FOO': 99, 'BAZ': '98'}, will produce something
like {'FOO': '1', 'BAR': '1 98 '}
Since EXTRA_CFLAGS is literally only used as a means to pass a PGO profile in,
and that profile won't be available to anything but the core Python modules, we
clear EXTRA_CFLAGS for the generation of sysconfig.
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -456,6 +456,7 @@ platform: $(BUILDPYTHON) pybuilddir.txt
# or removed in case of failure.
pybuilddir.txt: $(BUILDPYTHON)
@echo "none" > ./pybuilddir.txt
+ EXTRA_CFLAGS= \
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
if test $$? -ne 0 ; then \
echo "generate-posix-vars failed" ; \