[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/multiarch 1f60a0b 2/3: Clean up the 'clean' targ
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/multiarch 1f60a0b 2/3: Clean up the 'clean' targets |
Date: |
Wed, 24 Apr 2019 18:42:16 -0400 (EDT) |
branch: odd/multiarch
commit 1f60a0b2b1a8e75c587ccbe9914d66883effec54
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Clean up the 'clean' targets
---
GNUmakefile | 58 +++++++++++++++++++++++-----------------------------------
1 file changed, 23 insertions(+), 35 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 0e8e6f5..2c17100 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -320,35 +320,8 @@ endef
################################################################################
-# Clean.
+# Clean and its kindred.
-# Almost all targets are built in a build directory, so the 'clean'
-# target is run there: see 'workhorse.make'.
-#
-# The 'clobber' target removes the build directories for every
-# $(build_type), but only for the current $LMI_HOST architecture,
-# i.e.:
-# $exec_prefix/build
-# and its subdirectories, and similarly for a small hard-coded list of
-# known architectures.
-#
-# A list of directories such as:
-# find $prefix -name build
-# would include some that this makefile does not build, as might even
-# such a list as:
-# find $prefix -maxdepth 2 -name build -type d
-# and it is not possible to enumerate all possible $LMI_HOST values
-# (file 'PLATFORMS' in the libtool sources may seem to come close, but
-# even it needs ongoing updates).
-#
-# This target could be made to remove all files built by this makefile
-# if the build directory were
-# build_directory := $(prefix)/build/$(LMI_HOST)/$(build_type)
-# instead of
-# build_directory := $(exec_prefix)/build/$(build_type)
-# but that would amount to inserting an infix into $exec_prefix,
-# which would be most odd.
-#
# This makefile has rules to build a few files in the source
# directory, viz.
# quoted_gpl
@@ -365,22 +338,37 @@ expungible_files := $(wildcard *~ *.bak *eraseme*)
source_clean:
@-$(RM) --force $(expungible_files)
-.PHONY: clean
-clean: source_clean
- -$(RM) --force --recursive $(build_directory)
+# Simple aliases.
.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)/build/$(build_type))
+ $(error Assertion failure: build directory misconfigured)
+endif
+
+.PHONY: clean
+clean: source_clean
+ -$(RM) --force --recursive $(exec_prefix)/build/$(build_type)
+
.PHONY: clobber
clobber: source_clean
-$(RM) --force --recursive $(exec_prefix)/build
- -$(RM) --force --recursive $(prefix)/i686-w64-mingw32/build
- -$(RM) --force --recursive $(prefix)/x86_64-w64-mingw32/build
- -$(RM) --force --recursive $(prefix)/x86_64-pc-linux-gnu/build
.PHONY: raze
-raze: clobber
+raze: source_clean
+ -$(RM) --force --recursive $(exec_prefix)
+
+# This is at least temporarily useful while 'install_msw.sh' is
+# rapidly changing; but then perhaps it should be moved thither.
+
+.PHONY: eviscerate
+eviscerate: source_clean
-$(RM) --force --recursive $(prefix)/i686-w64-mingw32
-$(RM) --force --recursive $(prefix)/x86_64-w64-mingw32
-$(RM) --force --recursive $(prefix)/x86_64-pc-linux-gnu