Commit 71320481 authored by Trent Nelson's avatar Trent Nelson

Issue #15819: additional fixes for out-of-tree builds from read-only src.

Specifically, make sure the 'Object', 'Python' and 'Include' directories
in the build directory take precedence over the source directory if we're
an out-of-tree build.

Fix typeslots.inc so that it gets generated into the build directory.
parent 796ac93f
...@@ -27,6 +27,8 @@ MODLIBS= _MODLIBS_ ...@@ -27,6 +27,8 @@ MODLIBS= _MODLIBS_
VERSION= @VERSION@ VERSION= @VERSION@
srcdir= @srcdir@ srcdir= @srcdir@
VPATH= @srcdir@ VPATH= @srcdir@
BUILDDIR= @BUILDDIR@
CC= @CC@ CC= @CC@
CXX= @CXX@ CXX= @CXX@
...@@ -66,6 +68,7 @@ MAKESETUP= $(srcdir)/Modules/makesetup ...@@ -66,6 +68,7 @@ MAKESETUP= $(srcdir)/Modules/makesetup
# Compiler options # Compiler options
OPT= @OPT@ OPT= @OPT@
BASECFLAGS= @BASECFLAGS@ BASECFLAGS= @BASECFLAGS@
BASECPPFLAGS= @BASECPPFLAGS@
CONFIGURE_CFLAGS= @CFLAGS@ CONFIGURE_CFLAGS= @CFLAGS@
CONFIGURE_CPPFLAGS= @CPPFLAGS@ CONFIGURE_CPPFLAGS= @CPPFLAGS@
CONFIGURE_LDFLAGS= @LDFLAGS@ CONFIGURE_LDFLAGS= @LDFLAGS@
...@@ -76,7 +79,7 @@ PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) ...@@ -76,7 +79,7 @@ PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the # be able to build extension modules using the directories specified in the
# environment variables # environment variables
PY_CPPFLAGS= -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS) PY_CPPFLAGS= $(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS) PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
NO_AS_NEEDED= @NO_AS_NEEDED@ NO_AS_NEEDED= @NO_AS_NEEDED@
LDLAST= @LDLAST@ LDLAST= @LDLAST@
...@@ -282,7 +285,7 @@ ASDLGEN= @DISABLE_ASDLGEN@ $(srcdir)/Parser/asdl_c.py ...@@ -282,7 +285,7 @@ ASDLGEN= @DISABLE_ASDLGEN@ $(srcdir)/Parser/asdl_c.py
# Python # Python
OPCODETARGETS_H= \ OPCODETARGETS_H= \
$(srcdir)/Python/opcode_targets.h Python/opcode_targets.h
OPCODETARGETGEN= \ OPCODETARGETGEN= \
$(srcdir)/Python/makeopcodetargets.py $(srcdir)/Python/makeopcodetargets.py
...@@ -663,9 +666,9 @@ Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \ ...@@ -663,9 +666,9 @@ Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
$(BYTESTR_DEPS) \ $(BYTESTR_DEPS) \
$(srcdir)/Objects/stringlib/formatter.h $(srcdir)/Objects/stringlib/formatter.h
Objects/typeobject.o: $(srcdir)/Objects/typeslots.inc Objects/typeobject.o: Objects/typeslots.inc
$(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
############################################################################ ############################################################################
# Header files # Header files
......
...@@ -651,6 +651,8 @@ HAS_HG ...@@ -651,6 +651,8 @@ HAS_HG
HGBRANCH HGBRANCH
HGTAG HGTAG
HGVERSION HGVERSION
BASECPPFLAGS
BUILDDIR
SVNVERSION SVNVERSION
ARFLAGS ARFLAGS
AR AR
...@@ -5205,6 +5207,24 @@ else ...@@ -5205,6 +5207,24 @@ else
SVNVERSION="echo Unversioned directory" SVNVERSION="echo Unversioned directory"
fi fi
BUILDDIR="`pwd`"
if test "$srcdir" != "$BUILDDIR"; then
# If we're building out-of-tree, we need to make sure the following
# resources get picked up before their $srcdir counterparts.
# Objects/ -> typeslots.inc
# Include/ -> Python-ast.h, graminit.h
# Python/ -> importlib.h
# (A side effect of this is that these resources will automatically be
# regenerated when building out-of-tree, regardless of whether or not
# the $srcdir counterpart is up-to-date. This is an acceptable trade
# off.)
BASECPPFLAGS="-IObjects -IInclude -IPython"
else
BASECPPFLAGS=""
fi
......
...@@ -830,6 +830,24 @@ else ...@@ -830,6 +830,24 @@ else
SVNVERSION="echo Unversioned directory" SVNVERSION="echo Unversioned directory"
fi fi
BUILDDIR="`pwd`"
AC_SUBST(BUILDDIR)
AC_SUBST(BASECPPFLAGS)
if test "$srcdir" != "$BUILDDIR"; then
# If we're building out-of-tree, we need to make sure the following
# resources get picked up before their $srcdir counterparts.
# Objects/ -> typeslots.inc
# Include/ -> Python-ast.h, graminit.h
# Python/ -> importlib.h
# (A side effect of this is that these resources will automatically be
# regenerated when building out-of-tree, regardless of whether or not
# the $srcdir counterpart is up-to-date. This is an acceptable trade
# off.)
BASECPPFLAGS="-IObjects -IInclude -IPython"
else
BASECPPFLAGS=""
fi
AC_SUBST(HGVERSION) AC_SUBST(HGVERSION)
AC_SUBST(HGTAG) AC_SUBST(HGTAG)
AC_SUBST(HGBRANCH) AC_SUBST(HGBRANCH)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment