author | coffeys |
Wed, 13 Nov 2019 11:27:50 +0000 | |
changeset 59055 | 57ad70bcf06c |
parent 58908 | 73bb9c4002cc |
permissions | -rw-r--r-- |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
1 |
# |
58908
73bb9c4002cc
8233381: Update copyright year in build system files
ihse
parents:
58846
diff
changeset
|
2 |
# Copyright (c) 2011, 2019, 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 |
|
41652
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
33 |
define CleanDocs |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
34 |
@$(PRINTF) "Cleaning docs ..." |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
35 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
36 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/docs |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
37 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/javadoc |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
38 |
$(RM) -r $(IMAGES_OUTPUTDIR)/docs |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
39 |
@$(PRINTF) " done\n" |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
40 |
endef |
a0664e2b49a1
8168772: Convert javadoc generation to build-infra standards
ihse
parents:
41260
diff
changeset
|
41 |
|
27560 | 42 |
# Cleans the dir given as $1 |
43 |
define CleanDir |
|
25854 | 44 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
29790 | 45 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
47217
diff
changeset
|
46 |
($(CD) $(OUTPUTDIR) && $(RM) -r $1) |
20363 | 47 |
@$(PRINTF) " done\n" |
13697 | 48 |
endef |
49 |
||
33437 | 50 |
define CleanSupportDir |
51 |
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..." |
|
52 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
|
53 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/$(strip $1) |
|
54 |
@$(PRINTF) " done\n" |
|
55 |
endef |
|
56 |
||
53736
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
57 |
define CleanMakeSupportDir |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
58 |
@$(PRINTF) "Cleaning $(strip $1) make support artifacts ..." |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
59 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
60 |
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/$(strip $1) |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
61 |
@$(PRINTF) " done\n" |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
62 |
endef |
81767abf7e6a
8218807: Compilation database (compile_commands.json) may contain obsolete items
rwestberg
parents:
52342
diff
changeset
|
63 |
|
29156
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
64 |
define CleanTest |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
65 |
@$(PRINTF) "Cleaning test $(strip $1) ..." |
29790 | 66 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
67 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) |
|
33052 | 68 |
# Remove as much of the test directory structure as is empty |
69 |
$(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
|
70 |
@$(PRINTF) " done\n" |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
71 |
endef |
bd932374081c
8072842: Add support for building native JTReg tests
ihse
parents:
29060
diff
changeset
|
72 |
|
27560 | 73 |
define Clean-gensrc |
74 |
@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." |
|
29790 | 75 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
76 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) |
|
27560 | 77 |
@$(PRINTF) " done\n" |
78 |
endef |
|
79 |
||
80 |
define Clean-java |
|
81 |
@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." |
|
29790 | 82 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
83 |
$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) |
|
31310 | 84 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/special_classes/$(strip $1) |
29790 | 85 |
$(PRINTF) " done\n" |
86 |
$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." |
|
87 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) |
|
27560 | 88 |
@$(PRINTF) " done\n" |
89 |
endef |
|
90 |
||
91 |
define Clean-native |
|
92 |
@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." |
|
29790 | 93 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
94 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) |
|
95 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) |
|
96 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) |
|
27560 | 97 |
@$(PRINTF) " done\n" |
98 |
endef |
|
99 |
||
100 |
define Clean-include |
|
101 |
@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." |
|
29790 | 102 |
@$(PRINTF) "\n" $(LOG_DEBUG) |
103 |
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) |
|
104 |
@$(PRINTF) " done\n" |
|
105 |
endef |
|
106 |
||
27560 | 107 |
define CleanModule |
108 |
$(call Clean-gensrc, $1) |
|
109 |
$(call Clean-java, $1) |
|
110 |
$(call Clean-native, $1) |
|
111 |
$(call Clean-include, $1) |
|
112 |
endef |
|
113 |
||
114 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
115 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
116 |
|
47217 | 117 |
PHASE_MAKEDIRS := $(TOPDIR)/make |
27560 | 118 |
|
119 |
# Helper macro for DeclareRecipesForPhase |
|
120 |
# Declare a recipe for calling the module and phase specific makefile. |
|
121 |
# If there are multiple makefiles to call, create a rule for each topdir |
|
28356 | 122 |
# that contains a makefile with the target $module-$suffix-$repodir, |
47217 | 123 |
# (i.e: java.base-gensrc-src) |
27560 | 124 |
# Normally there is only one makefile, and the target will just be |
125 |
# $module-$suffix |
|
126 |
# Param 1: Name of list to add targets to |
|
127 |
# Param 2: Module name |
|
128 |
define DeclareRecipeForModuleMakefile |
|
47217 | 129 |
$2-$$($1_TARGET_SUFFIX): |
27560 | 130 |
ifeq ($$($1_USE_WRAPPER), true) |
47217 | 131 |
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \ |
27560 | 132 |
-f ModuleWrapper.gmk \ |
47217 | 133 |
$$(addprefix -I, $$(PHASE_MAKEDIRS) \ |
134 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \ |
|
135 |
) \ |
|
58846
f9ac726ab347
8232748: Build static versions of certain JDK libraries
erikj
parents:
53736
diff
changeset
|
136 |
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX) $$($1_EXTRA_ARGS)) |
27560 | 137 |
else |
47217 | 138 |
+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix \ |
139 |
/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS))))) \ |
|
140 |
&& $(MAKE) $(MAKE_ARGS) \ |
|
141 |
-f $$($1_FILE_PREFIX)-$2.gmk \ |
|
142 |
$$(addprefix -I, $$(PHASE_MAKEDIRS) \ |
|
143 |
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(PHASE_MAKEDIRS)) \ |
|
144 |
) \ |
|
58846
f9ac726ab347
8232748: Build static versions of certain JDK libraries
erikj
parents:
53736
diff
changeset
|
145 |
MODULE=$2 $$($1_EXTRA_ARGS) \ |
47217 | 146 |
) |
27560 | 147 |
endif |
148 |
||
149 |
endef |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
150 |
|
27560 | 151 |
# Helper macro for DeclareRecipesForPhase |
152 |
# Param 1: Name of list to add targets to |
|
153 |
# Param 2: Module name |
|
154 |
define DeclareRecipesForPhaseAndModule |
|
47217 | 155 |
$1_$2_MAKEFILES := $$(strip $$(wildcard \ |
156 |
$$(addsuffix /$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $$(PHASE_MAKEDIRS)))) |
|
27560 | 157 |
|
158 |
# Only declare recipes if there are makefiles to call |
|
47217 | 159 |
ifneq ($$($1_$2_MAKEFILES), ) |
41172
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
160 |
# 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
|
161 |
# generation is disabled. |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
162 |
ifeq ($$($1_MULTIPLE_MAKEFILES), true) |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
163 |
$$(foreach d, $$($1_$2_TOPDIRS), \ |
1de8867db5a3
8166965: Some small java build tools are still running with big JVM configuration
erikj
parents:
41047
diff
changeset
|
164 |
$$(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
|
165 |
endif |
29662 | 166 |
ifeq ($(NO_RECIPES),) |
47217 | 167 |
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2)) |
29662 | 168 |
endif |
27560 | 169 |
$1 += $2-$$($1_TARGET_SUFFIX) |
170 |
$1_MODULES += $2 |
|
171 |
endif |
|
172 |
endef |
|
173 |
||
174 |
# Declare recipes for a specific module and build phase if there are makefiles |
|
175 |
# present for the specific combination. |
|
176 |
# Param 1: Name of list to add targets to |
|
177 |
# Named params: |
|
178 |
# TARGET_SUFFIX : Suffix of target to create for recipe |
|
179 |
# MAKE_SUBDIR : Subdir for this build phase |
|
180 |
# FILE_PREFIX : File prefix for this build phase |
|
181 |
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk |
|
182 |
# CHECK_MODULES : List of modules to try |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31310
diff
changeset
|
183 |
# MULTIPLE_MAKEFILES : Set to true to handle makefiles for the same module and |
27560 | 184 |
# phase in multiple repos |
58846
f9ac726ab347
8232748: Build static versions of certain JDK libraries
erikj
parents:
53736
diff
changeset
|
185 |
# EXTRA_ARGS : Add extra make args to each makefile call |
27560 | 186 |
# Exported variables: |
187 |
# $1_MODULES : All modules that had rules generated |
|
188 |
# $1_TARGETS : All targets generated |
|
189 |
define DeclareRecipesForPhase |
|
58846
f9ac726ab347
8232748: Build static versions of certain JDK libraries
erikj
parents:
53736
diff
changeset
|
190 |
$(foreach i,2 3 4 5 6 7 8, $(if $(strip $($i)),$(strip $1)_$(strip $($i)))$(NEWLINE)) |
f9ac726ab347
8232748: Build static versions of certain JDK libraries
erikj
parents:
53736
diff
changeset
|
191 |
$(if $(9),$(error Internal makefile error: Too many arguments to \ |
27560 | 192 |
DeclareRecipesForPhase, please update MakeHelper.gmk)) |
193 |
||
194 |
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \ |
|
195 |
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) |
|
196 |
||
197 |
$(strip $1)_TARGETS := $$($(strip $1)) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
198 |
endef |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
199 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
200 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
25854
diff
changeset
|
201 |
|
29662 | 202 |
endif # _MAINSUPPORT_GMK |