mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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>
This commit is contained in:
parent
fc4474e45e
commit
25ecc040d0
8 changed files with 435 additions and 103 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue