author | ctornqvi |
Wed, 22 Apr 2015 13:58:28 -0700 | |
changeset 30536 | 8eafd36e9a8d |
parent 29662 | 78c47f0002c3 |
child 29790 | 79641c886929 |
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 ..." |
20363 | 44 |
@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) |
45 |
@$(PRINTF) " done\n" |
|
13697 | 46 |
endef |
47 |
||
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
48 |
define CleanTest |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
49 |
@$(PRINTF) "Cleaning test $(strip $1) ..." |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
50 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
51 |
@$(PRINTF) " done\n" |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
52 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
53 |
|
27560 | 54 |
define Clean-gensrc |
55 |
@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." |
|
56 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) |
|
57 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) |
|
58 |
@$(PRINTF) " done\n" |
|
59 |
endef |
|
60 |
||
61 |
define Clean-java |
|
62 |
@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." |
|
63 |
@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) |
|
64 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) |
|
65 |
@$(PRINTF) " done\n" |
|
66 |
@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." |
|
67 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) |
|
68 |
@$(PRINTF) " done\n" |
|
69 |
endef |
|
70 |
||
71 |
define Clean-native |
|
72 |
@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." |
|
73 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) |
|
74 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) |
|
75 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) |
|
76 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) |
|
77 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) |
|
78 |
@$(PRINTF) " done\n" |
|
79 |
endef |
|
80 |
||
81 |
define Clean-include |
|
82 |
@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." |
|
83 |
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) |
|
84 |
@$(PRINTF) " done\n" |
|
85 |
endef |
|
86 |
||
87 |
define CleanModule |
|
88 |
$(call Clean-gensrc, $1) |
|
89 |
$(call Clean-java, $1) |
|
90 |
$(call Clean-native, $1) |
|
91 |
$(call Clean-include, $1) |
|
92 |
endef |
|
93 |
||
94 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
95 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
96 |
|
27560 | 97 |
MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) |
98 |
MAKE_MAKEDIR_LIST := make |
|
99 |
||
100 |
# Helper macro for DeclareRecipesForPhase |
|
101 |
# Declare a recipe for calling the module and phase specific makefile. |
|
102 |
# If there are multiple makefiles to call, create a rule for each topdir |
|
28356 | 103 |
# that contains a makefile with the target $module-$suffix-$repodir, |
27560 | 104 |
# (i.e: java.base-gensrc-jdk) |
105 |
# Normally there is only one makefile, and the target will just be |
|
106 |
# $module-$suffix |
|
107 |
# Param 1: Name of list to add targets to |
|
108 |
# Param 2: Module name |
|
109 |
# Param 3: Topdir |
|
110 |
define DeclareRecipeForModuleMakefile |
|
111 |
ifeq ($$($1_MULTIPLE_MAKEFILES), true) |
|
112 |
$2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) |
|
113 |
$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
|
114 |
|
27560 | 115 |
$2-$$($1_TARGET_SUFFIX)-$$(notdir $3): |
116 |
else |
|
117 |
$2-$$($1_TARGET_SUFFIX): |
|
118 |
endif |
|
119 |
$(ECHO) $(LOG_INFO) "Building $$@" |
|
120 |
ifeq ($$($1_USE_WRAPPER), true) |
|
121 |
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ |
|
122 |
-f ModuleWrapper.gmk \ |
|
123 |
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ |
|
124 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
|
125 |
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX)) |
|
126 |
else |
|
127 |
+($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \ |
|
128 |
$3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \ |
|
129 |
&& $(MAKE) $(MAKE_ARGS) \ |
|
130 |
-f $$($1_FILE_PREFIX)-$2.gmk \ |
|
131 |
$$(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
|
132 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ |
27560 | 133 |
MODULE=$2) |
134 |
endif |
|
135 |
||
136 |
endef |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
137 |
|
27560 | 138 |
# Helper macro for DeclareRecipesForPhase |
139 |
# Param 1: Name of list to add targets to |
|
140 |
# Param 2: Module name |
|
141 |
define DeclareRecipesForPhaseAndModule |
|
142 |
$1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \ |
|
143 |
$$(patsubst $$d/%, $$d, $$(filter $$d/%, \ |
|
144 |
$$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \ |
|
145 |
$$(foreach s, $(MAKE_MAKEDIR_LIST), \ |
|
146 |
$$(addsuffix /$$s, $(MAKE_TOPDIR_LIST)))))))))) |
|
147 |
||
148 |
# Only declare recipes if there are makefiles to call |
|
149 |
ifneq ($$($1_$2_TOPDIRS), ) |
|
29662 | 150 |
ifeq ($(NO_RECIPES),) |
151 |
$$(foreach d, $$($1_$2_TOPDIRS), \ |
|
152 |
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d))) |
|
153 |
endif |
|
27560 | 154 |
$1 += $2-$$($1_TARGET_SUFFIX) |
155 |
$1_MODULES += $2 |
|
156 |
endif |
|
157 |
endef |
|
158 |
||
159 |
# Declare recipes for a specific module and build phase if there are makefiles |
|
160 |
# present for the specific combination. |
|
161 |
# Param 1: Name of list to add targets to |
|
162 |
# Named params: |
|
163 |
# TARGET_SUFFIX : Suffix of target to create for recipe |
|
164 |
# MAKE_SUBDIR : Subdir for this build phase |
|
165 |
# FILE_PREFIX : File prefix for this build phase |
|
166 |
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk |
|
167 |
# CHECK_MODULES : List of modules to try |
|
168 |
# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in |
|
169 |
# phase in multiple repos |
|
170 |
# Exported variables: |
|
171 |
# $1_MODULES : All modules that had rules generated |
|
172 |
# $1_TARGETS : All targets generated |
|
173 |
define DeclareRecipesForPhase |
|
174 |
$(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE)) |
|
175 |
$(if $(8),$(error Internal makefile error: Too many arguments to \ |
|
176 |
DeclareRecipesForPhase, please update MakeHelper.gmk)) |
|
177 |
||
178 |
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \ |
|
179 |
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) |
|
180 |
||
181 |
$(strip $1)_TARGETS := $$($(strip $1)) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
182 |
endef |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
183 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
184 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
185 |
|
29662 | 186 |
endif # _MAINSUPPORT_GMK |