Avoid accidental rm -Rf / regression in last release by calling $(*abspath) on $(INSTALL_DIR) beforehand -- sure it sets it to $(abs_top_srcdir), but it's a lot safer safety net to not clean as opposed to blowing away /.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
diff --git a/Makefile b/Makefile
index cb6e896..87295a7 100644
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,13 @@
INSTALL_DIR := $(DESTDIR)/$(prefix)
+# DO NOT REMOVE THIS CALL (see clean_install_dir call below...)!!!!
+ifdef MAKE_3_80_COMPAT
+INSTALL_DIR := $(call MAKE_3_80_abspath,$(INSTALL_DIR))
+else
+INSTALL_DIR := $(abspath $(INSTALL_DIR))
+endif
+
# build tree bootstrap targets and $(INSTALL_DIR) target.
$(sort $(addprefix $(abs_top_builddir)/,$(BOOTSTRAP_TARGETS)) $(INSTALL_DIR) $(DESTDIR)/$(bindir)):
mkdir -m 00755 -p "$@"
@@ -141,9 +148,12 @@
# Clean the directory if the build-tree is properly configured and not set to
# the srcdir.
-#ifeq ($(filter $(BUILD_TREE_STATE),$(BUILD_TREE_SRCDIR_INSTALL) $(BUILD_TREE_UNCONFIGURED)),)
-#CLEAN_TARGETS += clean_install_dir
-#endif
+ifeq ($(filter $(BUILD_TREE_STATE),$(BUILD_TREE_SRCDIR_INSTALL) $(BUILD_TREE_UNCONFIGURED)),)
+# Make sure that we don't whack `/'!!!!!
+ifneq ($(INSTALL_DIR),/)
+CLEAN_TARGETS += clean_install_dir
+endif
+endif
clean:: $(CLEAN_TARGETS)
$(RM) -f Version