From 5610b0706867745df043b9cb93b029371889cd55 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2015 17:43:26 -0600 Subject: [PATCH 1/3] 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. --- configure/CONFIG | 8 ++++++-- configure/CONFIG_APP_INCLUDE | 3 --- configure/RULES_ARCHS | 13 +++++++++++++ configure/RULES_DIRS | 13 +++++++++++++ configure/RULES_FILE_TYPE | 17 +++++++++++------ configure/RULES_TOP | 7 +++++++ documentation/RELEASE_NOTES.html | 25 +++++++++++++++++++++++++ 7 files changed, 75 insertions(+), 11 deletions(-) diff --git a/configure/CONFIG b/configure/CONFIG index 4f20c7d52..637afa3b4 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -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 /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 diff --git a/configure/CONFIG_APP_INCLUDE b/configure/CONFIG_APP_INCLUDE index 14113c951..9c23ec6a4 100644 --- a/configure/CONFIG_APP_INCLUDE +++ b/configure/CONFIG_APP_INCLUDE @@ -1,7 +1,4 @@ export TOP -export IOCAPPS - -RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops) ifneq ($(RELEASE_TOPS),) diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 1d4c2d4c1..6dfe4c92e 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -30,6 +30,15 @@ cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch)) buildDirs = $(addprefix O.,$(BUILD_ARCHS)) +# Include /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 diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index 8fd3f63b6..1043fc140 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -36,6 +36,15 @@ actionArchTargets = $(foreach action, $(ACTIONS),\ all : install +# Include /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 diff --git a/configure/RULES_FILE_TYPE b/configure/RULES_FILE_TYPE index b58bf550f..c3a3e541c 100644 --- a/configure/RULES_FILE_TYPE +++ b/configure/RULES_FILE_TYPE @@ -10,23 +10,25 @@ # #--------------------------------------------------------------- -# Include /configure/RULES_BUILD definitions from tops defined in RELEASE* files +# Include /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 /cfg/RULES* definitions from tops defined in RELEASE* files +# Include /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 /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 diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 8f100621a..94d753ec1 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -82,3 +82,10 @@ help: .PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs .PHONY: uninstall help +# Include /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 diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 98cd64ae7..6bbcb5643 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,31 @@ +

