diff options
author | Christian Heimes <christian@python.org> | 2021-11-18 08:18:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 08:18:44 (GMT) |
commit | 25ecc040d007a55e4b5c30fa739054b52c1aacac (patch) | |
tree | a804c5fba2fba0e13a45dbd723eafee1f08f833f /Modules/makesetup | |
parent | fc4474e45eecbea8e88095f28c98c5d56438d841 (diff) | |
download | cpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.zip cpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.tar.gz cpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.tar.bz2 |
bpo-45573: Introduce extension module flags in Makefile (GH-29594)
``configure`` now uses a standardized format to forward state, compiler
flags, and linker flags to ``Makefile``, ``setup.py``, and
``Modules/Setup``. ``makesetup`` use the new variables by default if a
module line does not contain any compiler or linker flags. ``setup.py``
has a new function ``addext()``.
For a module ``egg``, configure adds:
* ``MODULE_EGG`` with value yes, missing, disabled, or n/a
* ``MODULE_EGG_CFLAGS``
* ``MODULE_EGG_LDFLAGS``
``Makefile.pre.in`` may also provide ``MODULE_EGG_DEPS`` that lists
dependencies such as header files and static libs.
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/makesetup')
-rwxr-xr-x | Modules/makesetup | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/makesetup b/Modules/makesetup index a8817ff..2335724 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -154,6 +154,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | cpps= libs= mods= + mods_upper= skip= for arg in $line do @@ -194,11 +195,17 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | *.*) echo 1>&2 "bad word $arg in $line" exit 1;; -u) skip=libs; libs="$libs -u";; - [a-zA-Z_]*) mods="$mods $arg";; + [a-zA-Z_]*) + mods="$mods $arg" + mods_upper=$(echo $mods | tr '[a-z]' '[A-Z]');; *) echo 1>&2 "bad word $arg in $line" exit 1;; esac done + if test -z "$cpps" -a -z "$libs"; then + cpps="\$(MODULE_${mods_upper}_CFLAGS)" + libs="\$(MODULE_${mods_upper}_LDFLAGS)" + fi case $doconfig in yes) LIBS="$LIBS $libs" @@ -245,7 +252,6 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | *) cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";; esac - mods_upper=$(echo $mods | tr '[a-z]' '[A-Z]') # force rebuild when header file or module build flavor (static/shared) is changed rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc $cpps -c $src -o $obj" echo "$rule" >>$rulesf |