build-math-object
authorMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
committerMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
Gbp-Pq: Name build-math-object.diff

Makefile.pre.in

index fa3c07abcd26bb0a0f1c38d61806a5247d69986e..4cc0182652e77596da7a44948d52cb644fa8954b 100644 (file)
@@ -22,7 +22,8 @@
 
 MODBUILT_NAMES=    _MODBUILT_NAMES_
 MODDISABLED_NAMES= _MODDISABLED_NAMES_
-MODOBJS=           _MODOBJS_
+# filter out duplicate object files (_math.o)
+MODOBJS=           $(sort _MODOBJS_)
 MODLIBS=           _MODLIBS_
 
 # === Variables set by configure
@@ -621,8 +622,9 @@ pybuilddir.txt: $(BUILDPYTHON)
        fi
 
 # This is shared by the math and cmath modules
+# don't build with -fPIC when building as math and cmath as builtins
 Modules/_math.o: Modules/_math.c Modules/_math.h
-       $(CC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $<
+       $(CC) -c $(if $(findstring _math.o, $(MODOBJS)),,$(CCSHARED)) $(PY_CORE_CFLAGS) -o $@ $<
 
 # blake2s is auto-generated from blake2b
 $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py