Hi, Andrew.
Thank you. That confirms what I was seeing. I appreciate R3.14 is quite old, so sorry for dragging you back to that, but I was surprised to see the “bug” persist through later releases.
However, you have a plan to remove the cleandirs target anyway, which will tidy things up again.
I like your plan but we actually use the cleandirs target to remove another directory we create called $(INSTALL_LOCATION)/data.
We’ll find another way to do that, probably adding it to the realuninstall recipes.
Like you say, adjusting which targets we use will get round my current problem with bin and lib, and ‘make distclean’ is shorter which I’m always happy with.
Thanks for your help.
Keith
Hi Keith,
On 11/7/19 4:01 AM, Baker, Keith (DLSLtd, RAL, LSCI) via Core-talk wrote:
After updating from R3.14.12.3 or R3.14.12.7 I now find that a “make uninstall” does not remove INSTALL_LOCATION_BIN or INSTALL_LOCATION_LIB.
In RULES_TOP the cleandirs: target checks if those directories are empty and if so removes them, but the check seems to fail even though the directories should have just been emptied by the uninstall: target.
This used to work until this change was introduced in R3.14.12.5,
-archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS))
- @$(MAKE) -f Makefile cleandirs
+archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs
Yeah, that's a bug that I introduced, sorry! I normally use 'make distclean' which removes all the O.<arch> directories and everything under the
bin and lib directories unconditionally. 'make clean uninstall' only removes files for the target architectures that this host-arch is configured to build, and is more to type anyway.
For future releases I'm probably going to remove the cleandirs target and do something like this diff against the 3.15 tree (3.14 is no longer supported):
diff --git a/configure/RULES_TOP b/configure/RULES_TOP
--- a/configure/RULES_TOP
+++ b/configure/RULES_TOP
@@ -24,25 +24,19 @@ UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC) \
uninstallDirs:
$(RMDIR) $(UNINSTALL_DIRS)
+EMPTY_INSTALL_DIRS = \
+ $(if $(wildcard $(INSTALL_LOCATION_BIN)/*),,$(INSTALL_LOCATION_BIN)) \
+ $(if $(wildcard $(INSTALL_LOCATION_LIB)/*),,$(INSTALL_LOCATION_LIB))
uninstall: archuninstall uninstallDirs
+ $(RMDIR) $(EMPTY_INSTALL_DIRS)
-archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs
+archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS))
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
uninstall$(DIVIDER)%:
$(RMDIR) $(INSTALL_LOCATION_BIN)/$(archPart)
$(RMDIR) $(INSTALL_LOCATION_LIB)/$(archPart)
-cleandirs:
- @$(NOP)
-ifeq ($(wildcard $(INSTALL_LOCATION_BIN)/*),)
- $(RMDIR) $(INSTALL_LOCATION_BIN)
-endif
-ifeq ($(wildcard $(INSTALL_LOCATION_LIB)/*),)
- $(RMDIR) $(INSTALL_LOCATION_LIB)
-endif
-
help:
@echo "Usage: gnumake [options] [target] ..."
This does the directory-is-empty tests after their contents have been removed but without having to use a recursive make call, which is what I was originally trying to clean up. A 'make archuninstall' will no longer remove the empty top-level bin and lib directories
when deleting the last remaining architecture, but 'make uninstall' is less typing and should be close enough anyway.
Thanks for the bug report,
- Andrew
--
Complexity comes for free, Simplicity you have to work for.
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom