From efc7cbaf7f93c1bc58f98b30b9d20a27bc0a7f91 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 2 Sep 2022 14:10:27 -0500 Subject: [PATCH] Build system fixes related to INSTALL_LOCATION * The build can't descend into external submodules when there is no configure/RULES_TOP file present in $(INSTALL_LOCATION). * Recreate modules/RELEASE..local if configure/CONFIG_SITE or configure/CONFIG_SITE.local have changed. * Move the distclean of modules/RELEASE..local to RULES_TOP * Several comment and white-space changes --- configure/RULES_MODULES | 14 +++++------ configure/RULES_TOP | 43 ++++++++++++++++++++-------------- documentation/RELEASE_NOTES.md | 18 ++++++++++++++ modules/CONFIG_SITE.local | 10 ++++++++ 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/configure/RULES_MODULES b/configure/RULES_MODULES index bed21da38..c8bf850aa 100644 --- a/configure/RULES_MODULES +++ b/configure/RULES_MODULES @@ -22,9 +22,11 @@ # 7. Submodules must have a configure/CONFIG_SITE file that contains # -include $(TOP)/../CONFIG_SITE.local -# Add checked-out submodules to DIRS -LIVE_SUBMODULES = $(subst /Makefile,,$(wildcard $(addsuffix /Makefile, $(SUBMODULES)))) -DIRS += $(LIVE_SUBMODULES) +# Add checked-out submodules to DIRS, unless INSTALL_LOCATION is empty +LIVE_SUBMODULES = $(subst /Makefile,, \ + $(wildcard $(addsuffix /Makefile, $(SUBMODULES)))) +live = $(if $(wildcard $(INSTALL_CONFIG)/RULES_TOP),LIVE,DEAD) +DIRS += $($(live)_SUBMODULES) include $(CONFIG)/RULES_DIRS @@ -37,14 +39,12 @@ all host $(DIRS) $(ARCHS) $(ACTIONS) $(dirActionTargets) $(dirArchTargets) \ # Convenience target RELEASE.host: $(RELEASE_LOCAL) -$(RELEASE_LOCAL): Makefile CONFIG_SITE.local +$(RELEASE_LOCAL): Makefile $(CONFIG)/CONFIG_SITE $(CONFIG)/CONFIG_SITE.local $(ECHO) Creating $@ with $(ECHO) " $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)" @echo $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)> $@ -realclean: - $(RM) $(wildcard RELEASE.*.local) -.PHONY: RELEASE.host realclean +.PHONY: RELEASE.host # Testing: Combine test failure logs from the live submodules TESTS_FAILED_LOGS = $(wildcard $(addsuffix /$(TESTS_FAILED_LOG), \ diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 60b52e0de..50079b446 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -23,35 +23,42 @@ ifndef DISABLE_TOP_RULES # Rules for a regular application top directory # -distclean: realclean cvsclean realuninstall + # When run by 'make distclean' the realuninstall target also + # removes any modules/RELEASE..local files + distclean: realclean cvsclean realuninstall -realuninstall: uninstallDirs + realuninstall: uninstallDirs $(RMDIR) $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB) + ifeq (modules,$(filter modules,$(DIRS))) + ifeq (distclean,$(filter distclean,$(MAKECMDGOALS))) + $(RM) $(wildcard modules/RELEASE.*.local) + endif + endif -UNINSTALL_DIRS += $(INSTALL_DB) $(INSTALL_DBD) $(INSTALL_DOC) $(INSTALL_HTML) -UNINSTALL_DIRS += $(INSTALL_INCLUDE) $(INSTALL_TEMPLATES) $(DIRECTORY_TARGETS) -ifneq ($(INSTALL_LOCATION),$(TOP)) - UNINSTALL_DIRS += $(INSTALL_CONFIG) -endif -uninstallDirs: | clean + UNINSTALL_DIRS += $(INSTALL_DB) $(INSTALL_DBD) $(INSTALL_DOC) $(INSTALL_HTML) + UNINSTALL_DIRS += $(INSTALL_INCLUDE) $(INSTALL_TEMPLATES) $(DIRECTORY_TARGETS) + ifneq ($(INSTALL_LOCATION),$(TOP)) + UNINSTALL_DIRS += $(INSTALL_CONFIG) + endif + uninstallDirs: $(RMDIR) $(UNINSTALL_DIRS) # Remove the bin and lib directories if they have no sub-directories # -EMPTY_INSTALL_DIRS = \ - $(if $(wildcard $(INSTALL_LOCATION_BIN)/*),,$(INSTALL_LOCATION_BIN)) \ - $(if $(wildcard $(INSTALL_LOCATION_LIB)/*),,$(INSTALL_LOCATION_LIB)) -uninstall: archuninstall uninstallDirs | clean + 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)) + archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) -uninstall$(DIVIDER)%: | clean + uninstall$(DIVIDER)%: $(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \ $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB)) -# Only run this at the top of the parent -runtests test-results: + # Only run this at the top of the parent + runtests test-results: @$(SHOWTESTFAILURES) else @@ -76,7 +83,6 @@ help: @echo " inc - Installs header, dbd and html files" @echo " build - Builds and installs all targets" @echo " install - Builds and installs all targets" - @echo " buildInstall - Same as install (deprecated)" @echo " clean - Removes the O. dirs created by running make" @echo " In O. dir, clean removes build created files" @echo " realclean - Removes ALL O. dirs" @@ -101,7 +107,8 @@ ifndef DISABLE_TOP_RULES @echo " uninstall$(DIVIDER) - Remove bin & lib directories for only." @echo " uninstall - Remove install directories created by this hostarch." @echo " realuninstall - Removes ALL install dirs" - @echo " distclean - Same as realclean cvsclean realuninstall." + @echo " distclean - Does realclean cvsclean realuninstall and deletes any" + @echo " generated modules/RELEASE..local files" endif @echo " help - Prints this list of valid make targets " @echo "Object targets are supported by the O. level Makefile .e.g" diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 10cd9118a..edc819b98 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -16,6 +16,24 @@ should also be read to understand what has changed since earlier releases. +### Build System updates + +The top-level make targets `uninstall`, `archuninstall` and similar no +longer trigger the `clean` target which empties build directories, this +was a bug introduced in 7.0.5. + +The `make distclean` target now properly deletes the generated file(s) +`modules/RELEASE..local` which are essential to build the external +submodules under the `modules` directory, and should not crash if the +build is configured with `INSTALL_LOCATION` pointing to an empty external directory (i.e. if you run `make distclean` twice in succession). When +`INSTALL_LOCATION` is set in the files `configure/CONFIG_SITE` or +`configure/CONFIG_SITE.local` the `modules/RELEASE..local` file +will now be regenerated in case the install path has been modified. + +Note that passing `INSTALL_LOCATION=` on the make command-line will +only work if you have run `make distclean` immediately beforehand, as the +`modules/RELEASE..local` file must be recreated using the new path. + ### Enhancements to `capr.pl` The `capr.pl` script can now display records from older Base versions to diff --git a/modules/CONFIG_SITE.local b/modules/CONFIG_SITE.local index db97a5b78..f0becc2bb 100644 --- a/modules/CONFIG_SITE.local +++ b/modules/CONFIG_SITE.local @@ -2,6 +2,16 @@ # EPICS BASE is distributed subject to a Software License Agreement found # in file LICENSE that is included with this distribution. #************************************************************************* +# +# modules/CONFIG_SITE.local +# +# Despite the .local in its name, this file *is* included in EPICS Base +# sources and should *not* be modified by sites. This trick is necessary +# to allow external submodules to be placed inside the modules directory +# without having to modify them, as long as their configure/CONFIG_SITE +# file includes the standard line +# -include $(TOP)/../CONFIG_SITE.local +# that causes this file to be read in during submodule builds. # The name our submodules know us by: PARENT_MODULE = EPICS_BASE