make/CreateJmods.gmk
author coffeys
Wed, 13 Nov 2019 11:27:50 +0000
changeset 59055 57ad70bcf06c
parent 58517 252e7f4c4d92
child 58834 f78e7ce060b0
permissions -rw-r--r--
8233731: repeated typo "fro" for "for" Reviewed-by: dfuchs Contributed-by: kiran.sidhartha.ravikumar@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
     1
# Copyright (c) 2014, 2019, 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
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
    29
include Execute.gmk
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    30
include Modules.gmk
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    31
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    32
ifeq ($(MODULE), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    33
  $(error MODULE must be set when calling CreateJmods.gmk)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    34
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    35
48069
a358ebcfacfb 8192771: Boot JDK jar tool used to construct the modular JAR for java.jnlp
erikj
parents: 47735
diff changeset
    36
$(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
    37
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    38
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    39
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
    40
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
    41
JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
    42
JMOD_FILE := $(MODULE).jmod
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
    43
50142
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    44
LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40782
diff changeset
    45
    $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
50142
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    46
CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
41260
4f71f07b30d1 8150736: Excessive disk space used by build system
erikj
parents: 40782
diff changeset
    47
    $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
50142
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    48
CONF_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    49
    $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
50142
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    50
CLASSES_DIR ?= $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    51
INCLUDE_HEADERS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    52
    $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
50142
f348e5d4769b 8202914: Let custom makefile override jmod intput dir locations
erikj
parents: 49566
diff changeset
    53
MAN_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    54
    $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    55
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    56
$(call FillFindCache, \
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    57
    $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    58
)
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    59
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    60
ifneq ($(LIBS_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    61
  JMOD_FLAGS += --libs $(LIBS_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    62
  DEPS += $(call FindFiles, $(LIBS_DIR))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    63
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    64
ifneq ($(CMDS_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    65
  JMOD_FLAGS += --cmds $(CMDS_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    66
  DEPS += $(call FindFiles, $(CMDS_DIR))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    67
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    68
ifneq ($(CONF_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    69
  JMOD_FLAGS += --config $(CONF_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    70
  DEPS += $(call FindFiles, $(CONF_DIR))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    71
endif
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    72
ifneq ($(CLASSES_DIR), )
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    73
  JMOD_FLAGS += --class-path $(CLASSES_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    74
  DEPS += $(call FindFiles, $(CLASSES_DIR))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    75
endif
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    76
ifneq ($(INCLUDE_HEADERS_DIR), )
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    77
  JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    78
  DEPS += $(call FindFiles, $(INCLUDE_HEADERS_DIR))
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    79
endif
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    80
ifneq ($(MAN_DIR), )
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    81
  JMOD_FLAGS += --man-pages $(MAN_DIR)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
    82
  DEPS += $(call FindFiles, $(MAN_DIR))
41532
76dffc133464 8167558: Add new JMOD section for header files and man pages
mchung
parents: 41260
diff changeset
    83
endif
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
    84
49537
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    85
# If a specific modules_legal dir exists for this module, only pick up files
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    86
# from there. These files were explicitly filtered or modified in <module>-copy
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    87
# targets. For the rest, just pick up everything from the source legal dirs.
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    88
LEGAL_NOTICES := \
58517
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
    89
    $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/common) \
49537
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    90
    $(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    91
      $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    92
      $(call FindModuleLegalSrcDirs, $(MODULE)) \
149dc554808c 8199539: Provide a standard way for the build to filter un-needed legal .md files
erikj
parents: 48069
diff changeset
    93
    )
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    94
58517
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
    95
ifneq ($(strip $(LEGAL_NOTICES)), )
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
    96
  LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
    97
  DEPS += $(call FindFiles, $(LEGAL_NOTICES))
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
    98
58517
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
    99
  JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
252e7f4c4d92 8231974: Build fails if no common legal notices are present
erikj
parents: 54380
diff changeset
   100
endif
42505
11439b0c0792 8169925: Organize licenses by module in source, JMOD file, and run-time image
mchung
parents: 41874
diff changeset
   101
42517
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
   102
ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
   103
  JMOD_FLAGS += --do-not-resolve-by-default
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
   104
  JMOD_FLAGS += --warn-if-resolved=incubating
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
   105
endif
d3485deb09eb 8170859: Run time and tool support for ModuleResolution
alanb
parents: 41874
diff changeset
   106
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   107
# 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
   108
# jmods.
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   109
ifeq ($(MODULE), java.base)
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   110
  # 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
   111
  ifneq ($(CREATING_BUILDJDK), true)
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   112
    # When creating interim versions of jmods, skip hashes
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   113
    ifneq ($(INTERIM_JMOD), true)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   114
      ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   115
      DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   116
          $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   117
45612
3368f6d8b082 8182032: Make java.compiler upgradeable
mchung
parents: 45510
diff changeset
   118
      EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   119
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   120
      JMOD_FLAGS += --module-path $(JMODS_DIR) \
45612
3368f6d8b082 8182032: Make java.compiler upgradeable
mchung
parents: 45510
diff changeset
   121
          --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   122
    endif
37770
9f040cf69078 8150044: Generate classlists at build-time
redestad
parents: 37765
diff changeset
   123
  endif
49566
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   124
else # not java.base
53683
48ff68e2fe5c 8218431: Improved platform checking in makefiles
ihse
parents: 52804
diff changeset
   125
  ifeq ($(call isTargetOs, windows), true)
49566
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   126
    # Only java.base needs to include the MSVC*_DLLs. Make sure no other module
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   127
    # tries to include them (typically imported ones).
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   128
    ifneq ($(MSVCR_DLL), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   129
      ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCR_DLL))), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   130
        JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   131
      endif
49566
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   132
    endif
50073
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   133
    ifneq ($(MSVCP_DLL), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   134
      ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   135
        JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   136
      endif
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   137
    endif
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   138
    ifneq ($(UCRT_DLL_DIR), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   139
      UCRT_DLL_FILES := $(notdir $(wildcard $(UCRT_DLL_DIR)/*.dll))
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   140
      ifneq ($(wildcard $(LIBS_DIR)/$(firstword $(UCRT_DLL_FILES))), )
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   141
        JMOD_FLAGS += $(patsubst %, --exclude '%', $(UCRT_DLL_FILES))
35b22ca681d1 8202557: OpenJDK fails to start in Windows 7 and 8.1 after upgrading compiler to VC 2017
erikj
parents: 49566
diff changeset
   142
      endif
49566
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   143
    endif
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   144
  endif
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36506
diff changeset
   145
endif
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   146
39929
f6828731baa8 8160334: Building --with-parfait= fails with No rule to make target 'PARFAIT_NATIVEJMOD
erikj
parents: 38848
diff changeset
   147
# 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
   148
# 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
   149
# 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
   150
DEPS += $(wildcard $(JMOD_CMD))
38848
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   151
ifeq ($(EXTERNAL_BUILDJDK), false)
54380
e297c7bb6469 8189861: Refactor CacheFind
erikj
parents: 53995
diff changeset
   152
  DEPS += $(call FindFiles, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
38848
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   153
endif
0bc7ed792590 8144911: Consider having modifications to jdk.jlink trigger recreation of all jmods
erikj
parents: 37975
diff changeset
   154
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   155
# 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
   156
# to avoid false incremental rebuilds.
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   157
ifeq ($(INTERIM_JMOD), true)
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   158
  DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   159
  INTERIM_MSG := interim$(SPACE)
41874
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   160
endif
07c3c4f1eb63 8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents: 41532
diff changeset
   161
49566
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   162
JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
7c224ec572d0 8201267: Disable warnings for VS2017 to enable building
erikj
parents: 49537
diff changeset
   163
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   164
# Create jmods in the support dir and then move them into place to keep the
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   165
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   166
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   167
    WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   168
    DEPS := $(DEPS), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   169
    OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   170
    SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   171
    PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   172
    COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   173
        --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   174
        --module-path $(JMODS_DIR) $(JMOD_FLAGS) \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   175
        $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   176
    POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   177
))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   178
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 53683
diff changeset
   179
TARGETS += $(create_$(JMOD_FILE))
36506
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   180
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   181
################################################################################
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   182
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   183
all: $(TARGETS)
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   184
17612cee3530 8142968: Module System implementation
alanb
parents:
diff changeset
   185
################################################################################