make/common/Modules.gmk
author akulyakh
Thu, 24 Mar 2016 15:22:18 +0300
changeset 37327 38d654673889
parent 36506 17612cee3530
child 36543 a8ce27ddc757
permissions -rw-r--r--
8147987: Remove sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java from problemList Summary: Re-enabling a previously excluded test Reviewed-by: sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    29
# Hook to include the corresponding custom file, if present.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    30
$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    41
# Use append so that the custom extension may add to this variable
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    42
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    53
# Find all module-info.java files for the current build target platform and
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    54
# configuration.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    55
# Param 1 - Module to find for, set to * for finding all
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    56
FindAllModuleInfos = \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    57
    $(wildcard \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    58
        $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    59
        $(patsubst %,%/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    60
        $(patsubst %,%/$(strip $1)/share/classes/module-info.java, $(ALL_TOP_SRC_DIRS)) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    63
# Extract the module names from the paths of module-info.java files. The
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    64
# position of the module directory differs depending on if this is an imported
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    65
# src dir or not.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    66
GetModuleNameFromModuleInfo = \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    67
    $(strip $(foreach mi, $1, \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    68
      $(if $(filter $(addsuffix %, $(IMPORT_MODULES_SRC)), $(mi)), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    69
        $(notdir $(patsubst %/,%, $(dir $(mi)))), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    70
        $(notdir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(mi)))))))))))
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    71
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    72
# Find all modules by looking for module-info.java files and looking at parent
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    73
# directories.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    74
FindAllModules = \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    75
    $(sort $(filter-out $(MODULES_FILTER), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    76
    $(call GetModuleNameFromModuleInfo, $(MODULE_INFOS))))
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    77
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    78
FindImportedModules = \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    79
    $(if $(IMPORT_MODULES_CLASSES), $(notdir $(wildcard $(IMPORT_MODULES_CLASSES)/*)))
26548
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    80
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    81
################################################################################
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    82
# Extract module dependencies from module-info.java files.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    83
26548
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    84
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    85
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    86
MODULE_INFOS := $(call FindAllModuleInfos, *)
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    87
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    88
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    89
    $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    90
	$(MKDIR) -p $(@D)
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    91
	$(RM) $@
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    92
	$(foreach m, $(MODULE_INFOS), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    93
	    ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    94
	      $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    95
	          BEGIN      { if (MODULE != "java.base") printf(" java.base"); } \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    96
	          /requires/ { sub(/;/, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    97
	                       sub(/requires/, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    98
	                       sub(/public/, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
    99
	                       sub(/\/\/.*/, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   100
	                       sub(/\/\*.*\*\//, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   101
	                       gsub(/ /, ""); \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   102
	                       printf(" %s", $$0) } \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   103
	          END        { printf("\n") }' $m \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   104
	    ) >> $@ $(NEWLINE))
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   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
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   111
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   112
# Finds transitive dependencies in 3 levels.
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   113
# Param 1: Module to find transitive deps for
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   114
FindTransitiveDepsForModule = \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   115
    $(sort $(call FindDepsForModule, $1) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   116
        $(foreach m, $(call FindDepsForModule, $1), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   117
            $(call FindDepsForModule, $m) \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   118
            $(foreach n, $(call FindDepsForModule, $m), \
17612cee3530 8142968: Module System implementation
alanb
parents: 35030
diff changeset
   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