CreateJmods.gmk revision 2385:8a46c6dfaac5
1166144Smarius 2166144Smarius# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 3166144Smarius# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4166144Smarius# 5166144Smarius# This code is free software; you can redistribute it and/or modify it 6166144Smarius# under the terms of the GNU General Public License version 2 only, as 7166144Smarius# published by the Free Software Foundation. Oracle designates this 8166144Smarius# particular file as subject to the "Classpath" exception as provided 9166144Smarius# by Oracle in the LICENSE file that accompanied this code. 10166144Smarius# 11166144Smarius# This code is distributed in the hope that it will be useful, but WITHOUT 12166144Smarius# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13166144Smarius# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14166144Smarius# version 2 for more details (a copy is included in the LICENSE file that 15166144Smarius# accompanied this code). 16166144Smarius# 17166144Smarius# You should have received a copy of the GNU General Public License version 18166144Smarius# 2 along with this work; if not, write to the Free Software Foundation, 19166144Smarius# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20166144Smarius# 21166144Smarius# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22166144Smarius# or visit www.oracle.com if you need additional information or have any 23166144Smarius# questions. 24166144Smarius# 25166144Smarius 26166144Smariusdefault: all 27166144Smarius 28166144Smariusinclude $(SPEC) 29166144Smariusinclude MakeBase.gmk 30166144Smariusinclude Modules.gmk 31166144Smarius 32166144Smariusifeq ($(MODULE), ) 33166144Smarius $(error MODULE must be set when calling CreateJmods.gmk) 34166144Smariusendif 35166144Smarius 36166144Smarius################################################################################ 37166144Smarius 38166144SmariusJMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods 39166144SmariusJMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods 40166144Smarius 41166144SmariusLIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 42166144Smarius $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS)))) 43166144SmariusCMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 44166144Smarius $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS)))) 45166144SmariusCONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 46166144Smarius $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF)))) 47166144SmariusCLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE)) 48166144SmariusINCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 49166144Smarius $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS)))) 50166144SmariusMAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 51166144Smarius $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN)))) 52166144Smarius 53166144Smarius$(eval $(call FillCacheFind, \ 54166144Smarius $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \ 55166144Smarius)) 56166144Smarius 57166144Smariusifneq ($(LIBS_DIR), ) 58166144Smarius JMOD_FLAGS += --libs $(LIBS_DIR) 59166144Smarius DEPS += $(call CacheFind, $(LIBS_DIR)) 60166144Smariusendif 61166144Smariusifneq ($(CMDS_DIR), ) 62166144Smarius JMOD_FLAGS += --cmds $(CMDS_DIR) 63166144Smarius DEPS += $(call CacheFind, $(CMDS_DIR)) 64166144Smariusendif 65166144Smariusifneq ($(CONF_DIR), ) 66166144Smarius JMOD_FLAGS += --config $(CONF_DIR) 67166144Smarius DEPS += $(call CacheFind, $(CONF_DIR)) 68166144Smariusendif 69166144Smariusifneq ($(CLASSES_DIR), ) 70166144Smarius JMOD_FLAGS += --class-path $(CLASSES_DIR) 71166144Smarius DEPS += $(call CacheFind, $(CLASSES_DIR)) 72166144Smariusendif 73166144Smariusifneq ($(INCLUDE_HEADERS_DIR), ) 74166144Smarius JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR) 75166144Smarius DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR)) 76166144Smariusendif 77166144Smariusifneq ($(MAN_DIR), ) 78166144Smarius JMOD_FLAGS += --man-pages $(MAN_DIR) 79166144Smarius DEPS += $(call CacheFind, $(MAN_DIR)) 80166144Smariusendif 81166144Smarius 82166144Smariusifeq ($(filter-out jdk.incubator.%, $(MODULE)), ) 83166144Smarius JMOD_FLAGS += --do-not-resolve-by-default 84225931Smarius JMOD_FLAGS += --warn-if-resolved=incubating 85166144Smariusendif 86166144Smarius 87166144Smarius# Add dependencies on other jmod files. Only java.base needs access to other 88166144Smarius# jmods. 89166144Smariusifeq ($(MODULE), java.base) 90166144Smarius # When creating a BUILDJDK, we don't need to add hashes to java.base 91166144Smarius ifneq ($(CREATING_BUILDJDK), true) 92166144Smarius # When creating interim versions of jmods, skip hashes 93166144Smarius ifneq ($(INTERIM_JMOD), true) 94166144Smarius ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules) 95166144Smarius DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \ 96166144Smarius $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules))) 97166144Smarius 98166144Smarius EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES)))) 99166144Smarius 100166144Smarius JMOD_FLAGS += --module-path $(JMODS_DIR) \ 101166144Smarius --hash-modules '^(?!$(EXCLUDE_PATTERN))' 102166144Smarius endif 103166144Smarius endif 104183337Smariusendif 105183337Smarius 106166144Smarius# Changes to the jmod tool itself should also trigger a rebuild of all jmods. 107166144Smarius# The variable JMOD_CMD could contain an environment variable assignment before 108166144Smarius# the actual command. Filter that out using wildcard before adding to DEPS. 109166144SmariusDEPS += $(wildcard $(JMOD_CMD)) 110166144Smariusifeq ($(EXTERNAL_BUILDJDK), false) 111166144Smarius DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod) 112166144Smariusendif 113166144Smarius 114166144Smarius# If creating interim versions of jmods, certain files need to be filtered out 115166144Smarius# to avoid false incremental rebuilds. 116166144Smariusifeq ($(INTERIM_JMOD), true) 117166144Smarius DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS)) 118166144Smariusendif 119166144Smarius 120166144Smarius# TODO: What about headers? 121166144Smarius# Create jmods in a temp dir and then move them into place to keep the 122166144Smarius# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times. 123166144Smarius$(JMODS_DIR)/$(MODULE).jmod: $(DEPS) 124166144Smarius $(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@)) 125166144Smarius $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR)) 126166144Smarius $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@) 127166144Smarius $(JMOD) create \ 128166144Smarius --module-version $(VERSION_SHORT) \ 129166144Smarius --os-name $(REQUIRED_OS_NAME) \ 130166144Smarius --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \ 131166144Smarius --os-version $(REQUIRED_OS_VERSION) \ 132166144Smarius --module-path $(JMODS_DIR) \ 133166144Smarius --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \ 134166144Smarius $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) 135166144Smarius $(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@ 136166144Smarius 137166144SmariusTARGETS += $(JMODS_DIR)/$(MODULE).jmod 138166144Smarius 139166144Smarius################################################################################ 140166144Smarius 141166144Smariusall: $(TARGETS) 142166144Smarius 143166144Smarius################################################################################ 144166144Smarius