CreateJmods.gmk revision 2317:9ae47deec185
11928Swollman 21928Swollman# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 31928Swollman# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41928Swollman# 51928Swollman# This code is free software; you can redistribute it and/or modify it 61928Swollman# under the terms of the GNU General Public License version 2 only, as 71928Swollman# published by the Free Software Foundation. Oracle designates this 81928Swollman# particular file as subject to the "Classpath" exception as provided 91928Swollman# by Oracle in the LICENSE file that accompanied this code. 101928Swollman# 111928Swollman# This code is distributed in the hope that it will be useful, but WITHOUT 121928Swollman# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131928Swollman# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141928Swollman# version 2 for more details (a copy is included in the LICENSE file that 151928Swollman# accompanied this code). 161928Swollman# 171928Swollman# You should have received a copy of the GNU General Public License version 181928Swollman# 2 along with this work; if not, write to the Free Software Foundation, 191928Swollman# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201928Swollman# 211928Swollman# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221928Swollman# or visit www.oracle.com if you need additional information or have any 231928Swollman# questions. 241928Swollman# 251928Swollman 261928Swollmandefault: all 271928Swollman 281928Swollmaninclude $(SPEC) 2950476Speterinclude MakeBase.gmk 301928Swollmaninclude Modules.gmk 31228505Sjoel 3289362Sruifeq ($(MODULE), ) 3379538Sru $(error MODULE must be set when calling CreateJmods.gmk) 341928Swollmanendif 351928Swollman 3610523Swpaul################################################################################ 371928Swollman 3868962SruJMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods 391928SwollmanJMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods 401928Swollman 411928SwollmanLIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4210523Swpaul $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS)))) 4310523SwpaulCMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4410523Swpaul $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS)))) 4510523SwpaulCONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4610523Swpaul $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF)))) 4710523SwpaulCLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE)) 4810523SwpaulINCLUDE_HEADERS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 4910523Swpaul $(SUPPORT_OUTPUTDIR)/modules_include $(IMPORT_MODULES_INCLUDE_HEADERS)))) 5010523SwpaulMAN_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 5110523Swpaul $(SUPPORT_OUTPUTDIR)/modules_man $(IMPORT_MODULES_MAN)))) 5210523Swpaul 531928Swollman$(eval $(call FillCacheFind, \ 5415135Smpp $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \ 5531932Scharnier)) 5631932Scharnier 5731932Scharnierifneq ($(LIBS_DIR), ) 5831932Scharnier JMOD_FLAGS += --libs $(LIBS_DIR) 5931932Scharnier DEPS += $(call CacheFind, $(LIBS_DIR)) 6068951Ssheldonhendif 6168951Ssheldonhifneq ($(CMDS_DIR), ) 6210523Swpaul JMOD_FLAGS += --cmds $(CMDS_DIR) 6310523Swpaul DEPS += $(call CacheFind, $(CMDS_DIR)) 6479727Sschweikhendif 651928Swollmanifneq ($(CONF_DIR), ) 6610523Swpaul JMOD_FLAGS += --config $(CONF_DIR) 6710523Swpaul DEPS += $(call CacheFind, $(CONF_DIR)) 6830871Scharnierendif 6910523Swpaulifneq ($(CLASSES_DIR), ) 7015135Smpp JMOD_FLAGS += --class-path $(CLASSES_DIR) 7189358Sru DEPS += $(call CacheFind, $(CLASSES_DIR)) 7289358Sruendif 7331932Scharnierifneq ($(INCLUDE_HEADERS_DIR), ) 7431932Scharnier JMOD_FLAGS += --header-files $(INCLUDE_HEADERS_DIR) 7510523Swpaul DEPS += $(call CacheFind, $(INCLUDE_HEADERS_DIR)) 7610523Swpaulendif 7710523Swpaulifneq ($(MAN_DIR), ) 7830871Scharnier JMOD_FLAGS += --man-pages $(MAN_DIR) 7910523Swpaul DEPS += $(call CacheFind, $(MAN_DIR)) 8031932Scharnierendif 8131932Scharnier 8231932Scharnier# Add dependencies on other jmod files. Only java.base needs access to other 8331932Scharnier# jmods. 8431932Scharnierifeq ($(MODULE), java.base) 8531932Scharnier # When creating a BUILDJDK, we don't need to add hashes to java.base 8657695Ssheldonh ifneq ($(CREATING_BUILDJDK), true) 8757695Ssheldonh # When creating interim versions of jmods, skip hashes 8831932Scharnier ifneq ($(INTERIM_JMOD), true) 8931932Scharnier ALL_UPGRADEABLE_MODULES := $(call FindAllUpgradeableModules) 9031932Scharnier DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \ 9110523Swpaul $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules))) 9210523Swpaul 9331932Scharnier EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES)))) 9431932Scharnier 9531932Scharnier JMOD_FLAGS += --module-path $(JMODS_DIR) \ 9610523Swpaul --hash-modules '^(?!$(EXCLUDE_PATTERN))' 9789358Sru endif 9889358Sru endif 9910523Swpaulendif 10089358Sru 10189358Sru# Changes to the jmod tool itself should also trigger a rebuild of all jmods. 10224091Smpp# The variable JMOD_CMD could contain an environment variable assignment before 10368716Sru# the actual command. Filter that out using wildcard before adding to DEPS. 10424091SmppDEPS += $(wildcard $(JMOD_CMD)) 10589358Sruifeq ($(EXTERNAL_BUILDJDK), false) 10610523Swpaul DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod) 10789358Sruendif 10831932Scharnier 10931932Scharnier# If creating interim versions of jmods, certain files need to be filtered out 11057695Ssheldonh# to avoid false incremental rebuilds. 11157695Ssheldonhifeq ($(INTERIM_JMOD), true) 11231932Scharnier DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS)) 11331932Scharnierendif 11410523Swpaul 11557695Ssheldonh# TODO: What about headers? 11657695Ssheldonh# Create jmods in a temp dir and then move them into place to keep the 11710523Swpaul# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times. 11810523Swpaul$(JMODS_DIR)/$(MODULE).jmod: $(DEPS) 11924091Smpp $(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@)) 12068716Sru $(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR)) 12131932Scharnier $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@) 12231932Scharnier $(JMOD) create \ 12331932Scharnier --module-version $(VERSION_SHORT) \ 12410523Swpaul --os-name $(REQUIRED_OS_NAME) \ 12510523Swpaul --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \ 12689358Sru --os-version $(REQUIRED_OS_VERSION) \ 12789358Sru --module-path $(JMODS_DIR) \ 12831932Scharnier --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \ 12931932Scharnier $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) 13089358Sru $(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@ 13189358Sru 13231932ScharnierTARGETS += $(JMODS_DIR)/$(MODULE).jmod 13331932Scharnier 13489358Sru################################################################################ 13589358Sru 13689358Sruall: $(TARGETS) 13710523Swpaul 13889358Sru################################################################################ 13989358Sru