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.<host>.local if configure/CONFIG_SITE or
configure/CONFIG_SITE.local have changed.
* Move the distclean of modules/RELEASE.<host>.local to RULES_TOP
* Several comment and white-space changes
This commit is contained in:
Andrew Johnson
2022-09-02 14:10:27 -05:00
parent ede35aa152
commit efc7cbaf7f
4 changed files with 60 additions and 25 deletions

View File

@ -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), \

View File

@ -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.<host>.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_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
endif
uninstallDirs:
$(RMDIR) $(UNINSTALL_DIRS)
# Remove the bin and lib directories if they have no sub-directories
#
EMPTY_INSTALL_DIRS = \
EMPTY_INSTALL_DIRS = \
$(if $(wildcard $(INSTALL_LOCATION_BIN)/*),,$(INSTALL_LOCATION_BIN)) \
$(if $(wildcard $(INSTALL_LOCATION_LIB)/*),,$(INSTALL_LOCATION_LIB))
uninstall: archuninstall uninstallDirs | clean
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.<arch> dirs created by running make"
@echo " In O.<arch> dir, clean removes build created files"
@echo " realclean - Removes ALL O.<arch> dirs"
@ -101,7 +107,8 @@ ifndef DISABLE_TOP_RULES
@echo " uninstall$(DIVIDER)<arch> - Remove bin & lib directories for <arch> 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.<host>.local files"
endif
@echo " help - Prints this list of valid make targets "
@echo "Object targets are supported by the O.<arch> level Makefile .e.g"

View File

@ -16,6 +16,24 @@ should also be read to understand what has changed since earlier releases.
<!-- Insert new items immediately below here ... -->
### 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.<host>.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.<host>.local` file
will now be regenerated in case the install path has been modified.
Note that passing `INSTALL_LOCATION=<path>` on the make command-line will
only work if you have run `make distclean` immediately beforehand, as the
`modules/RELEASE.<host>.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

View File

@ -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