make/CreateJmods.gmk
changeset 53995 ecc2bcc3beb0
parent 53683 48ff68e2fe5c
child 54380 e297c7bb6469
equal deleted inserted replaced
53994:77343f5c85cb 53995:ecc2bcc3beb0
     1 # Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
     1 # Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
     2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 #
     3 #
     4 # This code is free software; you can redistribute it and/or modify it
     4 # This code is free software; you can redistribute it and/or modify it
     5 # under the terms of the GNU General Public License version 2 only, as
     5 # under the terms of the GNU General Public License version 2 only, as
     6 # published by the Free Software Foundation.  Oracle designates this
     6 # published by the Free Software Foundation.  Oracle designates this
    24 
    24 
    25 default: all
    25 default: all
    26 
    26 
    27 include $(SPEC)
    27 include $(SPEC)
    28 include MakeBase.gmk
    28 include MakeBase.gmk
       
    29 include Execute.gmk
    29 include Modules.gmk
    30 include Modules.gmk
    30 
    31 
    31 ifeq ($(MODULE), )
    32 ifeq ($(MODULE), )
    32   $(error MODULE must be set when calling CreateJmods.gmk)
    33   $(error MODULE must be set when calling CreateJmods.gmk)
    33 endif
    34 endif
    35 $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
    36 $(eval $(call IncludeCustomExtension, CreateJmods.gmk))
    36 
    37 
    37 ################################################################################
    38 ################################################################################
    38 
    39 
    39 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
    40 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
    40 JMODS_TEMPDIR := $(SUPPORT_OUTPUTDIR)/jmods
    41 JMODS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jmods
       
    42 JMOD_FILE := $(MODULE).jmod
    41 
    43 
    42 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    44 LIBS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    43     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    45     $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
    44 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    46 CMDS_DIR ?= $(firstword $(wildcard $(addsuffix /$(MODULE), \
    45     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
    47     $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
   150 
   152 
   151 # If creating interim versions of jmods, certain files need to be filtered out
   153 # If creating interim versions of jmods, certain files need to be filtered out
   152 # to avoid false incremental rebuilds.
   154 # to avoid false incremental rebuilds.
   153 ifeq ($(INTERIM_JMOD), true)
   155 ifeq ($(INTERIM_JMOD), true)
   154   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
   156   DEPS := $(filter-out $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist, $(DEPS))
       
   157   INTERIM_MSG := interim$(SPACE)
   155 endif
   158 endif
   156 
   159 
   157 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
   160 JMOD_FLAGS += --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}'
   158 
   161 
   159 # Create jmods in a temp dir and then move them into place to keep the
   162 # Create jmods in the support dir and then move them into place to keep the
   160 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   163 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
   161 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
   164 $(eval $(call SetupExecute, create_$(JMOD_FILE), \
   162 	$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
   165     WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
   163 	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
   166     DEPS := $(DEPS), \
   164 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
   167     OUTPUT_FILE := $(JMODS_DIR)/$(JMOD_FILE), \
   165 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/jmods/$(MODULE).jmod, \
   168     SUPPORT_DIR := $(JMODS_SUPPORT_DIR), \
   166 	    $(JMOD) create \
   169     PRE_COMMAND := $(RM) $(JMODS_DIR)/$(JMOD_FILE) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
   167 	        --module-version $(VERSION_SHORT) \
   170     COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
   168 	        --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
   171         --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
   169 	        --module-path $(JMODS_DIR) \
   172         --module-path $(JMODS_DIR) $(JMOD_FLAGS) \
   170 	        $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) \
   173         $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
   171 	)
   174     POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
   172 	$(MV) $(JMODS_TEMPDIR)/$(notdir $@) $@
   175 ))
   173 
   176 
   174 TARGETS += $(JMODS_DIR)/$(MODULE).jmod
   177 TARGETS += $(create_$(JMOD_FILE))
   175 
   178 
   176 ################################################################################
   179 ################################################################################
   177 
   180 
   178 all: $(TARGETS)
   181 all: $(TARGETS)
   179 
   182