diff options
Diffstat (limited to 'comfignat.mk')
| -rw-r--r-- | comfignat.mk | 38 | 
1 files changed, 30 insertions, 8 deletions
| diff --git a/comfignat.mk b/comfignat.mk index 30e696e..c22ede5 100644 --- a/comfignat.mk +++ b/comfignat.mk @@ -11,9 +11,9 @@  # modified is included with the above copyright notice. -# This file is part of Comfignat – common, convenient, command-line-controlled -# compile-time configuration of software built with the GNAT tools. For more -# information about Comfignat, see http://www.Rombobeorn.se/Comfignat/. +# This file is part of Comfignat 1.2 – common, convenient, command-line- +# controlled compile-time configuration of software built with the GNAT tools. +# For information about Comfignat, see http://www.Rombobeorn.se/Comfignat/.  # This file contains generic Make code. It is designed to be included by other @@ -121,6 +121,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. @@ -269,19 +276,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. @@ -464,8 +487,7 @@ options_building = ${addprefix -X,${option_values}}  main_makefile := ${firstword ${MAKEFILE_LIST}}  delegation_command = @$${MAKE} --file=${abspath ${main_makefile}} \ -                     --include-dir=${abspath ${dir ${main_makefile}}} \ -                     --no-print-directory +                     --include-dir=${abspath ${dir ${main_makefile}}}  # delegation_command is the Make command line that delegating makefiles in  # separate build directories use to delegate commands to the main makefile. The  # first pathname in MAKEFILE_LIST is the main makefile. @@ -580,7 +602,7 @@ preprocess: $${preprocessed_files_in_builddir}  build: $${build_targets} $${staged_usage_GPRs}  ${stagedir}: -	@${MAKE} build --no-print-directory +	@${MAKE} build  # "make install" straight out of a source package triggers a build, but if  # something has been built then "make install" doesn't rebuild anything, just  # copies the built files to their destination. |