make/GensrcModuleInfo.gmk
author prappo
Wed, 01 May 2019 15:10:09 +0100
branchJDK-8210696-branch
changeset 57346 3efc6cb7ffdb
parent 52804 28094715ae71
permissions -rw-r--r--
Removed the daemon-threads-based ExecutorService
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     1
#
52804
28094715ae71 8214718: Update missing copyright year in build system
ihse
parents: 52065
diff changeset
     2
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     4
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    10
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    15
# accompanied this code).
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    16
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    20
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    23
# questions.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    24
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    25
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    26
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    27
# This file makes modifications to module-info.java files based on the build
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    28
# configuration.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    29
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    30
# Depending on build platform, imported modules and optional parts of the build
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    31
# being active, some modules need to have extra exports, provides or uses
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    32
# declarations added to them. These optional extras are defined in .extra files:
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    33
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    34
# src/<module>/<share,platform>/classes/module-info.java.extra
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    35
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    36
# The contents of the .extra files are simply extra lines that could fit into
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    37
# the module-info file.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    38
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    39
# This makefile is called once for each from-module with the variable
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    40
# MODULE naming the from-module.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    41
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    42
# The modified module-info.java files are put in the gensrc directory where
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    43
# they will automatically override the static versions in the src tree.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    44
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    45
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    46
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    47
default: all
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    48
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    49
include $(SPEC)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    50
include MakeBase.gmk
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    51
include Modules.gmk
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    52
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    53
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    54
# Define this here since jdk/make/Tools.gmk cannot be included from the top
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    55
# make directory. Should probably move some tools away from the jdk repo.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    56
TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    57
    $(INTERIM_LANGTOOLS_ARGS) \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    58
    -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes" \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    59
    build.tools.module.GenModuleInfoSource
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    60
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    61
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    62
42289
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    63
# Name of modification file.
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    64
MOD_FILENAME := module-info.java.extra
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    65
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    66
# Construct all possible src directories for the module.
37030
e047c2f3f510 8153969: Clean up module src dir logic
erikj
parents: 36506
diff changeset
    67
MODULE_CLASSES_DIRS := $(call FindModuleSrcDirs, $(MODULE))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    68
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    69
# Find all the .extra files in the src dirs.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    70
MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    71
    $(MODULE_CLASSES_DIRS))))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    72
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    73
ifneq ($(MOD_FILES), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    74
  # Only make this call if modification files are found for this module
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    75
  ALL_MODULES := $(call FindAllModules)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    76
42289
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    77
  $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    78
      $(firstword $(call FindAllModuleInfos, $(MODULE))) \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    79
      $(BUILD_TOOLS_JDK) \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    80
      $(MOD_FILES) \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    81
      $(call DependOnVariable, ALL_MODULES)
52065
dea8a62cdfc3 8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents: 42289
diff changeset
    82
		$(call MakeTargetDir)
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    83
		$(RM) $@ $@.tmp
42289
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    84
		$(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    85
		    --source-file $< \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    86
		    --modules $(call CommaList, $(ALL_MODULES)) \
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    87
		    $(MOD_FILES)
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    88
		$(MV) $@.tmp $@
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    89
42289
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    90
  TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    91
42289
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    92
else
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    93
  # If no modifications are found for this module, remove any module-info.java
08548fd6e608 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41458
diff changeset
    94
  # created by a previous build since that is no longer valid.
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    95
  ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    96
    $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    97
  endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    98
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    99
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   100
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   101
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   102
all: $(TARGETS)