]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-137218: Fix Makefile to handle FreeBSD (fix for JIT stencil changes) (GH-139170)
authorSavannah Bailey <savannahostrowski@gmail.com>
Mon, 22 Sep 2025 12:21:57 +0000 (13:21 +0100)
committerGitHub <noreply@github.com>
Mon, 22 Sep 2025 12:21:57 +0000 (14:21 +0200)
Makefile.pre.in
configure
configure.ac

index da036b198d11f8195b96977aaaf24bb6113e25d1..eedccc3ffe6a49f0412aa8df03afed5df0f0c769 100644 (file)
@@ -3127,27 +3127,11 @@ JIT_DEPS = \
                $(srcdir)/Tools/jit/*.py \
                $(srcdir)/Python/executor_cases.c.h \
                pyconfig.h
-               
-ifneq ($(filter aarch64-apple-darwin%,$(HOST_GNU_TYPE)),)
-JIT_STENCIL_HEADER := jit_stencils-aarch64-apple-darwin.h
-else ifneq ($(filter x86_64-apple-darwin%,$(HOST_GNU_TYPE)),)
-JIT_STENCIL_HEADER := jit_stencils-x86_64-apple-darwin.h
-else ifeq ($(HOST_GNU_TYPE), aarch64-pc-windows-msvc)
-JIT_STENCIL_HEADER := jit_stencils-aarch64-pc-windows-msvc.h
-else ifeq ($(HOST_GNU_TYPE), i686-pc-windows-msvc)
-JIT_STENCIL_HEADER := jit_stencils-i686-pc-windows-msvc.h
-else ifeq ($(HOST_GNU_TYPE), x86_64-pc-windows-msvc)
-JIT_STENCIL_HEADER := jit_stencils-x86_64-pc-windows-msvc.h
-else ifneq ($(filter aarch64-%-linux-gnu,$(HOST_GNU_TYPE)),)
-JIT_STENCIL_HEADER := jit_stencils-$(HOST_GNU_TYPE).h
-else ifneq ($(filter x86_64-%-linux-gnu,$(HOST_GNU_TYPE)),)
-JIT_STENCIL_HEADER := jit_stencils-$(HOST_GNU_TYPE).h
-endif
-
-jit_stencils.h $(JIT_STENCIL_HEADER): $(JIT_DEPS)
+
+jit_stencils.h @JIT_STENCILS_H@: $(JIT_DEPS)
        @REGEN_JIT_COMMAND@
 
-Python/jit.o: $(srcdir)/Python/jit.c jit_stencils.h $(JIT_STENCIL_HEADER)
+Python/jit.o: $(srcdir)/Python/jit.c jit_stencils.h @JIT_STENCILS_H@
        $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
 
 .PHONY: regen-jit
index 733bb00cdb026488532041ac8fbb51ab62763518..cd8f2f19c0b92cfabed7fa05463a93372c10ae0f 100755 (executable)
--- a/configure
+++ b/configure
@@ -904,6 +904,7 @@ LDSHARED
 SHLIB_SUFFIX
 DSYMUTIL_PATH
 DSYMUTIL
+JIT_STENCILS_H
 REGEN_JIT_COMMAND
 UNIVERSAL_ARCH_FLAGS
 WASM_STDLIB
@@ -10875,6 +10876,7 @@ then :
 else case e in #(
   e) as_fn_append CFLAGS_NODIST " $jit_flags"
            REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""
+           JIT_STENCILS_H="jit_stencils.h"
            if test "x$Py_DEBUG" = xtrue
 then :
   as_fn_append REGEN_JIT_COMMAND " --debug"
@@ -10882,6 +10884,7 @@ fi ;;
 esac
 fi
 
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tier2_flags $jit_flags" >&5
 printf "%s\n" "$tier2_flags $jit_flags" >&6; }
 
 printf "%s\n" "$py_cv_module_xxlimited_35" >&6; }
 
 
+# Determine JIT stencils header files based on target platform
+JIT_STENCILS_H=""
+case "$host" in
+  aarch64-apple-darwin*)
+    JIT_STENCILS_H="jit_stencils-aarch64-apple-darwin.h"
+    ;;
+  x86_64-apple-darwin*)
+    JIT_STENCILS_H="jit_stencils-x86_64-apple-darwin.h"
+    ;;
+  aarch64-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-aarch64-pc-windows-msvc.h"
+    ;;
+  i686-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-i686-pc-windows-msvc.h"
+    ;;
+  x86_64-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-x86_64-pc-windows-msvc.h"
+    ;;
+  aarch64-*-linux-gnu)
+    JIT_STENCILS_H="jit_stencils-$host.h"
+    ;;
+  x86_64-*-linux-gnu)
+    JIT_STENCILS_H="jit_stencils-$host.h"
+    ;;
+esac
+
+
+
 # substitute multiline block, must come after last PY_STDLIB_MOD()
 
 
index 72808127f86e976dbaa44accbf173b6a16cea5d8..8312dc55084333b44a71f00dbf63baa88a790735 100644 (file)
@@ -2787,11 +2787,13 @@ AS_VAR_IF([jit_flags],
           [AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
            AS_VAR_SET([REGEN_JIT_COMMAND],
                       ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""])
+           AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
            AS_VAR_IF([Py_DEBUG],
                      [true],
                      [AS_VAR_APPEND([REGEN_JIT_COMMAND], [" --debug"])],
                      [])])
 AC_SUBST([REGEN_JIT_COMMAND])
+AC_SUBST([JIT_STENCILS_H])
 AC_MSG_RESULT([$tier2_flags $jit_flags])
 
 if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
@@ -8171,6 +8173,34 @@ dnl Emscripten does not support shared libraries yet.
 PY_STDLIB_MOD([xxlimited], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
 PY_STDLIB_MOD([xxlimited_35], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
 
+# Determine JIT stencils header files based on target platform
+JIT_STENCILS_H=""
+case "$host" in
+  aarch64-apple-darwin*)
+    JIT_STENCILS_H="jit_stencils-aarch64-apple-darwin.h"
+    ;;
+  x86_64-apple-darwin*)
+    JIT_STENCILS_H="jit_stencils-x86_64-apple-darwin.h"
+    ;;
+  aarch64-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-aarch64-pc-windows-msvc.h"
+    ;;
+  i686-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-i686-pc-windows-msvc.h"
+    ;;
+  x86_64-pc-windows-msvc)
+    JIT_STENCILS_H="jit_stencils-x86_64-pc-windows-msvc.h"
+    ;;
+  aarch64-*-linux-gnu)
+    JIT_STENCILS_H="jit_stencils-$host.h"
+    ;;
+  x86_64-*-linux-gnu)
+    JIT_STENCILS_H="jit_stencils-$host.h"
+    ;;
+esac
+
+AC_SUBST([JIT_STENCILS_H])
+
 # substitute multiline block, must come after last PY_STDLIB_MOD()
 AC_SUBST([MODULE_BLOCK])