Rombobjörn

summaryrefslogtreecommitdiff
path: root/comfignat.mk
diff options
context:
space:
mode:
authorBjörn Persson <bjorn@rombobjörn.se>2013-09-19 19:19:25 +0200
committerBjörn Persson <bjorn@rombobjörn.se>2013-09-19 19:19:25 +0200
commita77c70276f99b039472fabc9ba1e2e2fd2235aaf (patch)
tree32292c4c978ac82dbb245949df148463d64250aa /comfignat.mk
parent935002e8992193b670d0fb60519e1020e1b9b52d (diff)
Made sub-Makes use the same builddir, objdir and stagedir as the parent.
Diffstat (limited to 'comfignat.mk')
-rw-r--r--comfignat.mk27
1 files 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.