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] ..."