# Author: Alecsandru Patrascu diff -r 1f003062d830 Makefile.pre.in --- a/Makefile.pre.in Tue Jan 19 08:50:56 2016 +0100 +++ b/Makefile.pre.in Wed Jan 20 17:23:29 2016 +0200 @@ -29,7 +29,7 @@ VPATH= @srcdir@ abs_srcdir= @abs_srcdir@ abs_builddir= @abs_builddir@ - +DIST_TARGET=@DIST_TARGET@ CC= @CC@ CXX= @CXX@ @@ -478,7 +478,7 @@ # Rules # Default target -all: build_all +all: @DEF_MAKE_ALL_RULE@ @DEF_AUX_CMDS@ build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config # Compile a binary with profile guided optimization. @@ -502,7 +502,7 @@ $(MAKE) profile-removal build_all_generate_profile: - $(MAKE) all CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" run_profile_task: : # FIXME: can't run for a cross build @@ -512,14 +512,14 @@ $(LLVM_PROF_MERGER) build_all_use_profile: - $(MAKE) all CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG)" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG)" # Compile and run with gcov .PHONY=coverage coverage-lcov coverage-report coverage: @echo "Building with support for coverage checking:" $(MAKE) clean profile-removal - $(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" coverage-lcov: @echo "Creating Coverage HTML report with LCOV:" diff -r 1f003062d830 configure --- a/configure Tue Jan 19 08:50:56 2016 +0100 +++ b/configure Wed Jan 20 17:23:29 2016 +0200 @@ -742,6 +742,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 @@ -835,6 +840,7 @@ ac_precious_vars='build_alias host_alias target_alias +PYDIST MACHDEP CC CFLAGS @@ -1524,6 +1530,8 @@ "install" or "upgrade" using bundled pip Some influential environment variables: + PYDIST Set the build type to "debug", "devel" or "release". Default is + set to "release" MACHDEP name for machine-dependent library files CC C compiler command CFLAGS C compiler flags @@ -2974,6 +2982,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 1f003062d830 configure.ac --- a/configure.ac Tue Jan 19 08:50:56 2016 +0100 +++ b/configure.ac Wed Jan 20 17:23:29 2016 +0200 @@ -53,6 +53,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