From a77c70276f99b039472fabc9ba1e2e2fd2235aaf Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Thu, 19 Sep 2013 19:19:25 +0200 Subject: Made sub-Makes use the same builddir, objdir and stagedir as the parent. --- comfignat.mk | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/comfignat.mk b/comfignat.mk index 23e71aa..60c29b7 100644 --- a/comfignat.mk +++ b/comfignat.mk @@ -119,6 +119,13 @@ stagedir = ${builddir}/stage # installed are written under stagedir, and then copied to their destination in # the installation step. +ifneq (${Comfignat_overriding_absolute_builddir},) + # This process is a sub-Make and must use the same builddir as its parent. + # This assignment must be done before builddir is used in VPATH and in the + # pathname of the configuration file. + override builddir := ${Comfignat_overriding_absolute_builddir} +endif + # Containing makefiles should avoid modifying the directory variables. Users # should be able to rely on these defaults. @@ -264,19 +271,35 @@ configuration = ${builddir}/comfignat_configuration.mk ifeq (${origin builddir},command line) override builddir := ${abspath ${builddir}} endif -ifeq (${origin objdir},command line) +export Comfignat_overriding_absolute_builddir := ${builddir} + +ifneq (${Comfignat_overriding_absolute_objdir},) + override objdir := ${Comfignat_overriding_absolute_objdir} +else ifeq (${origin objdir},command line) override objdir := ${abspath ${objdir}} + export Comfignat_overriding_absolute_objdir := ${objdir} objdir_is_overridden = true endif -ifeq (${origin stagedir},command line) + +ifneq (${Comfignat_overriding_absolute_stagedir},) + override stagedir := ${Comfignat_overriding_absolute_stagedir} +else ifeq (${origin stagedir},command line) override stagedir := ${abspath ${stagedir}} + export Comfignat_overriding_absolute_stagedir := ${stagedir} stagedir_is_overridden = true endif + # These pathnames need to be absolute in project files, because a pathname # relative to a project file can be wrong when a separate build directory is # used and project files are both in srcdir and in builddir. objdir and # stagedir also need to be absolute in the configuration file because the # working directory might change between Make invocations. +# Sub-Makes must use the same builddir, objdir and stagedir as the parent, so +# the absolute pathnames are conveyed to child processes in environment +# variables that won't normally be overridden and are unlikely to be defined by +# accident. +# The changes to objdir and stagedir must be done after the configuration file +# is read because otherwise the configuration would override the command line. # Once modified the variables are no longer of command line origin, so they are # marked as overridden so that "make configure" will save them. -- cgit v1.2.3