annotate make/MainSupport.gmk @ 51719:9071d2023859

fixes for regression test MethodHandleRefTest.java
author vromero
date Tue, 17 Jul 2018 13:28:17 -0700
parents 59bdd7243c52
children c5905f5d6d45
rev   line source
erikj@13133 1 #
ctornqvi@46196 2 # Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
ihse@29662 26 ################################################################################
ihse@29662 27 # This file contains helper functions for Main.gmk.
ihse@29662 28 ################################################################################
erikj@13133 29
ihse@29662 30 ifndef _MAINSUPPORT_GMK
ihse@29662 31 _MAINSUPPORT_GMK := 1
erikj@13133 32
ehelin@37974 33 # Run the tests specified by $1, with PRODUCT_HOME specified by $2
erikj@41047 34 # JT_JAVA is picked up by the jtreg launcher and used to run Jtreg itself.
ihse@29156 35 define RunTests
erikj@47217 36 ($(CD) $(TOPDIR)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
ehelin@37974 37 JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
ihse@29156 38 TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
mcimadamore@47290 39 ALT_OUTPUTDIR=$(OUTPUTDIR) TEST_JOBS=$(TEST_JOBS) \
ctornqvi@46196 40 JT_JAVA=$(BOOT_JDK) JIB_JAR=$(JIB_JAR) \
ehelin@34594 41 JOBS=$(JOBS) $1) || true
ihse@29156 42 endef
ihse@29156 43
ihse@41652 44 define CleanDocs
ihse@41652 45 @$(PRINTF) "Cleaning docs ..."
ihse@41652 46 @$(PRINTF) "\n" $(LOG_DEBUG)
ihse@41652 47 $(RM) -r $(SUPPORT_OUTPUTDIR)/docs
ihse@41652 48 $(RM) -r $(SUPPORT_OUTPUTDIR)/javadoc
ihse@41652 49 $(RM) -r $(IMAGES_OUTPUTDIR)/docs
ihse@41652 50 @$(PRINTF) " done\n"
ihse@41652 51 endef
ihse@41652 52
chegar@27560 53 # Cleans the dir given as $1
chegar@27560 54 define CleanDir
chegar@25854 55 @$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
erikj@29790 56 @$(PRINTF) "\n" $(LOG_DEBUG)
mcimadamore@47290 57 ($(CD) $(OUTPUTDIR) && $(RM) -r $1)
ihse@20363 58 @$(PRINTF) " done\n"
ohair@13697 59 endef
ohair@13697 60
ihse@33437 61 define CleanSupportDir
ihse@33437 62 @$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
ihse@33437 63 @$(PRINTF) "\n" $(LOG_DEBUG)
ihse@33437 64 $(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1)
ihse@33437 65 @$(PRINTF) " done\n"
ihse@33437 66 endef
ihse@33437 67
ihse@29156 68 define CleanTest
ihse@29156 69 @$(PRINTF) "Cleaning test $(strip $1) ..."
erikj@29790 70 @$(PRINTF) "\n" $(LOG_DEBUG)
erikj@29790 71 $(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
ihse@33052 72 # Remove as much of the test directory structure as is empty
ihse@33052 73 $(RMDIR) -p $(dir $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))) 2> /dev/null || true
ihse@29156 74 @$(PRINTF) " done\n"
ihse@29156 75 endef
ihse@29156 76
chegar@27560 77 define Clean-gensrc
chegar@27560 78 @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
erikj@29790 79 @$(PRINTF) "\n" $(LOG_DEBUG)
erikj@29790 80 $(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
chegar@27560 81 @$(PRINTF) " done\n"
chegar@27560 82 endef
chegar@27560 83
chegar@27560 84 define Clean-java
chegar@27560 85 @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
erikj@29790 86 @$(PRINTF) "\n" $(LOG_DEBUG)
erikj@29790 87 $(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
erikj@31310 88 $(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1)
erikj@29790 89 $(PRINTF) " done\n"
erikj@29790 90 $(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
erikj@29790 91 $(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
chegar@27560 92 @$(PRINTF) " done\n"
chegar@27560 93 endef
chegar@27560 94
chegar@27560 95 define Clean-native
chegar@27560 96 @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
erikj@29790 97 @$(PRINTF) "\n" $(LOG_DEBUG)
erikj@29790 98 $(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
erikj@29790 99 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
erikj@29790 100 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
chegar@27560 101 @$(PRINTF) " done\n"
chegar@27560 102 endef
chegar@27560 103
chegar@27560 104 define Clean-include
chegar@27560 105 @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
erikj@29790 106 @$(PRINTF) "\n" $(LOG_DEBUG)
erikj@29790 107 $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
erikj@29790 108 @$(PRINTF) " done\n"
erikj@29790 109 endef
erikj@29790 110
chegar@27560 111 define CleanModule
chegar@27560 112 $(call Clean-gensrc, $1)
chegar@27560 113 $(call Clean-java, $1)
chegar@27560 114 $(call Clean-native, $1)
chegar@27560 115 $(call Clean-include, $1)
chegar@27560 116 endef
chegar@27560 117
chegar@27560 118
erikj@26116 119 ################################################################################
erikj@26116 120
erikj@47217 121 PHASE_MAKEDIRS := $(TOPDIR)/make
erikj@26116 122
chegar@27560 123 # Helper macro for DeclareRecipesForPhase
chegar@27560 124 # Declare a recipe for calling the module and phase specific makefile.
chegar@27560 125 # If there are multiple makefiles to call, create a rule for each topdir
ihse@28356 126 # that contains a makefile with the target $module-$suffix-$repodir,
erikj@47217 127 # (i.e: java.base-gensrc-src)
chegar@27560 128 # Normally there is only one makefile, and the target will just be
chegar@27560 129 # $module-$suffix
chegar@27560 130 # Param 1: Name of list to add targets to
chegar@27560 131 # Param 2: Module name
chegar@27560 132 define DeclareRecipeForModuleMakefile
erikj@47217 133 $2-$$($1_TARGET_SUFFIX):
chegar@27560 134 ifeq ($$($1_USE_WRAPPER), true)
erikj@47217 135 +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
chegar@27560 136 -f ModuleWrapper.gmk \
erikj@47217 137 $$(addprefix -I, $$(PHASE_MAKEDIRS) \
erikj@47217 138 $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
erikj@47217 139 ) \
erikj@47217 140 MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
chegar@27560 141 else
erikj@47217 142 +($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix \
erikj@47217 143 /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))) \
erikj@47217 144 && $(MAKE) $(MAKE_ARGS) \
erikj@47217 145 -f $$($1_FILE_PREFIX)-$2.gmk \
erikj@47217 146 $$(addprefix -I, $$(PHASE_MAKEDIRS) \
erikj@47217 147 $$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \
erikj@47217 148 ) \
erikj@47217 149 MODULE=$2 \
erikj@47217 150 )
chegar@27560 151 endif
chegar@27560 152
chegar@27560 153 endef
chegar@27560 154
chegar@27560 155 # Helper macro for DeclareRecipesForPhase
chegar@27560 156 # Param 1: Name of list to add targets to
chegar@27560 157 # Param 2: Module name
chegar@27560 158 define DeclareRecipesForPhaseAndModule
erikj@47217 159 $1_$2_MAKEFILES := $$(strip $$(wildcard \
erikj@47217 160 $$(addsuffix /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))
chegar@27560 161
chegar@27560 162 # Only declare recipes if there are makefiles to call
erikj@47217 163 ifneq ($$($1_$2_MAKEFILES), )
erikj@41172 164 # Add the top dir specific target to target list regardless of if recipe
erikj@41172 165 # generation is disabled.
erikj@41172 166 ifeq ($$($1_MULTIPLE_MAKEFILES), true)
erikj@41172 167 $$(foreach d, $$($1_$2_TOPDIRS), \
erikj@41172 168 $$(eval $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $$d)))
erikj@41172 169 endif
ihse@29662 170 ifeq ($(NO_RECIPES),)
erikj@47217 171 $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2))
ihse@29662 172 endif
chegar@27560 173 $1 += $2-$$($1_TARGET_SUFFIX)
chegar@27560 174 $1_MODULES += $2
chegar@27560 175 endif
chegar@27560 176 endef
chegar@27560 177
chegar@27560 178 # Declare recipes for a specific module and build phase if there are makefiles
chegar@27560 179 # present for the specific combination.
chegar@27560 180 # Param 1: Name of list to add targets to
chegar@27560 181 # Named params:
chegar@27560 182 # TARGET_SUFFIX : Suffix of target to create for recipe
chegar@27560 183 # MAKE_SUBDIR : Subdir for this build phase
chegar@27560 184 # FILE_PREFIX : File prefix for this build phase
chegar@27560 185 # USE_WRAPPER : Set to true to use ModuleWrapper.gmk
chegar@27560 186 # CHECK_MODULES : List of modules to try
twisti@33045 187 # MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and
chegar@27560 188 # phase in multiple repos
chegar@27560 189 # Exported variables:
chegar@27560 190 # $1_MODULES : All modules that had rules generated
chegar@27560 191 # $1_TARGETS : All targets generated
chegar@27560 192 define DeclareRecipesForPhase
erikj@47217 193 $(foreach i,2 3 4 5 6 7, $(if $(strip $($i)),$(strip $1)_$(strip $($i)))$(NEWLINE))
chegar@27560 194 $(if $(8),$(error Internal makefile error: Too many arguments to \
chegar@27560 195 DeclareRecipesForPhase, please update MakeHelper.gmk))
chegar@27560 196
chegar@27560 197 $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
chegar@27560 198 $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
chegar@27560 199
chegar@27560 200 $(strip $1)_TARGETS := $$($(strip $1))
erikj@26116 201 endef
erikj@26116 202
erikj@26116 203 ################################################################################
erikj@26116 204
ihse@29662 205 endif # _MAINSUPPORT_GMK