[Python-checkins] cpython (2.7): Issue #22359: Avoid recursive $(MAKE); disable running cross-compiled pgen

martin.panter python-checkins at python.org
Fri Apr 22 21:51:32 EDT 2016


https://hg.python.org/cpython/rev/0f7a299c6d50
changeset:   101092:0f7a299c6d50
branch:      2.7
parent:      101082:e4561aad29e6
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sat Apr 23 00:58:44 2016 +0000
summary:
  Issue #22359: Avoid recursive $(MAKE); disable running cross-compiled pgen

Patches by Jonas Wagner and Xavier de Gaye.

files:
  Makefile.pre.in |  21 ++++++++++++++-------
  Misc/NEWS       |   5 +++++
  configure       |   1 +
  configure.ac    |   1 +
  4 files changed, 21 insertions(+), 7 deletions(-)


diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -200,6 +200,7 @@
 PYTHON=		python$(EXE)
 BUILDPYTHON=	python$(BUILDEXE)
 
+cross_compiling=@cross_compiling@
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
 HOST_GNU_TYPE=  @host@
@@ -677,13 +678,19 @@
 
 Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
 
-$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
-		@$(MKDIR_P) Include
-		$(MAKE) $(PGEN)
-		$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
-		$(MAKE) $(GRAMMAR_H)
-		touch $(GRAMMAR_C)
+$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN)
+	@$(MKDIR_P) Include
+	if test "$(cross_compiling)" != "yes"; then \
+		$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \
+	else \
+		cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \
+	fi
+$(GRAMMAR_C): $(GRAMMAR_H)
+	if test "$(cross_compiling)" != "yes"; then \
+		touch $(GRAMMAR_C); \
+	else \
+		cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \
+	fi
 
 $(PGEN):	$(PGENOBJS)
 		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -225,6 +225,11 @@
 Build
 -----
 
+- Issue #22359: Avoid incorrect recursive $(MAKE), and disable the rules for
+  running pgen when cross-compiling.  The pgen output is normally saved with
+  the source code anyway, and is still regenerated when doing a native build.
+  Patch by Jonas Wagner and Xavier de Gaye.
+
 - Issue #19450: Update Windows builds to use SQLite 3.8.11.0.
 
 - Issue #17603: Avoid error about nonexistant fileblocks.o file by using a
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -743,6 +743,7 @@
 build_vendor
 build_cpu
 build
+cross_compiling
 target_alias
 host_alias
 build_alias
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,7 @@
 AC_CONFIG_SRCDIR([Include/object.h])
 AC_CONFIG_HEADER(pyconfig.h)
 
+AC_SUBST(cross_compiling)
 AC_CANONICAL_HOST
 AC_SUBST(build)
 AC_SUBST(host)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list