make/Jprt.gmk
author ascarpino
Mon, 02 May 2016 16:45:38 -0700
changeset 37726 bbecfff95ec3
parent 37402 62b5f067032e
child 37649 3809534d4531
permissions -rw-r--r--
8140422: Add mechanism to allow non default root CAs to be not subject to algorithm restrictions Reviewed-by: mullan, xuelei

#
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

# This file contains targets and utilities needed by JPRT.

# Cygpath is only defined when running on Cygwin
ifneq ($(CYGPATH), )
  # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive
  # style paths
  ifdef JPRT_ARCHIVE_BUNDLE
    override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
  endif
  ifdef JPRT_ARCHIVE_INSTALL_BUNDLE
    override JPRT_ARCHIVE_INSTALL_BUNDLE := \
        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
  endif
  ifdef JPRT_ARCHIVE_MODULES_BUNDLE
    override JPRT_ARCHIVE_MODULES_BUNDLE := \
        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_MODULES_BUNDLE))
  endif
  ifdef JPRT_ARCHIVE_TEST_BUNDLE
    override JPRT_ARCHIVE_TEST_BUNDLE := \
        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
  endif
  ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE
    override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \
        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE))
  endif
endif

# When running in JPRT these will be provided. Need defaults so that this makefile
# is valid anyway.
ifndef JPRT_ARCHIVE_BUNDLE
  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip
endif
ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
  JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
endif
ifndef JPRT_ARCHIVE_MODULES_BUNDLE
  JPRT_ARCHIVE_MODULES_BUNDLE=/tmp/jprt_bundles/modules.zip
endif
ifndef JPRT_ARCHIVE_TEST_BUNDLE
  JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
endif
ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
  JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
endif

ifeq ($(SKIP_BOOT_CYCLE), false)
  jprt_bundle: bootcycle-images
endif

# This target must be called in the context of a SPEC file
jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE) \
    $(JPRT_ARCHIVE_MODULES_BUNDLE)

ifeq ($(GCOV_ENABLED), true)
  jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
endif

# This target must be called in the context of a SPEC file
$(JPRT_ARCHIVE_BUNDLE): bundles
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@

$(JPRT_ARCHIVE_MODULES_BUNDLE): bundles
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(BUILD_OUTPUT)/bundles/modules.zip $@

$(JPRT_ARCHIVE_TEST_BUNDLE): bundles
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@

$(JPRT_ARCHIVE_SYMBOLS_BUNDLE): bundles
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip $@

SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
SRC_JDK_MACOSX_BUNDLE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
SRC_JRE_MACOSX_BUNDLE_DIR := $(JRE_MACOSX_BUNDLE_DIR)

# Bundle up the images
JPRT_TARGET ?= all
ifeq ($(JPRT_TARGET), all)
  bundles: $(JPRT_TARGET)
	@$(call TargetEnter)
	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
	$(CD) $(IMAGES_OUTPUTDIR)/jmods && $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/modules.zip .
	if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \
	      $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
	fi
	if [ -d $(SYMBOLS_IMAGE_DIR) ] ; then \
	  $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r \
	      $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip . ; \
	fi
	@$(call TargetExit)
else
  # Just fake the bundles
  bundles: $(JPRT_TARGET)
	@$(call TargetEnter)
	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
	$(CD) $(TOPDIR) &&  $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip README
	$(CD) $(TOPDIR) &&  $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip README
	$(CD) $(TOPDIR) &&  $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip README
	$(CD) $(TOPDIR) &&  $(ZIP) -y -q -r \
	    $(BUILD_OUTPUT)/bundles/modules.zip README
	@$(call TargetExit)
endif

# Copy images to one unified location regardless of platform etc.
final-images: $(JPRT_TARGET)
	@$(call TargetEnter)
	$(RM) -r $(BUILD_OUTPUT)/final-images
	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)
	$(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/
	$(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/
        ifeq ($(OPENJDK_TARGET_OS),macosx)
	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)
	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)
	  $(CP) -R -P $(SRC_JDK_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)/
	  $(CP) -R -P $(SRC_JRE_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)/
        endif
	@$(call TargetExit)

ALL_TARGETS += jprt_bundle bundles final-images