make/CreateJmods.gmk
changeset 37770 9f040cf69078
parent 37765 d65d7bda43ce
child 37975 551c5d86de79
equal deleted inserted replaced
37769:96f9a38fb70e 37770:9f040cf69078
     1 #
     1 
     2 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
    33   $(error MODULE must be set when calling CreateJmods.gmk)
    33   $(error MODULE must be set when calling CreateJmods.gmk)
    34 endif
    34 endif
    35 
    35 
    36 ################################################################################
    36 ################################################################################
    37 
    37 
       
    38 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
       
    39 
    38 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    40 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    39     $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
    41     $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
    40 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    42 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    41     $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
    43     $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
    42 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    44 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
    65 endif
    67 endif
    66 
    68 
    67 # Add dependencies on other jmod files. Only java.base needs access to other
    69 # Add dependencies on other jmod files. Only java.base needs access to other
    68 # jmods.
    70 # jmods.
    69 ifeq ($(MODULE), java.base)
    71 ifeq ($(MODULE), java.base)
    70   DEPS += $(patsubst %, $(IMAGES_OUTPUTDIR)/jmods/%.jmod, \
    72   # When creating a BUILDJDK, we don't need to add hashes to java.base
    71       $(filter-out java.base, $(call FindAllModules)))
    73   ifneq ($(CREATING_BUILDJDK), true)
       
    74     DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
       
    75         $(filter-out java.base, $(call FindAllModules)))
    72 
    76 
    73   # TODO: find modules that directly and indrectly on upgradeable modules
    77     # TODO: find modules that directly and indirectly depend on upgradeable
    74   EXCLUDE_HASH_MODULES := $(UPGRADEABLE_MODULES) \
    78     # modules
    75     java.se.ee \
    79     EXCLUDE_HASH_MODULES := $(UPGRADEABLE_MODULES) \
    76     jdk.rmic \
    80       java.se.ee \
    77     jdk.xml.bind \
    81       jdk.rmic \
    78     jdk.xml.ws \
    82       jdk.xml.bind \
    79     #
    83       jdk.xml.ws \
       
    84       #
    80 
    85 
    81   EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(EXCLUDE_HASH_MODULES))))
    86     EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(EXCLUDE_HASH_MODULES))))
    82 
    87 
    83   JMOD_FLAGS += --modulepath $(IMAGES_OUTPUTDIR)/jmods \
    88     JMOD_FLAGS += --modulepath $(JMODS_DIR) \
    84     		--hash-modules '^(?!$(EXCLUDE_PATTERN))'
    89         --hash-modules '^(?!$(EXCLUDE_PATTERN))'
       
    90   endif
    85 endif
    91 endif
    86 
    92 
    87 # TODO: What about headers?
    93 # TODO: What about headers?
    88 # Create jmods in a temp dir and then move them into place to keep the
    94 # Create jmods in a temp dir and then move them into place to keep the
    89 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
    95 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
    90 $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod: $(DEPS)
    96 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
    91 	$(call LogWarn, Creating $(notdir $@))
    97 	$(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
    92 	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods)
    98 	$(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/jmods)
    93 	$(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
    99 	$(RM) $@ $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
    94 	$(JMOD) create \
   100 	$(JMOD) create \
    95             --module-version $(VERSION_SHORT) \
   101             --module-version $(VERSION_SHORT) \
    96             --os-name $(REQUIRED_OS_NAME) \
   102             --os-name $(REQUIRED_OS_NAME) \
    97             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
   103             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
    98             --os-version $(REQUIRED_OS_VERSION) \
   104             --os-version $(REQUIRED_OS_VERSION) \
    99 	        --modulepath $(IMAGES_OUTPUTDIR)/jmods\
   105 	        --modulepath $(JMODS_DIR) \
   100             --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
   106             --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
   101 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
   107 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
   102 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
   108 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
   103 
   109 
   104 TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod
   110 TARGETS += $(IMAGES_OUTPUTDIR)/jmods/$(MODULE).jmod