author | attila |
Mon, 09 Nov 2015 14:03:37 +0100 | |
changeset 33684 | 1bfe8ffd9baf |
parent 33437 | 1cf150337073 |
child 34594 | 7e0595aab028 |
permissions | -rw-r--r-- |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
1 |
# |
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
2 |
# Copyright (c) 2011, 2015, 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 |
|
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
33 |
# Run the tests specified by $1. |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
34 |
define RunTests |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
35 |
($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
36 |
JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
37 |
TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
38 |
ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
39 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
40 |
|
27560 | 41 |
# Cleans the dir given as $1 |
42 |
define CleanDir |
|
25854 | 43 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
29790 | 44 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
45 |
($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) |
|
20363 | 46 |
@$(PRINTF) " done\n" |
13697 | 47 |
endef |
48 |
||
33437 | 49 |
define CleanSupportDir |
50 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
|
51 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
|
52 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1) |
|
53 |
@$(PRINTF) " done\n" |
|
54 |
endef |
|
55 |
||
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
56 |
define CleanTest |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
57 |
@$(PRINTF) "Cleaning test $(strip $1) ..." |
29790 | 58 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
59 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) |
|
33052 | 60 |
# Remove as much of the test directory structure as is empty |
61 |
$(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
|
62 |
@$(PRINTF) " done\n" |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
63 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
64 |
|
27560 | 65 |
define Clean-gensrc |
66 |
@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." |
|
29790 | 67 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
68 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) |
|
69 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) |
|
27560 | 70 |
@$(PRINTF) " done\n" |
71 |
endef |
|
72 |
||
73 |
define Clean-java |
|
74 |
@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." |
|
29790 | 75 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
76 |
$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) |
|
31310 | 77 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1) |
29790 | 78 |
$(PRINTF) " done\n" |
79 |
$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." |
|
80 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) |
|
27560 | 81 |
@$(PRINTF) " done\n" |
82 |
endef |
|
83 |
||
84 |
define Clean-native |
|
85 |
@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." |
|
29790 | 86 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
87 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) |
|
88 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) |
|
89 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) |
|
90 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) |
|
91 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(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 |
|
27560 | 107 |
@$(PRINTF) " done\n" |
108 |
endef |
|
109 |
||
110 |
define CleanModule |
|
111 |
$(call Clean-gensrc, $1) |
|
112 |
$(call Clean-java, $1) |
|
113 |
$(call Clean-native, $1) |
|
114 |
$(call Clean-include, $1) |
|
115 |
endef |
|
116 |
||
117 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
118 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
119 |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
120 |
MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) \ |
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
121 |
$(HOTSPOT_TOPDIR) |
27560 | 122 |
MAKE_MAKEDIR_LIST := make |
123 |
||
124 |
# Helper macro for DeclareRecipesForPhase |
|
125 |
# Declare a recipe for calling the module and phase specific makefile. |
|
126 |
# If there are multiple makefiles to call, create a rule for each topdir |
|
28356 | 127 |
# that contains a makefile with the target $module-$suffix-$repodir, |
27560 | 128 |
# (i.e: java.base-gensrc-jdk) |
129 |
# Normally there is only one makefile, and the target will just be |
|
130 |
# $module-$suffix |
|
131 |
# Param 1: Name of list to add targets to |
|
132 |
# Param 2: Module name |
|
133 |
# Param 3: Topdir |
|
134 |
define DeclareRecipeForModuleMakefile |
|
135 |
ifeq ($$($1_MULTIPLE_MAKEFILES), true) |
|
136 |
$2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) |
|
137 |
$1 += $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 |
$(ECHO) $(LOG_INFO) "Building $$@" |
|
144 |
ifeq ($$($1_USE_WRAPPER), true) |
|
145 |
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ |
|
146 |
-f ModuleWrapper.gmk \ |
|
147 |
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ |
|
148 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
|
149 |
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX)) |
|
150 |
else |
|
151 |
+($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \ |
|
152 |
$3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \ |
|
153 |
&& $(MAKE) $(MAKE_ARGS) \ |
|
154 |
-f $$($1_FILE_PREFIX)-$2.gmk \ |
|
155 |
$$(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
|
156 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
27560 | 157 |
MODULE=$2) |
158 |
endif |
|
159 |
||
160 |
endef |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
161 |
|
27560 | 162 |
# Helper macro for DeclareRecipesForPhase |
163 |
# Param 1: Name of list to add targets to |
|
164 |
# Param 2: Module name |
|
165 |
define DeclareRecipesForPhaseAndModule |
|
166 |
$1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \ |
|
167 |
$$(patsubst $$d/%, $$d, $$(filter $$d/%, \ |
|
168 |
$$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \ |
|
169 |
$$(foreach s, $(MAKE_MAKEDIR_LIST), \ |
|
170 |
$$(addsuffix /$$s, $(MAKE_TOPDIR_LIST)))))))))) |
|
171 |
||
172 |
# Only declare recipes if there are makefiles to call |
|
173 |
ifneq ($$($1_$2_TOPDIRS), ) |
|
29662 | 174 |
ifeq ($(NO_RECIPES),) |
175 |
$$(foreach d, $$($1_$2_TOPDIRS), \ |
|
176 |
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d))) |
|
177 |
endif |
|
27560 | 178 |
$1 += $2-$$($1_TARGET_SUFFIX) |
179 |
$1_MODULES += $2 |
|
180 |
endif |
|
181 |
endef |
|
182 |
||
183 |
# Declare recipes for a specific module and build phase if there are makefiles |
|
184 |
# present for the specific combination. |
|
185 |
# Param 1: Name of list to add targets to |
|
186 |
# Named params: |
|
187 |
# TARGET_SUFFIX : Suffix of target to create for recipe |
|
188 |
# MAKE_SUBDIR : Subdir for this build phase |
|
189 |
# FILE_PREFIX : File prefix for this build phase |
|
190 |
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk |
|
191 |
# CHECK_MODULES : List of modules to try |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
192 |
# MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and |
27560 | 193 |
# phase in multiple repos |
194 |
# Exported variables: |
|
195 |
# $1_MODULES : All modules that had rules generated |
|
196 |
# $1_TARGETS : All targets generated |
|
197 |
define DeclareRecipesForPhase |
|
198 |
$(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE)) |
|
199 |
$(if $(8),$(error Internal makefile error: Too many arguments to \ |
|
200 |
DeclareRecipesForPhase, please update MakeHelper.gmk)) |
|
201 |
||
202 |
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \ |
|
203 |
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) |
|
204 |
||
205 |
$(strip $1)_TARGETS := $$($(strip $1)) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
206 |
endef |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
207 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
208 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
209 |
|
29662 | 210 |
endif # _MAINSUPPORT_GMK |