author | akulyakh |
Thu, 24 Mar 2016 15:22:18 +0300 | |
changeset 37327 | 38d654673889 |
parent 36506 | 17612cee3530 |
child 36543 | a8ce27ddc757 |
permissions | -rw-r--r-- |
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
1 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
2 |
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
4 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
10 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
16 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
20 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
23 |
# questions. |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
24 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
25 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
26 |
ifndef _MODULES_GMK |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
27 |
_MODULES_GMK := 1 |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
28 |
|
36506 | 29 |
# Hook to include the corresponding custom file, if present. |
30 |
$(eval $(call IncludeCustomExtension, , common/Modules.gmk)) |
|
31 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
32 |
################################################################################ |
34116
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
33 |
# Some platforms don't have the serviceability agent |
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
34 |
ifeq ($(INCLUDE_SA), false) |
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
35 |
MODULES_FILTER += jdk.hotspot.agent |
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
36 |
endif |
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
37 |
|
b746e382da18
8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
33045
diff
changeset
|
38 |
################################################################################ |
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
39 |
# Module list macros |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
40 |
|
36506 | 41 |
# Use append so that the custom extension may add to this variable |
42 |
||
43 |
ALL_TOP_SRC_DIRS += \ |
|
33045
00f484891bcf
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
30095
diff
changeset
|
44 |
$(HOTSPOT_TOPDIR)/src \ |
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
45 |
$(JDK_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
46 |
$(LANGTOOLS_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
47 |
$(CORBA_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
48 |
$(JAXP_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
49 |
$(JAXWS_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
50 |
$(NASHORN_TOPDIR)/src \ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
51 |
# |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
52 |
|
36506 | 53 |
# Find all module-info.java files for the current build target platform and |
54 |
# configuration. |
|
55 |
# Param 1 - Module to find for, set to * for finding all |
|
56 |
FindAllModuleInfos = \ |
|
57 |
$(wildcard \ |
|
58 |
$(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ |
|
59 |
$(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ |
|
60 |
$(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \ |
|
61 |
$(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
62 |
|
36506 | 63 |
# Extract the module names from the paths of module-info.java files. The |
64 |
# position of the module directory differs depending on if this is an imported |
|
65 |
# src dir or not. |
|
66 |
GetModuleNameFromModuleInfo = \ |
|
67 |
$(strip $(foreach mi, $1, \ |
|
68 |
$(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \ |
|
69 |
$(notdir $(patsubst %/,%, $(dir $(mi)))), \ |
|
70 |
$(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi))))))))))) |
|
71 |
||
72 |
# Find all modules by looking for module-info.java files and looking at parent |
|
73 |
# directories. |
|
74 |
FindAllModules = \ |
|
75 |
$(sort $(filter-out $(MODULES_FILTER), \ |
|
76 |
$(call GetModuleNameFromModuleInfo, $(MODULE_INFOS)))) |
|
77 |
||
78 |
FindImportedModules = \ |
|
79 |
$(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*))) |
|
26548 | 80 |
|
81 |
################################################################################ |
|
36506 | 82 |
# Extract module dependencies from module-info.java files. |
83 |
||
26548 | 84 |
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk |
36506 | 85 |
|
86 |
MODULE_INFOS := $(call FindAllModuleInfos, *) |
|
87 |
||
88 |
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ |
|
89 |
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) |
|
90 |
$(MKDIR) -p $(@D) |
|
91 |
$(RM) $@ |
|
92 |
$(foreach m, $(MODULE_INFOS), \ |
|
93 |
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ |
|
94 |
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ |
|
95 |
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ |
|
96 |
/requires/ { sub(/;/, ""); \ |
|
97 |
sub(/requires/, ""); \ |
|
98 |
sub(/public/, ""); \ |
|
99 |
sub(/\/\/.*/, ""); \ |
|
100 |
sub(/\/\*.*\*\//, ""); \ |
|
101 |
gsub(/ /, ""); \ |
|
102 |
printf(" %s", $$0) } \ |
|
103 |
END { printf("\n") }' $m \ |
|
104 |
) >> $@ $(NEWLINE)) |
|
105 |
||
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
106 |
-include $(MODULE_DEPS_MAKEFILE) |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
107 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
108 |
# Param 1: Module to find deps for |
36506 | 109 |
FindDepsForModule = \ |
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
110 |
$(DEPS_$(strip $1)) |
36506 | 111 |
|
112 |
# Finds transitive dependencies in 3 levels. |
|
113 |
# Param 1: Module to find transitive deps for |
|
114 |
FindTransitiveDepsForModule = \ |
|
115 |
$(sort $(call FindDepsForModule, $1) \ |
|
116 |
$(foreach m, $(call FindDepsForModule, $1), \ |
|
117 |
$(call FindDepsForModule, $m) \ |
|
118 |
$(foreach n, $(call FindDepsForModule, $m), \ |
|
119 |
$(call FindDepsForModule, $n)))) |
|
26116
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
120 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
121 |
################################################################################ |
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
122 |
|
f051bd253364
8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff
changeset
|
123 |
endif # _MODULES_GMK |