make/Jprt.gmk
author ccheung
Tue, 07 Jun 2016 00:06:17 +0000
changeset 39211 8e8b396a42e9
parent 37972 e1fa5c2e62a0
child 41458 f285e333e8db
permissions -rw-r--r--
Merge

#
# 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_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_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

################################################################################
# JPRT specific bundling targets
JPRT_TARGET ?= $(DEFAULT_MAKE_TARGET)
ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET))
  jprt_bundle: $(DEFAULT_MAKE_TARGET) $(JPRT_ARCHIVE_BUNDLE) \
      $(JPRT_ARCHIVE_TEST_BUNDLE)

  SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
  SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)

  # This target must be called in the context of a SPEC file
  $(JPRT_ARCHIVE_BUNDLE): product-images
	$(call MakeDir, $(@D))
	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $@ .

  $(JPRT_ARCHIVE_TEST_BUNDLE): test-image
	$(call MakeDir, $(@D))
	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $@ .

  ##############################################################################
  # Optional symbols bundle
  ifeq ($(GCOV_ENABLED), true)
    jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
    zip-bundles: $(SYMBOLS_ZIP_BUNDLE)

    $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
	$(call MakeDir, $(@D))
	$(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r $@ .

  endif

  ##############################################################################

else
  # Just fake the main bundle to satisfy JPRT
  jprt_bundle: $(JPRT_TARGET)
	@$(call TargetEnter)
	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
	$(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
	    $(JPRT_ARCHIVE_BUNDLE)
	@$(call TargetExit)
endif

ALL_TARGETS += jprt_bundle

################################################################################

$(eval $(call IncludeCustomExtension, , Jprt.gmk))