make/CreateJmods.gmk
author serb
Thu, 05 Apr 2018 19:08:48 -0700
changeset 49690 b9df14155468
parent 48069 a358ebcfacfb
child 49537 149dc554808c
permissions -rw-r--r--
8200149: The "com.sun.awt.AWTUtilities" class can be dropped Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48069
a358ebcfacfb 8192771: Boot JDK jar tool used to construct the modular JAR for java.jnlp
erikj
parents: 47735
diff changeset
     1
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     3
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     4
# This code is free software; you can redistribute it and/or modify it
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     5
# under the terms of the GNU General Public License version 2 only, as
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     6
# published by the Free Software Foundation.  Oracle designates this
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     7
# particular file as subject to the "Classpath" exception as provided
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     8
# by Oracle in the LICENSE file that accompanied this code.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
     9
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    14
# accompanied this code).
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    15
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    19
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    22
# questions.
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    23
#
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    24
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    25
default: all
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    26
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    27
include $(SPEC)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    28
include MakeBase.gmk
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    29
include Modules.gmk
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    30
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    31
ifeq ($(MODULE), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    32
  $(error MODULE must be set when calling CreateJmods.gmk)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    33
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    34
48069
a358ebcfacfb 8192771: Boot JDK jar tool used to construct the modular JAR for java.jnlp
erikj
parents: 47735
diff changeset
    35
$(eval $(call IncludeCustomExtension, CreateJmods.gmk))
a358ebcfacfb 8192771: Boot JDK jar tool used to construct the modular JAR for java.jnlp
erikj
parents: 47735
diff changeset
    36
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    37
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    38
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
    39
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
    40
JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
    41
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    42
LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40782
diff changeset
    43
    $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    44
CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40782
diff changeset
    45
    $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    46
CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    47
    $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    48
CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    49
INCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    50
    $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    51
MAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    52
    $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    53
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    54
$(eval $(call FillCacheFind, \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    55
    $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    56
))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    57
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    58
ifneq ($(LIBS_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    59
  JMOD_FLAGS += --libs $(LIBS_DIR)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    60
  DEPS += $(call CacheFind, $(LIBS_DIR))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    61
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    62
ifneq ($(CMDS_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    63
  JMOD_FLAGS += --cmds $(CMDS_DIR)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    64
  DEPS += $(call CacheFind, $(CMDS_DIR))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    65
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    66
ifneq ($(CONF_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    67
  JMOD_FLAGS += --config $(CONF_DIR)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    68
  DEPS += $(call CacheFind, $(CONF_DIR))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    69
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    70
ifneq ($(CLASSES_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    71
  JMOD_FLAGS += --class-path $(CLASSES_DIR)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    72
  DEPS += $(call CacheFind, $(CLASSES_DIR))
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    73
endif
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    74
ifneq ($(INCLUDE_HEADERS_DIR), )
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    75
  JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    76
  DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR))
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    77
endif
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    78
ifneq ($(MAN_DIR), )
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    79
  JMOD_FLAGS += --man-pages $(MAN_DIR)
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    80
  DEPS += $(call CacheFind, $(MAN_DIR))
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    81
endif
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    82
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    83
LEGAL_NOTICES := \
47735
45af799ceb6a 8190725: Freetype license file provided with configure not included in images
erikj
parents: 47253
diff changeset
    84
    $(call uniq, $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
45af799ceb6a 8190725: Freetype license file provided with configure not included in images
erikj
parents: 47253
diff changeset
    85
    $(call FindModuleLegalDirs, $(MODULE))) \
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    86
    #
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    87
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    88
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    89
DEPS += $(call CacheFind, $(LEGAL_NOTICES))
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    90
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    91
JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    92
42517
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
    93
ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
    94
  JMOD_FLAGS += --do-not-resolve-by-default
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
    95
  JMOD_FLAGS += --warn-if-resolved=incubating
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
    96
endif
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
    97
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
    98
# Add dependencies on other jmod files. Only java.base needs access to other
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
    99
# jmods.
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   100
ifeq ($(MODULE), java.base)
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   101
  # When creating a BUILDJDK, we don't need to add hashes to java.base
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   102
  ifneq ($(CREATING_BUILDJDK), true)
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   103
    # When creating interim versions of jmods, skip hashes
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   104
    ifneq ($(INTERIM_JMOD), true)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   105
      ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   106
      DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   107
          $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   108
45612
3368f6d8b082 8182032: Make java.compiler upgradeable
mchung
parents: 45510
diff changeset
   109
      EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   110
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   111
      JMOD_FLAGS += --module-path $(JMODS_DIR) \
45612
3368f6d8b082 8182032: Make java.compiler upgradeable
mchung
parents: 45510
diff changeset
   112
          --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   113
    endif
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   114
  endif
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   115
endif
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   116
39929
f6828731baa8 8160334: Building --with-parfait= fails with No rule to make target 'PARFAIT_NATIVEJMOD
erikj
parents: 38848
diff changeset
   117
# Changes to the jmod tool itself should also trigger a rebuild of all jmods.
f6828731baa8 8160334: Building --with-parfait= fails with No rule to make target 'PARFAIT_NATIVEJMOD
erikj
parents: 38848
diff changeset
   118
# The variable JMOD_CMD could contain an environment variable assignment before
f6828731baa8 8160334: Building --with-parfait= fails with No rule to make target 'PARFAIT_NATIVEJMOD
erikj
parents: 38848
diff changeset
   119
# the actual command. Filter that out using wildcard before adding to DEPS.
f6828731baa8 8160334: Building --with-parfait= fails with No rule to make target 'PARFAIT_NATIVEJMOD
erikj
parents: 38848
diff changeset
   120
DEPS += $(wildcard $(JMOD_CMD))
38848
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   121
ifeq ($(EXTERNAL_BUILDJDK), false)
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   122
  DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   123
endif
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   124
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   125
# If creating interim versions of jmods, certain files need to be filtered out
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   126
# to avoid false incremental rebuilds.
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   127
ifeq ($(INTERIM_JMOD), true)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   128
  DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   129
endif
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   130
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   131
# Create jmods in a temp dir and then move them into place to keep the
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   132
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   133
$(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 45612
diff changeset
   134
	$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   135
	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   136
	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   137
	$(JMOD) create \
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   138
            --module-version $(VERSION_SHORT) \
44985
54f298f9766a 8178380: Module system implementation refresh (5/2017)
alanb
parents: 44729
diff changeset
   139
            --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
40241
59abac94e4f2 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39929
diff changeset
   140
            --module-path $(JMODS_DIR) \
44073
74a8eb45afb6 8176172: Imported FX modules have have residual_imported.marker file
erikj
parents: 42518
diff changeset
   141
	    --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   142
	    $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   143
	$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   144
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   145
TARGETS += $(JMODS_DIR)/$(MODULE).jmod
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   146
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   147
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   148
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   149
all: $(TARGETS)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   150
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   151
################################################################################