# Author: Alecsandru Patrascu diff -r b452c89bff53 Makefile.pre.in --- a/Makefile.pre.in Mon Jan 18 21:18:49 2016 -0800 +++ b/Makefile.pre.in Wed Jan 20 17:52:57 2016 +0200 @@ -31,6 +31,7 @@ abs_builddir= @abs_builddir@ build= @build@ host= @host@ +DIST_TARGET=@DIST_TARGET@ CC= @CC@ CXX= @CXX@ @@ -421,7 +422,7 @@ # Rules # Default target -all: build_all +all: @DEF_MAKE_ALL_RULE@ @DEF_AUX_CMDS@ build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks # Compile a binary with profile guided optimization. @@ -445,7 +446,7 @@ $(MAKE) profile-removal build_all_generate_profile: - $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" run_profile_task: : # FIXME: can't run for a cross build @@ -455,12 +456,12 @@ $(LLVM_PROF_MERGER) build_all_use_profile: - $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG)" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG)" coverage: @echo "Building with support for coverage checking:" $(MAKE) clean - $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" # Build the interpreter diff -r b452c89bff53 configure --- a/configure Mon Jan 18 21:18:49 2016 -0800 +++ b/configure Wed Jan 20 17:52:57 2016 +0200 @@ -735,6 +735,11 @@ SOVERSION VERSION PYTHON_FOR_BUILD +PYDIST +DEF_AUX_CMDS +DEF_MAKE_RULE +DEF_MAKE_ALL_RULE +DIST_TARGET host_os host_vendor host_cpu @@ -824,6 +829,7 @@ ac_precious_vars='build_alias host_alias target_alias +PYDIST CC CFLAGS LDFLAGS @@ -1511,6 +1517,8 @@ "no" Some influential environment variables: + PYDIST Set the build type to "debug", "devel" or "release". Default is + set to "release" CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -2885,6 +2893,40 @@ +# Get the desired build type and set the required flags + + + + + +case $PYDIST in #( + "debug") : + + DIST_TARGET="debug" + Py_DEBUG='true' + $as_echo "#define Py_DEBUG 1" >>confdefs.h + + DEF_MAKE_ALL_RULE="build_all" + DEF_MAKE_RULE="all" + DEF_AUX_CMDS="" + ;; #( + "devel") : + + DIST_TARGET="devel" + DEF_MAKE_ALL_RULE="build_all" + DEF_MAKE_RULE="all" + DEF_AUX_CMDS="" + ;; #( + *) : + + DIST_TARGET="release" + DEF_MAKE_ALL_RULE="profile-opt" + DEF_MAKE_RULE="build_all" + DEF_AUX_CMDS="; strip --strip-debug \$(PYTHON)" + + ;; +esac + # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt diff -r b452c89bff53 configure.ac --- a/configure.ac Mon Jan 18 21:18:49 2016 -0800 +++ b/configure.ac Wed Jan 20 17:52:57 2016 +0200 @@ -16,6 +16,37 @@ AC_SUBST(build) AC_SUBST(host) +# Get the desired build type and set the required flags +AC_SUBST(DIST_TARGET) +AC_SUBST(DEF_MAKE_ALL_RULE) +AC_SUBST(DEF_MAKE_RULE) +AC_SUBST(DEF_AUX_CMDS) +AC_ARG_VAR([PYDIST], [Set the build type to "debug", "devel" or "release". Default is set to "release"]) +AS_CASE([$PYDIST], + ["debug"], + [ + DIST_TARGET="debug" + Py_DEBUG='true' + AC_DEFINE(Py_DEBUG, 1) + DEF_MAKE_ALL_RULE="build_all" + DEF_MAKE_RULE="all" + DEF_AUX_CMDS="" + ], + ["devel"], + [ + DIST_TARGET="devel" + DEF_MAKE_ALL_RULE="build_all" + DEF_MAKE_RULE="all" + DEF_AUX_CMDS="" + ], + [ + DIST_TARGET="release" + DEF_MAKE_ALL_RULE="profile-opt" + DEF_MAKE_RULE="build_all" + DEF_AUX_CMDS="; strip --strip-debug \$(PYTHON)" + ] +) + # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt