author | duke |
Wed, 05 Jul 2017 22:19:49 +0200 | |
changeset 41456 | d9ffbd5b4c4e |
parent 41260 | 4f71f07b30d1 |
child 41652 | a0664e2b49a1 |
permissions | -rw-r--r-- |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
1 |
# |
41260 | 2 |
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
4 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
10 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
16 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
20 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
23 |
# questions. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
24 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
25 |
|
29662 | 26 |
################################################################################ |
27 |
# This file contains helper functions for Main.gmk. |
|
28 |
################################################################################ |
|
14111 | 29 |
|
29662 | 30 |
ifndef _MAINSUPPORT_GMK |
31 |
_MAINSUPPORT_GMK := 1 |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
32 |
|
37974 | 33 |
# Run the tests specified by $1, with PRODUCT_HOME specified by $2 |
41047
de6f69208f82
8164301: jib should provide a JDK for running jtreg with
erikj
parents:
37974
diff
changeset
|
34 |
# JT_JAVA is picked up by the jtreg launcher and used to run Jtreg itself. |
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
35 |
define RunTests |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
36 |
($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ |
37974 | 37 |
JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \ |
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
38 |
TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ |
34594
7e0595aab028
8139272: Add configure variable to set concurrency for jtreg tests
ehelin
parents:
33437
diff
changeset
|
39 |
ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \ |
41047
de6f69208f82
8164301: jib should provide a JDK for running jtreg with
erikj
parents:
37974
diff
changeset
|
40 |
JT_JAVA=$(BOOT_JDK) \ |
34594
7e0595aab028
8139272: Add configure variable to set concurrency for jtreg tests
ehelin
parents:
33437
diff
changeset
|
41 |
JOBS=$(JOBS) $1) || true |
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
42 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
43 |
|
27560 | 44 |
# Cleans the dir given as $1 |
45 |
define CleanDir |
|
25854 | 46 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
29790 | 47 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
48 |
($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) |
|
20363 | 49 |
@$(PRINTF) " done\n" |
13697 | 50 |
endef |
51 |
||
33437 | 52 |
define CleanSupportDir |
53 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
|
54 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
|
55 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1) |
|
56 |
@$(PRINTF) " done\n" |
|
57 |
endef |
|
58 |
||
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
59 |
define CleanTest |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
60 |
@$(PRINTF) "Cleaning test $(strip $1) ..." |
29790 | 61 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
62 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) |
|
33052 | 63 |
# Remove as much of the test directory structure as is empty |
64 |
$(RMDIR) -p $(dir $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))) 2> /dev/null || true |
|
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
65 |
@$(PRINTF) " done\n" |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
66 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
67 |
|
27560 | 68 |
define Clean-gensrc |
69 |
@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." |
|
29790 | 70 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
71 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) |
|
27560 | 72 |
@$(PRINTF) " done\n" |
73 |
endef |
|
74 |
||
75 |
define Clean-java |
|
76 |
@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." |
|
29790 | 77 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
78 |
$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) |
|
31310 | 79 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1) |
29790 | 80 |
$(PRINTF) " done\n" |
81 |
$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." |
|
82 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) |
|
27560 | 83 |
@$(PRINTF) " done\n" |
84 |
endef |
|
85 |
||
86 |
define Clean-native |
|
87 |
@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." |
|
29790 | 88 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
89 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) |
|
90 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) |
|
91 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) |
|
27560 | 92 |
@$(PRINTF) " done\n" |
93 |
endef |
|
94 |
||
95 |
define Clean-include |
|
96 |
@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." |
|
29790 | 97 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
98 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) |
|
99 |
@$(PRINTF) " done\n" |
|
100 |
endef |
|
101 |
||
102 |
define Clean-docs |
|
103 |
@$(PRINTF) "Cleaning docs ..." |
|
104 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
|
105 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/docs |
|
106 |
$(RM) -r $(IMAGES_OUTPUTDIR)/docs |
|
37034
b63fd4af003e
8154313: Generated javadoc scattered all over the place
neugens
parents:
36506
diff
changeset
|
107 |
$(RM) $(OUTPUT_ROOT)/bundles/jdk-*-docs.zip |
27560 | 108 |
@$(PRINTF) " done\n" |
109 |
endef |
|
110 |
||
111 |
define CleanModule |
|
112 |
$(call Clean-gensrc, $1) |
|
113 |
$(call Clean-java, $1) |
|
114 |
$(call Clean-native, $1) |
|
115 |
$(call Clean-include, $1) |
|
116 |
endef |
|
117 |
||
118 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
119 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
120 |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
121 |
MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) \ |
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
122 |
$(HOTSPOT_TOPDIR) |
27560 | 123 |
MAKE_MAKEDIR_LIST := make |
124 |
||
125 |
# Helper macro for DeclareRecipesForPhase |
|
126 |
# Declare a recipe for calling the module and phase specific makefile. |
|
127 |
# If there are multiple makefiles to call, create a rule for each topdir |
|
28356 | 128 |
# that contains a makefile with the target $module-$suffix-$repodir, |
27560 | 129 |
# (i.e: java.base-gensrc-jdk) |
130 |
# Normally there is only one makefile, and the target will just be |
|
131 |
# $module-$suffix |
|
132 |
# Param 1: Name of list to add targets to |
|
133 |
# Param 2: Module name |
|
134 |
# Param 3: Topdir |
|
135 |
define DeclareRecipeForModuleMakefile |
|
136 |
ifeq ($$($1_MULTIPLE_MAKEFILES), true) |
|
137 |
$2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
138 |
|
27560 | 139 |
$2-$$($1_TARGET_SUFFIX)-$$(notdir $3): |
140 |
else |
|
141 |
$2-$$($1_TARGET_SUFFIX): |
|
142 |
endif |
|
143 |
ifeq ($$($1_USE_WRAPPER), true) |
|
144 |
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ |
|
145 |
-f ModuleWrapper.gmk \ |
|
146 |
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ |
|
147 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
|
148 |
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX)) |
|
149 |
else |
|
150 |
+($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \ |
|
151 |
$3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \ |
|
152 |
&& $(MAKE) $(MAKE_ARGS) \ |
|
153 |
-f $$($1_FILE_PREFIX)-$2.gmk \ |
|
154 |
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ |
|
29060
baa66d2b7e95
8073498: Enhance GensrcProperties.gmk to allow an alternative source root
erikj
parents:
28356
diff
changeset
|
155 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
27560 | 156 |
MODULE=$2) |
157 |
endif |
|
158 |
||
159 |
endef |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
160 |
|
27560 | 161 |
# Helper macro for DeclareRecipesForPhase |
162 |
# Param 1: Name of list to add targets to |
|
163 |
# Param 2: Module name |
|
164 |
define DeclareRecipesForPhaseAndModule |
|
165 |
$1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \ |
|
166 |
$$(patsubst $$d/%, $$d, $$(filter $$d/%, \ |
|
167 |
$$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \ |
|
168 |
$$(foreach s, $(MAKE_MAKEDIR_LIST), \ |
|
169 |
$$(addsuffix /$$s, $(MAKE_TOPDIR_LIST)))))))))) |
|
170 |
||
171 |
# Only declare recipes if there are makefiles to call |
|
172 |
ifneq ($$($1_$2_TOPDIRS), ) |
|
41172
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
173 |
# Add the top dir specific target to target list regardless of if recipe |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
174 |
# generation is disabled. |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
175 |
ifeq ($$($1_MULTIPLE_MAKEFILES), true) |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
176 |
$$(foreach d, $$($1_$2_TOPDIRS), \ |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
177 |
$$(eval $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $$d))) |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
178 |
endif |
29662 | 179 |
ifeq ($(NO_RECIPES),) |
180 |
$$(foreach d, $$($1_$2_TOPDIRS), \ |
|
181 |
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d))) |
|
182 |
endif |
|
27560 | 183 |
$1 += $2-$$($1_TARGET_SUFFIX) |
184 |
$1_MODULES += $2 |
|
185 |
endif |
|
186 |
endef |
|
187 |
||
188 |
# Declare recipes for a specific module and build phase if there are makefiles |
|
189 |
# present for the specific combination. |
|
190 |
# Param 1: Name of list to add targets to |
|
191 |
# Named params: |
|
192 |
# TARGET_SUFFIX : Suffix of target to create for recipe |
|
193 |
# MAKE_SUBDIR : Subdir for this build phase |
|
194 |
# FILE_PREFIX : File prefix for this build phase |
|
195 |
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk |
|
196 |
# CHECK_MODULES : List of modules to try |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
197 |
# MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and |
27560 | 198 |
# phase in multiple repos |
199 |
# Exported variables: |
|
200 |
# $1_MODULES : All modules that had rules generated |
|
201 |
# $1_TARGETS : All targets generated |
|
202 |
define DeclareRecipesForPhase |
|
203 |
$(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE)) |
|
204 |
$(if $(8),$(error Internal makefile error: Too many arguments to \ |
|
205 |
DeclareRecipesForPhase, please update MakeHelper.gmk)) |
|
206 |
||
207 |
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \ |
|
208 |
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) |
|
209 |
||
210 |
$(strip $1)_TARGETS := $$($(strip $1)) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
211 |
endef |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
212 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
213 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
214 |
|
29662 | 215 |
endif # _MAINSUPPORT_GMK |