1 # 2 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 default: all 27 28 include $(SPEC) 29 include MakeBase.gmk 30 include Modules.gmk 31 32 ifeq ($(MODULE), ) 33 $(error MODULE must be set when calling CreateJmods.gmk) 34 endif 35 36 ################################################################################ 37 38 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 39 $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS)))) 40 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 41 $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS)))) 42 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \ 43 $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF)))) 44 CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE)) 45 46 $(eval $(call FillCacheFind, \ 47 $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \ 48 )) 49 50 ifneq ($(LIBS_DIR), ) 51 JMOD_FLAGS += --libs $(LIBS_DIR) 52 DEPS += $(call CacheFind, $(LIBS_DIR)) 53 endif 54 ifneq ($(CMDS_DIR), ) 55 JMOD_FLAGS += --cmds $(CMDS_DIR) 56 DEPS += $(call CacheFind, $(CMDS_DIR)) 57 endif 58 ifneq ($(CONF_DIR), ) 59 JMOD_FLAGS += --config $(CONF_DIR) 60 DEPS += $(call CacheFind, $(CONF_DIR)) 61 endif 62 ifneq ($(CLASSES_DIR), ) 63 JMOD_FLAGS += --class-path $(CLASSES_DIR) 64 DEPS += $(call CacheFind, $(CLASSES_DIR)) 65 endif 66 67 # Add dependencies on other jmod files 68 DEPS += $(patsubst %, $(IMAGES_OUTPUTDIR)/jmods/%.jmod, \ 69 $(call FindDepsForModule, $(MODULE))) 70 71 # TODO: What about headers? 72 # Create jmods in a temp dir and then move them into place to keep the 73 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times. 74 $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod: $(DEPS) 75 $(call LogWarn, Creating $(notdir $@)) 76 $(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods) 77 $(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) 78 $(JMOD) create \ 79 --module-version $(VERSION_SHORT) \ 80 --os-name $(REQUIRED_OS_NAME) \ 81 --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \ 82 --os-version $(REQUIRED_OS_VERSION) \ 83 --modulepath $(IMAGES_OUTPUTDIR)/jmods\ 84 --hash-dependencies '.*' \ 85 --exclude '**_the.*' \ 86 $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) 87 $(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@ 88 89 TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod 90 91 ################################################################################ 92 93 all: $(TARGETS) 94 95 ################################################################################