Changes to <top>/cfg/* files

+ +

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 <top>/configure/RULES_BUILD +files.

+ +

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.<arch> +directories.

+ +

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.

+

MinGW Cross-builds from Linux

Build configuration files have been back-ported from the 3.15 branch that From 2a6714fd03199db58ee14a546c907aa9b13b2c3d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2015 18:14:59 -0600 Subject: [PATCH 2/3] configure: Cosmetic changes only, comments & spacing. --- configure/CONFIG | 6 ++-- configure/CONFIG_APP_INCLUDE | 25 +++++++++++---- configure/RULES_ARCHS | 36 +++++++++------------- configure/RULES_DIRS | 59 ++++++++++++++++++++---------------- configure/RULES_FILE_TYPE | 30 ++++++++---------- configure/RULES_TOP | 19 ++++++------ 6 files changed, 91 insertions(+), 84 deletions(-) diff --git a/configure/CONFIG b/configure/CONFIG index 637afa3b4..4a9624022 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -59,8 +59,6 @@ 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 @@ -92,8 +90,10 @@ endif # Include /cfg/CONFIG* definitions from tops defined in RELEASE* files # ifneq ($(CONFIG),$(TOP)/configure) +RELEASE_TOPS_REVERSE := $(shell \ + $(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS)) RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS_REVERSE), \ - $(wildcard $($(top))/cfg/CONFIG*)) + $(wildcard $($(top))/cfg/CONFIG*)) ifneq ($(RELEASE_CFG_CONFIGS),) include $(RELEASE_CFG_CONFIGS) endif diff --git a/configure/CONFIG_APP_INCLUDE b/configure/CONFIG_APP_INCLUDE index 9c23ec6a4..d8cefde31 100644 --- a/configure/CONFIG_APP_INCLUDE +++ b/configure/CONFIG_APP_INCLUDE @@ -1,21 +1,34 @@ +#************************************************************************* +# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in the file LICENSE that is included with this distribution. +#************************************************************************* +# +# $Revision-Id$ +# + export TOP ifneq ($(RELEASE_TOPS),) define RELEASE_FLAGS_template export $(1) - $(1)_HOST_BIN = $$(strip $$($(1)))/bin/$$(EPICS_HOST_ARCH) - $(1)_HOST_LIB = $$(strip $$($(1)))/lib/$$(EPICS_HOST_ARCH) - $(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$$(T_A)) - $(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$$(T_A)) + $(1)_HOST_BIN = $$(strip $$($(1)))/bin/$(EPICS_HOST_ARCH) + $(1)_HOST_LIB = $$(strip $$($(1)))/lib/$(EPICS_HOST_ARCH) + $(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$(T_A)) + $(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$(T_A)) SHRLIB_SEARCH_DIRS += $$($(1)_LIB) - RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS))) + RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$(OS_CLASS))) RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include)) RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd) RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db) RELEASE_PERL_MODULE_DIRS += $$(wildcard $$(strip $$($(1)))/lib/perl) endef -$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) )) +$(foreach top, $(RELEASE_TOPS), \ + $(eval $(call RELEASE_FLAGS_template,$(top)))) endif diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 6dfe4c92e..5dd343ff6 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -20,13 +20,12 @@ ACTIONS += browse ACTIONS += runtests tapfiles #ACTIONS += rebuild -actionPart = $(word 1, $(subst $(DIVIDER), ,$@)) -archPart = $(word 2, $(subst $(DIVIDER), ,$@)) +actionArchTargets = $(foreach action, $(ACTIONS), \ + $(foreach arch, $(BUILD_ARCHS), \ + $(action)$(DIVIDER)$(arch))) -actionArchTargets = $(foreach x, $(ACTIONS),\ - $(foreach arch,$(BUILD_ARCHS), $(x)$(DIVIDER)$(arch))) - -cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch)) +cleanArchTargets = $(foreach arch, $(BUILD_ARCHS), \ + clean$(DIVIDER)$(arch)) buildDirs = $(addprefix O.,$(BUILD_ARCHS)) @@ -39,28 +38,19 @@ 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) +# Create EPICS_HOST_ARCH dependancies for GNU make -j option. # Needed in dirs where EPICS_HOST_ARCH build creates a tool used in # cross arch builds CROSS_ARCHS += $(CROSS1) $(CROSS2) -# j is NOT found in MAKEFLAGS when using make 3.81 -# Hope to uncomment this for GNU make 3.82 -#ifeq ($(findstring j,$(MAKEFLAGS)),j) - define DEP_template $(2): $$(EPICS_HOST_ARCH) $(1)$$(DIVIDER)$(2): $(1)$$(DIVIDER)$$(EPICS_HOST_ARCH) O.$(2) endef - -$(foreach action, $(ACTIONS), $(foreach arch,\ - $(CROSS_ARCHS),$(eval $(call DEP_template,$(action),$(arch))))) - -#endif -#************************************************************************* +$(foreach action, $(ACTIONS), \ + $(foreach arch, $(CROSS_ARCHS), \ + $(eval $(call DEP_template,$(action),$(arch))))) # Allows rebuild to work with parallel builds option, -j. ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS))) @@ -68,8 +58,11 @@ $(buildDirs) O.Common : clean rebuild: install endif +archPart = $(word 2, $(subst $(DIVIDER), ,$@)) +actionPart = $(word 1, $(subst $(DIVIDER), ,$@)) $(actionArchTargets) : $(buildDirs) O.Common - $(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. T_A=$(archPart) $(actionPart) + $(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. \ + T_A=$(archPart) $(actionPart) $(BUILD_ARCHS) : % : O.% O.Common $(MAKE) -C O.$@ -f ../Makefile TOP=$(TOP)/.. T_A=$@ @@ -82,8 +75,7 @@ $(buildDirs): O.Common: $(MKDIR) O.Common -# -# special clean rule +# Clean rules # clean :: $(RMDIR) $(addprefix O.,$(BUILD_ARCHS)) O.Common diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index 1043fc140..55e2ab562 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -15,26 +15,21 @@ ARCHS += $(BUILD_ARCHS) ACTIONS += inc build install buildInstall clean realclean archclean ACTIONS += runtests tapfiles -dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) - -actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ - $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) - dirActionArchTargets = $(foreach dir, $(DIRS), \ - $(foreach action, $(ACTIONS),\ - $(foreach arch, $(ARCHS), \ - $(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch)))) + $(foreach action, $(ACTIONS), \ + $(foreach arch, $(ARCHS), \ + $(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch)))) dirArchTargets += $(foreach dir, $(DIRS), \ - $(foreach arch, $(ARCHS),\ - $(dir)$(DIVIDER)$(arch))) + $(foreach arch, $(ARCHS), \ + $(dir)$(DIVIDER)$(arch))) dirActionTargets += $(foreach dir, $(DIRS), \ - $(foreach action, $(ACTIONS),\ - $(dir)$(DIVIDER)$(action))) -actionArchTargets = $(foreach action, $(ACTIONS),\ - $(foreach arch, $(ARCHS), \ - $(action)$(DIVIDER)$(arch))) + $(foreach action, $(ACTIONS), \ + $(dir)$(DIVIDER)$(action))) +actionArchTargets = $(foreach action, $(ACTIONS), \ + $(foreach arch, $(ARCHS), \ + $(action)$(DIVIDER)$(arch))) -all : install +all: install # Include /cfg/DIR_RULES* files from tops defined in RELEASE* files # Do this here so they can add ACTIONS @@ -57,30 +52,42 @@ endif define DEP_template1 $(1): $$($(1)_DEPEND_DIRS) endef -$(foreach dir, $(DIRS),$(eval $(call DEP_template1,$(dir)))) +$(foreach dir, $(DIRS), \ + $(eval $(call DEP_template1,$(dir)))) define DEP_template2 -$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) +$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) endef -$(foreach action, $(ACTIONS), $(foreach dir, $(DIRS),$(eval $(call DEP_template2,$(dir),$(action))))) +$(foreach action, $(ACTIONS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template2,$(dir),$(action))))) define DEP_template3 -$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) +$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) endef -$(foreach arch, $(ARCHS), $(foreach dir, $(DIRS),$(eval $(call DEP_template3,$(dir),$(arch))))) +$(foreach arch, $(ARCHS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template3,$(dir),$(arch))))) define DEP_template4 -$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir))) +$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir))) endef -$(foreach arch, $(ARCHS), $(foreach action, $(ACTIONS), $(foreach dir, $(DIRS), \ - $(eval $(call DEP_template4,$(dir),$(action),$(arch)))))) - +$(foreach arch, $(ARCHS), \ + $(foreach action, $(ACTIONS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template4,$(dir),$(action),$(arch)))))) +dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) +actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ + $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) $(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) : $(MAKE) -C $(dirPart) $(actionArchPart) $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \ - $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) + $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) .PHONY : $(DIRS) all rebuild .PHONY : $(ARCHS) $(ACTIONS) diff --git a/configure/RULES_FILE_TYPE b/configure/RULES_FILE_TYPE index c3a3e541c..e4d459a0b 100644 --- a/configure/RULES_FILE_TYPE +++ b/configure/RULES_FILE_TYPE @@ -6,28 +6,26 @@ # EPICS BASE is distributed subject to a Software License Agreement found # in the file LICENSE that is included with this distribution. #************************************************************************* +# # $Revision-Id$ # -#--------------------------------------------------------------- # Include /configure/RULES_BUILD from tops defined in RELEASE* files # RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), \ - $(wildcard $($(top))/configure/RULES_BUILD)) + $(wildcard $($(top))/configure/RULES_BUILD)) ifneq ($(RELEASE_RULES_BUILDS),) include $(RELEASE_RULES_BUILDS) endif -#--------------------------------------------------------------- # Include /cfg/RULES* files from tops defined in RELEASE* files # RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), \ - $(wildcard $($(top))/cfg/RULES*)) + $(wildcard $($(top))/cfg/RULES*)) ifneq ($(RELEASE_CFG_RULES),) include $(RELEASE_CFG_RULES) endif -#--------------------------------------------------------------- # If this is not BASE then include /configure/RULES_BUILD # ifeq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),) @@ -37,7 +35,6 @@ ifneq ($(TOP_RULES_BUILDS),) endif endif -#--------------------------------------------- # Include our own $(INSTALL_CFG)/RULES* files # TOP_CFG_RULES = $(wildcard $(INSTALL_CFG)/RULES*) @@ -45,29 +42,28 @@ ifneq ($(TOP_CFG_RULES),) include $(TOP_CFG_RULES) endif -#--------------------------------------------------------------- - +# Rules to install each FILE_TYPE +# define FILE_TYPE_template - -$(1) += $$(if $$(strip $$($(1)_$$(OS_CLASS))),$$(subst -nil-,,$$($(1)_$$(OS_CLASS))), $$($(1)_DEFAULT)) - +$(1) += $$(if $$(strip $$($(1)_$(OS_CLASS))), \ + $$(subst -nil-,,$$($(1)_$(OS_CLASS))), \ + $$($(1)_DEFAULT)) INSTALLS_$(1) = $$($(1):%=$$(INSTALL_$(1))/%) $$(INSTALL_$(1))/%: ../% $(ECHO) "Installing $(1) file $$@" @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) - $$(INSTALL_$(1))/%: % $(ECHO) "Installing $(1) file $$@" @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) -buildInstall : $$(INSTALLS_$(1)) - +buildInstall: $$(INSTALLS_$(1)) endef +$(foreach type, $(FILE_TYPE), \ + $(eval $(call FILE_TYPE_template,$(strip $(type))))) -$(foreach type, $(FILE_TYPE),$(eval $(call FILE_TYPE_template,$(strip $(type))))) -#--------------------------------------------- - +# Cleaning FILE_TYPE files +# clean:: @$(RM) $(foreach type, $(FILE_TYPE), $($(type))) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 94d753ec1..d05188943 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -4,17 +4,18 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in the file LICENSE that is included with this distribution. #************************************************************************* # -# $Revision-Id$ +# $Revision-Id$ # include $(CONFIG)/RULES_DIRS distclean: realclean cvsclean realuninstall -CVSCLEAN=$(firstword $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) +CVSCLEAN = $(firstword \ + $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) cvsclean: $(PERL) $(CVSCLEAN) @@ -22,17 +23,15 @@ realuninstall: uninstallDirs $(RMDIR) $(INSTALL_LOCATION_BIN) $(RMDIR) $(INSTALL_LOCATION_LIB) -UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC)\ - $(INSTALL_HTML) $(INSTALL_JAVA) $(INSTALL_TEMPLATES) \ - $(INSTALL_DB) +UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC) \ + $(INSTALL_HTML) $(INSTALL_JAVA) $(INSTALL_TEMPLATES) $(INSTALL_DB) UNINSTALL_DIRS += $(DIRECTORY_TARGETS) uninstallDirs: $(RMDIR) $(UNINSTALL_DIRS) uninstall: archuninstall uninstallDirs -archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) - @$(MAKE) -f Makefile cleandirs +archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs archPart = $(word 2, $(subst $(DIVIDER), ,$@)) uninstall$(DIVIDER)%: @@ -40,14 +39,14 @@ uninstall$(DIVIDER)%: $(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 - @echo -# The echo above stops a "nothing to be done for cleandirs" message + help: @echo "Usage: gnumake [options] [target] ..." From 84e74d09241b0e49dc7e557e389869982121060f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2015 11:33:50 -0500 Subject: [PATCH 3/3] Fix 'Can't find convertRelease.pl' problem --- configure/CONFIG_BASE | 3 ++- configure/RULES_TOP | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index d1f561503..c6cdaac6e 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -54,6 +54,7 @@ BASE_CPPFLAGS += $(OSITHREAD_DEFAULT_STACK_FLAGS_$(OSITHREAD_USE_DEFAULT_STACK)) # Where to find the installed build tools TOOLS = $(EPICS_BASE_HOST_BIN) +FIND_TOOL = $(firstword $(wildcard $$(TOOLS)/$(1) $(TOP)/src/tools/$(1))) #--------------------------------------------------------------- # Epics base build tools and tool flags @@ -63,7 +64,7 @@ DBEXPAND = $(call PATH_FILTER, $(TOOLS)/dbExpand$(HOSTEXE)) DBTORECORDTYPEH = $(call PATH_FILTER, $(TOOLS)/dbToRecordtypeH$(HOSTEXE)) DBTOMENUH = $(call PATH_FILTER, $(TOOLS)/dbToMenuH$(HOSTEXE)) REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl -CONVERTRELEASE = $(PERL) $(TOOLS)/convertRelease.pl +CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl) FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl #------------------------------------------------------- diff --git a/configure/RULES_TOP b/configure/RULES_TOP index d05188943..1898f591e 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -14,8 +14,7 @@ include $(CONFIG)/RULES_DIRS distclean: realclean cvsclean realuninstall -CVSCLEAN = $(firstword \ - $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) +CVSCLEAN = $(call FIND_TOOL,cvsclean.pl) cvsclean: $(PERL) $(CVSCLEAN)