CreateJmods.gmk revision 2540:16d1c3ff3d0e
176278Sjoerg 276278Sjoerg# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 376278Sjoerg# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 476278Sjoerg# 580258Sdd# This code is free software; you can redistribute it and/or modify it 680258Sdd# under the terms of the GNU General Public License version 2 only, as 776278Sjoerg# published by the Free Software Foundation. Oracle designates this 876278Sjoerg# particular file as subject to the "Classpath" exception as provided 976278Sjoerg# by Oracle in the LICENSE file that accompanied this code. 1076278Sjoerg# 1176278Sjoerg# This code is distributed in the hope that it will be useful, but WITHOUT 12100709Sru# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13100709Sru# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14100709Sru# version 2 for more details (a copy is included in the LICENSE file that 15100709Sru# accompanied this code). 16100709Sru# 17100709Sru# You should have received a copy of the GNU General Public License version 18100709Sru# 2 along with this work; if not, write to the Free Software Foundation, 19100709Sru# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20100709Sru# 21100709Sru# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2276278Sjoerg# or visit www.oracle.com if you need additional information or have any 2376278Sjoerg# questions. 2476278Sjoerg# 2581349Sjhay 2696826Sbmahdefault: all 2776278Sjoerg 2876278Sjoerginclude $(SPEC) 2976278Sjoerginclude MakeBase.gmk 3081250Snikinclude Modules.gmk 3181646Sbmah 3292506Sjhayifeq ($(MODULE), ) 3376278Sjoerg $(error MODULE must be set when calling CreateJmods.gmk) 3476278Sjoergendif 3599918Sbmah 3676278Sjoerg################################################################################ 3781646Sbmah 3876278SjoergJMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods 39106730StmmJMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods 4081646Sbmah 4183909SbmahLIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4276278Sjoerg $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS)))) 4376278SjoergCMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4476278Sjoerg $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS)))) 4576278SjoergCONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4676278Sjoerg $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF)))) 4776278SjoergCLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE)) 48114059SmurrayINCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 49114059Smurray $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS)))) 5076278SjoergMAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 5176278Sjoerg $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN)))) 5296822Sbmah 5376278Sjoerg$(eval $(call FillCacheFind, \ 5476278Sjoerg $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \ 5581250Snik)) 5681250Snik 5776278Sjoergifneq ($(LIBS_DIR), ) 5876278Sjoerg JMOD_FLAGS += --libs $(LIBS_DIR) 59114059Smurray DEPS += $(call CacheFind, $(LIBS_DIR)) 60114059Smurrayendif 6176278Sjoergifneq ($(CMDS_DIR), ) 6296826Sbmah JMOD_FLAGS += --cmds $(CMDS_DIR) 6399918Sbmah DEPS += $(call CacheFind, $(CMDS_DIR)) 6476278Sjoergendif 65100709Sruifneq ($(CONF_DIR), ) 66100709Sru JMOD_FLAGS += --config $(CONF_DIR) 67100709Sru DEPS += $(call CacheFind, $(CONF_DIR)) 68106730Stmmendif 6982344Swilkoifneq ($(CLASSES_DIR), ) 7082344Swilko JMOD_FLAGS += --class-path $(CLASSES_DIR) 7182344Swilko DEPS += $(call CacheFind, $(CLASSES_DIR)) 7282344Swilkoendif 73ifneq ($(INCLUDE_HEADERS_DIR), ) 74 JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR) 75 DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR)) 76endif 77ifneq ($(MAN_DIR), ) 78 JMOD_FLAGS += --man-pages $(MAN_DIR) 79 DEPS += $(call CacheFind, $(MAN_DIR)) 80endif 81 82LEGAL_NOTICES := \ 83 $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \ 84 $(call FindModuleLegalDirs, $(MODULE)) \ 85 # 86 87LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES)) 88DEPS += $(call CacheFind, $(LEGAL_NOTICES)) 89 90JMOD_FLAGS += --legal-notices $(LEGAL_NOTICES_PATH) 91 92ifeq ($(filter-out jdk.incubator.%, $(MODULE)), ) 93 JMOD_FLAGS += --do-not-resolve-by-default 94 JMOD_FLAGS += --warn-if-resolved=incubating 95endif 96 97# Add dependencies on other jmod files. Only java.base needs access to other 98# jmods. 99ifeq ($(MODULE), java.base) 100 # When creating a BUILDJDK, we don't need to add hashes to java.base 101 ifneq ($(CREATING_BUILDJDK), true) 102 # When creating interim versions of jmods, skip hashes 103 ifneq ($(INTERIM_JMOD), true) 104 ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules) 105 DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \ 106 $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules))) 107 108 EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES)))) 109 110 JMOD_FLAGS += --module-path $(JMODS_DIR) \ 111 --hash-modules '^(?!$(EXCLUDE_PATTERN))' 112 endif 113 endif 114endif 115 116# Changes to the jmod tool itself should also trigger a rebuild of all jmods. 117# The variable JMOD_CMD could contain an environment variable assignment before 118# the actual command. Filter that out using wildcard before adding to DEPS. 119DEPS += $(wildcard $(JMOD_CMD)) 120ifeq ($(EXTERNAL_BUILDJDK), false) 121 DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod) 122endif 123 124# If creating interim versions of jmods, certain files need to be filtered out 125# to avoid false incremental rebuilds. 126ifeq ($(INTERIM_JMOD), true) 127 DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS)) 128endif 129 130# Create jmods in a temp dir and then move them into place to keep the 131# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times. 132$(JMODS_DIR)/$(MODULE).jmod: $(DEPS) 133 $(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@)) 134 $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR)) 135 $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@) 136 $(JMOD) create \ 137 --module-version $(VERSION_SHORT) \ 138 --os-name '$(REQUIRED_OS_NAME)' \ 139 --os-arch '$(REQUIRED_OS_ARCH)' \ 140 --module-path $(JMODS_DIR) \ 141 --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \ 142 $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) 143 $(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@ 144 145TARGETS += $(JMODS_DIR)/$(MODULE).jmod 146 147################################################################################ 148 149all: $(TARGETS) 150 151################################################################################ 152