make/MainSupport.gmk
changeset 47217 72e3ae9a25eb
parent 46196 822ca950ddaa
child 47253 92fd0e04e0e1
--- a/make/MainSupport.gmk	Tue Sep 12 19:03:39 2017 +0200
+++ b/make/MainSupport.gmk	Tue Sep 12 19:03:56 2017 +0200
@@ -33,7 +33,7 @@
 # Run the tests specified by $1, with PRODUCT_HOME specified by $2
 # JT_JAVA is picked up by the jtreg launcher and used to run Jtreg itself.
 define RunTests
-	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
+	($(CD) $(TOPDIR)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
 	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
 	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
 	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \
@@ -118,42 +118,36 @@
 
 ################################################################################
 
-MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) \
-    $(HOTSPOT_TOPDIR)
-MAKE_MAKEDIR_LIST := make
+PHASE_MAKEDIRS := $(TOPDIR)/make
 
 # Helper macro for DeclareRecipesForPhase
 # Declare a recipe for calling the module and phase specific makefile.
 # If there are multiple makefiles to call, create a rule for each topdir
 # that contains a makefile with the target $module-$suffix-$repodir,
-# (i.e: java.base-gensrc-jdk)
+# (i.e: java.base-gensrc-src)
 # Normally there is only one makefile, and the target will just be
 # $module-$suffix
 # Param 1: Name of list to add targets to
 # Param 2: Module name
-# Param 3: Topdir
 define DeclareRecipeForModuleMakefile
-  ifeq ($$($1_MULTIPLE_MAKEFILES), true)
-    $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
-
-    $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
-  else
-    $2-$$($1_TARGET_SUFFIX):
-  endif
+  $2-$$($1_TARGET_SUFFIX):
         ifeq ($$($1_USE_WRAPPER), true)
-	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+	  +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
 	      -f ModuleWrapper.gmk \
-	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
-	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
-	          MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
+	      $$(addprefix -I, $$(PHASE_MAKEDIRS) \
+	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
+	      ) \
+	      MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
         else
-	  +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
-	          $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
-	    && $(MAKE) $(MAKE_ARGS) \
-	          -f $$($1_FILE_PREFIX)-$2.gmk \
-	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
-	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
-	          MODULE=$2)
+	  +($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix \
+	      /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))) \
+	  && $(MAKE) $(MAKE_ARGS) \
+	      -f $$($1_FILE_PREFIX)-$2.gmk \
+	      $$(addprefix -I, $$(PHASE_MAKEDIRS) \
+	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
+	      ) \
+	      MODULE=$2 \
+	  )
         endif
 
 endef
@@ -162,14 +156,11 @@
 # Param 1: Name of list to add targets to
 # Param 2: Module name
 define DeclareRecipesForPhaseAndModule
-  $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
-      $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
-          $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
-          $$(foreach s, $(MAKE_MAKEDIR_LIST), \
-              $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
+  $1_$2_MAKEFILES := $$(strip $$(wildcard \
+      $$(addsuffix /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))
 
   # Only declare recipes if there are makefiles to call
-  ifneq ($$($1_$2_TOPDIRS), )
+  ifneq ($$($1_$2_MAKEFILES), )
     # Add the top dir specific target to target list regardless of if recipe
     # generation is disabled.
     ifeq ($$($1_MULTIPLE_MAKEFILES), true)
@@ -177,8 +168,7 @@
         $$(eval $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $$d)))
     endif
     ifeq ($(NO_RECIPES),)
-      $$(foreach d, $$($1_$2_TOPDIRS), \
-          $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
+      $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2))
     endif
     $1 += $2-$$($1_TARGET_SUFFIX)
     $1_MODULES += $2
@@ -200,7 +190,7 @@
 # $1_MODULES : All modules that had rules generated
 # $1_TARGETS : All targets generated
 define DeclareRecipesForPhase
-  $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
+  $(foreach i,2 3 4 5 6 7, $(if $(strip $($i)),$(strip $1)_$(strip $($i)))$(NEWLINE))
   $(if $(8),$(error Internal makefile error: Too many arguments to \
       DeclareRecipesForPhase, please update MakeHelper.gmk))