CreateJmods.gmk revision 1961:f900d5afd9c8
17249Sstefank#
27249Sstefank# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
37249Sstefank# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
47249Sstefank#
57249Sstefank# This code is free software; you can redistribute it and/or modify it
67249Sstefank# under the terms of the GNU General Public License version 2 only, as
77249Sstefank# published by the Free Software Foundation.  Oracle designates this
87249Sstefank# particular file as subject to the "Classpath" exception as provided
97249Sstefank# by Oracle in the LICENSE file that accompanied this code.
107249Sstefank#
117249Sstefank# This code is distributed in the hope that it will be useful, but WITHOUT
127249Sstefank# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
137249Sstefank# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
147249Sstefank# version 2 for more details (a copy is included in the LICENSE file that
157249Sstefank# accompanied this code).
167249Sstefank#
177249Sstefank# You should have received a copy of the GNU General Public License version
187249Sstefank# 2 along with this work; if not, write to the Free Software Foundation,
197249Sstefank# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
207249Sstefank#
217249Sstefank# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
227249Sstefank# or visit www.oracle.com if you need additional information or have any
237249Sstefank# questions.
247249Sstefank#
257249Sstefank
267249Sstefankdefault: all
277249Sstefank
287249Sstefankinclude $(SPEC)
297249Sstefankinclude MakeBase.gmk
307249Sstefankinclude Modules.gmk
317249Sstefank
327249Sstefankifeq ($(MODULE), )
337249Sstefank  $(error MODULE must be set when calling CreateJmods.gmk)
347249Sstefankendif
357249Sstefank
367249Sstefank################################################################################
377249Sstefank
387249SstefankLIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
397249Sstefank    $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
407249SstefankCMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
417249Sstefank    $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
427249SstefankCONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
437249Sstefank    $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
447249SstefankCLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
457249Sstefank
467249Sstefank$(eval $(call FillCacheFind, \
477249Sstefank    $(LIBS_DIR) $(CMDS_DIR) $(CONF_DIR) $(CLASSES_DIR) \
487249Sstefank))
497249Sstefank
507249Sstefankifneq ($(LIBS_DIR), )
517249Sstefank  JMOD_FLAGS += --libs $(LIBS_DIR)
527249Sstefank  DEPS += $(call CacheFind, $(LIBS_DIR))
537249Sstefankendif
547249Sstefankifneq ($(CMDS_DIR), )
557249Sstefank  JMOD_FLAGS += --cmds $(CMDS_DIR)
567249Sstefank  DEPS += $(call CacheFind, $(CMDS_DIR))
577249Sstefankendif
587249Sstefankifneq ($(CONF_DIR), )
597249Sstefank  JMOD_FLAGS += --config $(CONF_DIR)
607249Sstefank  DEPS += $(call CacheFind, $(CONF_DIR))
617249Sstefankendif
627249Sstefankifneq ($(CLASSES_DIR), )
637249Sstefank  JMOD_FLAGS += --class-path $(CLASSES_DIR)
647249Sstefank  DEPS += $(call CacheFind, $(CLASSES_DIR))
657249Sstefankendif
667249Sstefank
677249Sstefank# Add dependencies on other jmod files
687249SstefankDEPS += $(patsubst %, $(IMAGES_OUTPUTDIR)/jmods/%.jmod, \
697249Sstefank    $(call FindDepsForModule, $(MODULE)))
707249Sstefank
717249Sstefank# TODO: What about headers?
727249Sstefank# Create jmods in a temp dir and then move them into place to keep the
737249Sstefank# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
747249Sstefank$(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod: $(DEPS)
757249Sstefank	$(call LogWarn, Creating $(notdir $@))
769056Sdavid	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods)
777249Sstefank	$(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
787249Sstefank	$(JMOD) create \
797249Sstefank            --module-version $(VERSION_SHORT) \
807249Sstefank            --os-name $(REQUIRED_OS_NAME) \
817249Sstefank            --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
89TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod
90
91################################################################################
92
93all: $(TARGETS)
94
95################################################################################
96