annotate make/CreateJmods.gmk @ 2592:0b1d62e12105

8178380: Module system implementation refresh (5/2017) Reviewed-by: alanb Contributed-by: mandy.chung@oracle.com
author alanb
date Thu, 04 May 2017 07:26:16 +0000
parents d0e9877fff61
children abe884590f03
rev   line source
redestad@2073 1
erikj@2206 2 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
alanb@1970 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
alanb@1970 4 #
alanb@1970 5 # This code is free software; you can redistribute it and/or modify it
alanb@1970 6 # under the terms of the GNU General Public License version 2 only, as
alanb@1970 7 # published by the Free Software Foundation. Oracle designates this
alanb@1970 8 # particular file as subject to the "Classpath" exception as provided
alanb@1970 9 # by Oracle in the LICENSE file that accompanied this code.
alanb@1970 10 #
alanb@1970 11 # This code is distributed in the hope that it will be useful, but WITHOUT
alanb@1970 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
alanb@1970 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
alanb@1970 14 # version 2 for more details (a copy is included in the LICENSE file that
alanb@1970 15 # accompanied this code).
alanb@1970 16 #
alanb@1970 17 # You should have received a copy of the GNU General Public License version
alanb@1970 18 # 2 along with this work; if not, write to the Free Software Foundation,
alanb@1970 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
alanb@1970 20 #
alanb@1970 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
alanb@1970 22 # or visit www.oracle.com if you need additional information or have any
alanb@1970 23 # questions.
alanb@1970 24 #
alanb@1970 25
alanb@1970 26 default: all
alanb@1970 27
alanb@1970 28 include $(SPEC)
alanb@1970 29 include MakeBase.gmk
alanb@1970 30 include Modules.gmk
alanb@1970 31
alanb@1970 32 ifeq ($(MODULE), )
alanb@1970 33 $(error MODULE must be set when calling CreateJmods.gmk)
alanb@1970 34 endif
alanb@1970 35
alanb@1970 36 ################################################################################
alanb@1970 37
redestad@2073 38 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
erikj@2341 39 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
redestad@2073 40
alanb@1970 41 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
erikj@2288 42 $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
alanb@1970 43 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
erikj@2288 44 $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
alanb@1970 45 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
alanb@1970 46 $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
alanb@1970 47 CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
mchung@2312 48 INCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
mchung@2312 49 $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS))))
mchung@2312 50 MAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
mchung@2312 51 $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN))))
alanb@1970 52
alanb@1970 53 $(eval $(call FillCacheFind, \
alanb@1970 54 $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
alanb@1970 55 ))
alanb@1970 56
alanb@1970 57 ifneq ($(LIBS_DIR), )
alanb@1970 58 JMOD_FLAGS += --libs $(LIBS_DIR)
alanb@1970 59 DEPS += $(call CacheFind, $(LIBS_DIR))
alanb@1970 60 endif
alanb@1970 61 ifneq ($(CMDS_DIR), )
alanb@1970 62 JMOD_FLAGS += --cmds $(CMDS_DIR)
alanb@1970 63 DEPS += $(call CacheFind, $(CMDS_DIR))
alanb@1970 64 endif
alanb@1970 65 ifneq ($(CONF_DIR), )
alanb@1970 66 JMOD_FLAGS += --config $(CONF_DIR)
alanb@1970 67 DEPS += $(call CacheFind, $(CONF_DIR))
alanb@1970 68 endif
alanb@1970 69 ifneq ($(CLASSES_DIR), )
alanb@1970 70 JMOD_FLAGS += --class-path $(CLASSES_DIR)
alanb@1970 71 DEPS += $(call CacheFind, $(CLASSES_DIR))
alanb@1970 72 endif
mchung@2312 73 ifneq ($(INCLUDE_HEADERS_DIR), )
mchung@2312 74 JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR)
mchung@2312 75 DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR))
mchung@2312 76 endif
mchung@2312 77 ifneq ($(MAN_DIR), )
mchung@2312 78 JMOD_FLAGS += --man-pages $(MAN_DIR)
mchung@2312 79 DEPS += $(call CacheFind, $(MAN_DIR))
mchung@2312 80 endif
alanb@1970 81
mchung@2397 82 LEGAL_NOTICES := \
mchung@2397 83 $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
mchung@2397 84 $(call FindModuleLegalDirs, $(MODULE)) \
mchung@2397 85 #
mchung@2397 86
mchung@2397 87 LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
mchung@2397 88 DEPS += $(call CacheFind, $(LEGAL_NOTICES))
mchung@2397 89
mchung@2397 90 JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH)
mchung@2397 91
alanb@2409 92 ifeq ($(filter-out jdk.incubator.%, $(MODULE)), )
alanb@2409 93 JMOD_FLAGS += --do-not-resolve-by-default
alanb@2409 94 JMOD_FLAGS += --warn-if-resolved=incubating
alanb@2409 95 endif
alanb@2409 96
alanb@2067 97 # Add dependencies on other jmod files. Only java.base needs access to other
alanb@2067 98 # jmods.
alanb@2067 99 ifeq ($(MODULE), java.base)
redestad@2073 100 # When creating a BUILDJDK, we don't need to add hashes to java.base
redestad@2073 101 ifneq ($(CREATING_BUILDJDK), true)
erikj@2341 102 # When creating interim versions of jmods, skip hashes
erikj@2341 103 ifneq ($(INTERIM_JMOD), true)
erikj@2341 104 ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules)
erikj@2341 105 DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
erikj@2341 106 $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
alanb@2067 107
erikj@2341 108 EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES))))
alanb@2067 109
erikj@2341 110 JMOD_FLAGS += --module-path $(JMODS_DIR) \
erikj@2341 111 --hash-modules '^(?!$(EXCLUDE_PATTERN))'
erikj@2341 112 endif
redestad@2073 113 endif
alanb@2067 114 endif
alanb@1970 115
erikj@2206 116 # Changes to the jmod tool itself should also trigger a rebuild of all jmods.
erikj@2206 117 # The variable JMOD_CMD could contain an environment variable assignment before
erikj@2206 118 # the actual command. Filter that out using wildcard before adding to DEPS.
erikj@2206 119 DEPS += $(wildcard $(JMOD_CMD))
erikj@2136 120 ifeq ($(EXTERNAL_BUILDJDK), false)
erikj@2136 121 DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
erikj@2136 122 endif
erikj@2136 123
erikj@2341 124 # If creating interim versions of jmods, certain files need to be filtered out
erikj@2341 125 # to avoid false incremental rebuilds.
erikj@2341 126 ifeq ($(INTERIM_JMOD), true)
erikj@2341 127 DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
erikj@2341 128 endif
erikj@2341 129
alanb@1970 130 # Create jmods in a temp dir and then move them into place to keep the
alanb@1970 131 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
redestad@2073 132 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
redestad@2073 133 $(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
erikj@2341 134 $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
erikj@2341 135 $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
alanb@1970 136 $(JMOD) create \
alanb@1970 137 --module-version $(VERSION_SHORT) \
alanb@2592 138 --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
mchung@2236 139 --module-path $(JMODS_DIR) \
erikj@2539 140 --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
erikj@2341 141 $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@)
erikj@2341 142 $(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
alanb@1970 143
erikj@2341 144 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
alanb@1970 145
alanb@1970 146 ################################################################################
alanb@1970 147
alanb@1970 148 all: $(TARGETS)
alanb@1970 149
alanb@1970 150 ################################################################################