lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 4e8d281 4/6: Relocate lmi's build directory


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4e8d281 4/6: Relocate lmi's build directory
Date: Wed, 24 Apr 2019 16:47:17 -0400 (EDT)

branch: master
commit 4e8d28122c253f6a0836e8921fc033d558872e60
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Relocate lmi's build directory
    
    This is the first in a series of changes to the directory structure,
    all of which may require rebuilding.
    
    Formerly, object files for a default build were written in
      /opt/lmi/src/build/lmi/gcc/ship/
    but now they're instead written in
      /opt/lmi/gcc/build/ship/
    
    Rationale: the old build directory
    $(srcdir)/../build/$(notdir $(srcdir))/$(uname)/$(toolset)/$(build_type)
    inserted 'build/' between the last two components of $(srcdir) (although
    $(exec_prefix) would have been a better choice), then added $(uname)
    (which recently became empty), and then added the rest. The new build
    directory
      $(exec_prefix)/$(toolset)/build/$(build_type)
    is rooted properly at $(exec_prefix); it includes $(toolset) before
    the other path components because the existing $(toolset) and a host
    type (soon to be added) will become part of $(exec_prefix), fulfilling
    its destiny as the "parent directory for machine-specific binaries".
---
 GNUmakefile | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4efb4ae..b0ec944 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -173,8 +173,7 @@ $(srcdir)/local_options.make:: ;
 
 build_type ?= ship
 toolset ?= gcc
-build_dir := \
-  $(srcdir)/../build/$(notdir $(srcdir))/$(uname)/$(toolset)/$(build_type)
+build_dir := $(exec_prefix)/$(toolset)/build/$(build_type)
 
 gpl_files := \
   COPYING \
@@ -336,13 +335,21 @@ source_clean:
 .PHONY: distclean mostlyclean maintainer-clean
 distclean mostlyclean maintainer-clean: clean
 
+# This precondition permits writing progressively severer 'clean'
+# targets more clearly. To use an alternative like
+#   rm -rf $(build_dir)/../..
+# would be to invite disaster.
+ifneq ($(build_dir),$(exec_prefix)/$(toolset)/build/$(build_type))
+  $(error Assertion failure: build directory misconfigured)
+endif
+
 .PHONY: clean
 clean: source_clean
-       -$(RM) --force --recursive $(build_dir)
+       -$(RM) --force --recursive $(exec_prefix)/$(toolset)/build/$(build_type)
 
 .PHONY: clobber
 clobber: source_clean
-       -$(RM) --force --recursive $(srcdir)/../build
+       -$(RM) --force --recursive $(exec_prefix)/$(toolset)/build
 
 .PHONY: raze
 raze: clobber



reply via email to

[Prev in Thread] Current Thread [Next in Thread]