configure: Support for cfg/TOP_RULES* and cfg/DIR_RULES*

Idea and initial implementation from Benjamin Franksen,
I added the DIR_RULES and ACTIONS support.
Reverses the order in which cfg/CONFIG* files are included.
This commit is contained in:
Andrew Johnson
2015-03-06 17:43:26 -06:00
parent d26654674c
commit 5610b07068
7 changed files with 75 additions and 11 deletions

View File

@@ -58,6 +58,10 @@ include $(CONFIG)/CONFIG_BASE_VERSION
include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
RELEASE_TOPS_REVERSE := $(shell \
$(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS))
ifdef T_A
# Cross compile specific definitions
@@ -88,8 +92,8 @@ endif
# Include <top>/cfg/CONFIG* definitions from tops defined in RELEASE* files
#
ifneq ($(CONFIG),$(TOP)/configure)
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/CONFIG*))
RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS_REVERSE), \
$(wildcard $($(top))/cfg/CONFIG*))
ifneq ($(RELEASE_CFG_CONFIGS),)
include $(RELEASE_CFG_CONFIGS)
endif

View File

@@ -1,7 +1,4 @@
export TOP
export IOCAPPS
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
ifneq ($(RELEASE_TOPS),)

View File

@@ -30,6 +30,15 @@ cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch))
buildDirs = $(addprefix O.,$(BUILD_ARCHS))
# Include <top>/cfg/DIR_RULES* files from tops defined in RELEASE* files
# Do this here so they can add ACTIONS
#
RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/DIR_RULES*))
ifneq ($(RELEASE_CFG_DIR_RULES),)
include $(RELEASE_CFG_DIR_RULES)
endif
#*************************************************************************
# Create epics_host_arch dependancies for GNU make -j option
# Only works with GNU make 3.81 or later (uses eval function)
@@ -92,3 +101,7 @@ realclean ::
.PHONY : $(cleanArchTargets)
.PHONY : $(BUILD_ARCHS) rebuild
.PHONY : $(ACTIONS) clean realclean archclean all
# User specific rules
#
-include $(HOME)/configure/RULES_USER

View File

@@ -36,6 +36,15 @@ actionArchTargets = $(foreach action, $(ACTIONS),\
all : install
# Include <top>/cfg/DIR_RULES* files from tops defined in RELEASE* files
# Do this here so they can add ACTIONS
#
RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/DIR_RULES*))
ifneq ($(RELEASE_CFG_DIR_RULES),)
include $(RELEASE_CFG_DIR_RULES)
endif
# Allows rebuild to work with parallel builds option, -j.
ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS)))
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)install): \
@@ -79,3 +88,7 @@ $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \
.PHONY : $(dirActionArchTargets)
.PHONY : $(actionArchTargets)
# User specific rules
#
-include $(HOME)/configure/RULES_USER

View File

@@ -10,23 +10,25 @@
#
#---------------------------------------------------------------
# Include <top>/configure/RULES_BUILD definitions from tops defined in RELEASE* files
# Include <top>/configure/RULES_BUILD from tops defined in RELEASE* files
#
RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/configure/RULES_BUILD))
RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/configure/RULES_BUILD))
ifneq ($(RELEASE_RULES_BUILDS),)
include $(RELEASE_RULES_BUILDS)
endif
#---------------------------------------------------------------
# Include <top>/cfg/RULES* definitions from tops defined in RELEASE* files
# Include <top>/cfg/RULES* files from tops defined in RELEASE* files
#
RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/RULES*))
RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/RULES*))
ifneq ($(RELEASE_CFG_RULES),)
include $(RELEASE_CFG_RULES)
endif
#---------------------------------------------------------------
# If this is not BASE then include TOP/configure/RULES_BUILD definitions
# If this is not BASE then include <TOP>/configure/RULES_BUILD
#
ifeq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),)
TOP_RULES_BUILDS = $(wildcard $(TOP)/configure/RULES_BUILD)
@@ -36,7 +38,7 @@ endif
endif
#---------------------------------------------
# Include our own $(INSTALL_CFG)/RULES* definitions
# Include our own $(INSTALL_CFG)/RULES* files
#
TOP_CFG_RULES = $(wildcard $(INSTALL_CFG)/RULES*)
ifneq ($(TOP_CFG_RULES),)
@@ -69,3 +71,6 @@ $(foreach type, $(FILE_TYPE),$(eval $(call FILE_TYPE_template,$(strip $(type))))
clean::
@$(RM) $(foreach type, $(FILE_TYPE), $($(type)))
# User specific rules
#
-include $(HOME)/configure/RULES_USER

View File

@@ -82,3 +82,10 @@ help:
.PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs
.PHONY: uninstall help
# Include <top>/cfg/TOP_RULES* files from tops defined in RELEASE* files
#
RELEASE_CFG_TOP_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/TOP_RULES*))
ifneq ($(RELEASE_CFG_TOP_RULES),)
include $(RELEASE_CFG_TOP_RULES)
endif

View File

@@ -13,6 +13,31 @@
<!-- Insert new items immediately below here ... -->
<h3>Changes to &lt;top&gt;/cfg/* files</h3>
<p>The order in which cfg/CONFIG* and cfg/RULES* files are included from support
applications listed in the configure/RELEASE* files has been changed. Previously
these files were included in the order in which the top areas are listed in the
RELEASE file, but it makes more sense to load them in reverse order since later
entries override earlier ones in Makefiles but the release file order is
supposed to allow earlier entries to take precedence over later ones. The same
change has been made to the inclusion of the &lt;top&gt;/configure/RULES_BUILD
files.</p>
<p>Two new file types can also be provided in a module's cfg directory. Files
named TOP_RULES* will be included by the top-level Makefile of other modules
that refer to this module; files name DIR_RULES* will be included by all
Makefiles that merely descend into lower-level directories. The cfg/RULES* files
are only included when make is building code inside the O.&lt;arch&gt;
directories.</p>
<p>The new cfg/DIR_RULES* file inclusion was designed to permit new recursive
make actions to be implemented by appending the name of the new action to the
ACTIONS variable. There must be a matching rule in one of the cfg/RULES* files
when doing this. Similar rules may also be defined in the cfg/TOP_RULES* and/or
cfg/DIR_RULES* files, but these should only state prerequisites and not directly
provide commands to be executed.</p>
<h3>MinGW Cross-builds from Linux</h3>
<p>Build configuration files have been back-ported from the 3.15 branch that