1 #
   2 # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   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
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 # This file contains targets and utilities needed by JPRT.
  27 
  28 # Cygpath is only defined when running on Cygwin
  29 ifneq ($(CYGPATH), )
  30   # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive
  31   # style paths
  32   ifdef JPRT_ARCHIVE_BUNDLE
  33     override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
  34   endif
  35   ifdef JPRT_ARCHIVE_TEST_BUNDLE
  36     override JPRT_ARCHIVE_TEST_BUNDLE := \
  37         $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
  38   endif
  39   ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE
  40     override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \
  41         $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE))
  42   endif
  43 endif
  44 
  45 # When running in JPRT these will be provided. Need defaults so that this makefile
  46 # is valid anyway.
  47 ifndef JPRT_ARCHIVE_BUNDLE
  48   JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip
  49 endif
  50 ifndef JPRT_ARCHIVE_TEST_BUNDLE
  51   JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
  52 endif
  53 ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
  54   JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
  55 endif
  56 
  57 ifeq ($(SKIP_BOOT_CYCLE), false)
  58   jprt_bundle: bootcycle-images
  59 endif
  60 
  61 ################################################################################
  62 # JPRT specific bundling targets
  63 JPRT_TARGET ?= $(DEFAULT_MAKE_TARGET)
  64 ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET))
  65   jprt_bundle: $(DEFAULT_MAKE_TARGET) $(JPRT_ARCHIVE_BUNDLE) \
  66       $(JPRT_ARCHIVE_TEST_BUNDLE)
  67 
  68   SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
  69   SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
  70 
  71   # This target must be called in the context of a SPEC file
  72   $(JPRT_ARCHIVE_BUNDLE): product-images
  73         $(call MakeDir, $(@D))
  74         $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $@ .
  75 
  76   $(JPRT_ARCHIVE_TEST_BUNDLE): test-image
  77         $(call MakeDir, $(@D))
  78         $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $@ .
  79 
  80   ##############################################################################
  81   # Optional symbols bundle
  82   ifeq ($(GCOV_ENABLED), true)
  83     jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
  84     zip-bundles: $(SYMBOLS_ZIP_BUNDLE)
  85 
  86     $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
  87         $(call MakeDir, $(@D))
  88         $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r $@ .
  89 
  90   endif
  91 
  92   ##############################################################################
  93 
  94 else
  95   # Just fake the main bundle to satisfy JPRT
  96   jprt_bundle: $(JPRT_TARGET)
  97         @$(call TargetEnter)
  98         $(MKDIR) -p $(BUILD_OUTPUT)/bundles
  99         $(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
 100             $(JPRT_ARCHIVE_BUNDLE)
 101         @$(call TargetExit)
 102 endif
 103 
 104 ALL_TARGETS += jprt_bundle
 105 
 106 ################################################################################
 107 
 108 $(eval $(call IncludeCustomExtension, , Jprt.gmk))