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