make/Jprt.gmk
author lana
Fri, 19 May 2017 04:18:25 +0000
changeset 45171 44927fb4cd60
parent 42506 54b0b4fffab5
child 47253 92fd0e04e0e1
permissions -rw-r--r--
Merge

#
# Copyright (c) 2012, 2016, 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) && $(ZIPEXE) -y -q -r $@ .

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

  ##############################################################################
  # Optional symbols bundle
  ifeq ($(GCOV_ENABLED), true)
    jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)

    $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
	$(call MakeDir, $(@D))
	$(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIPEXE) -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))