make/common/Modules.gmk
author katleman
Thu, 09 Oct 2014 11:24:13 -0700
changeset 26987 766607612d81
parent 26671 b214ab286ce9
child 27137 495cc902789c
permissions -rw-r--r--
Added tag jdk9-b34 for changeset ce4fdd38d96b
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
26548
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    29
include JavaCompilation.gmk
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    30
include SetupJavaCompilers.gmk
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    31
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    32
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    33
# Module list macros
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    34
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    35
ALL_TOP_SRC_DIRS := \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    36
    $(JDK_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    37
    $(LANGTOOLS_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    38
    $(CORBA_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    39
    $(JAXP_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    40
    $(JAXWS_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    41
    $(NASHORN_TOPDIR)/src \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    42
    #
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    43
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    44
# There are snmp classes in the open but they are not included in OpenJDK
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    45
JAVA_MODULES_FILTER := jdk.snmp
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    46
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    47
# Find all modules with java sources by looking in the source dirs
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    48
define FindJavaModules
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    49
  $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    50
      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    51
      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    52
          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    53
          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    54
endef
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    55
26548
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    56
# Find all modules with source for the target platform.
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    57
define FindAllModules
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    58
  $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    59
      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    60
      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    61
      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    62
endef
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    63
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    64
################################################################################
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    65
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    66
$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    67
    SETUP := BOOT_JAVAC, \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    68
    SRC := $(JDK_TOPDIR)/make/src/classes, \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    69
    INCLUDES := build/tools/module, \
26671
b214ab286ce9 8058797: Building with sjavac broken after JDK-8058118
erikj
parents: 26548
diff changeset
    70
    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
b214ab286ce9 8058797: Building with sjavac broken after JDK-8058118
erikj
parents: 26548
diff changeset
    71
    DISABLE_SJAVAC := true))
26548
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    72
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    73
TOOL_GENMODULESLIST = $(JAVA_SMALL) \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    74
    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    75
    build.tools.module.GenModulesList
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    76
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    77
MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    78
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    79
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    80
$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    81
    $(BUILD_GENMODULESLIST)
3b002da2aee1 8058118: Generate modules.list during the build
erikj
parents: 26116
diff changeset
    82
	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
26116
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    83
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    84
$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    85
	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    86
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    87
-include $(MODULE_DEPS_MAKEFILE)
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    88
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    89
# Param 1: Module to find deps for
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    90
define FindDepsForModule
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    91
  $(DEPS_$(strip $1))
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    92
endef
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    93
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    94
################################################################################
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    95
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    96
# Hook to include the corresponding custom file, if present.
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    97
$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    98
f051bd253364 8055095: Improve "do nothing" incremental build performance after modularized source code integration
erikj
parents:
diff changeset
    99
endif # _MODULES_GMK