Jprt.gmk revision 1961:f900d5afd9c8
11573Srgrimes#
21573Srgrimes# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
31573Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41573Srgrimes#
51573Srgrimes# This code is free software; you can redistribute it and/or modify it
61573Srgrimes# under the terms of the GNU General Public License version 2 only, as
71573Srgrimes# published by the Free Software Foundation.  Oracle designates this
81573Srgrimes# particular file as subject to the "Classpath" exception as provided
91573Srgrimes# by Oracle in the LICENSE file that accompanied this code.
101573Srgrimes#
111573Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT
121573Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131573Srgrimes# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141573Srgrimes# version 2 for more details (a copy is included in the LICENSE file that
151573Srgrimes# accompanied this code).
161573Srgrimes#
171573Srgrimes# You should have received a copy of the GNU General Public License version
181573Srgrimes# 2 along with this work; if not, write to the Free Software Foundation,
191573Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201573Srgrimes#
211573Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221573Srgrimes# or visit www.oracle.com if you need additional information or have any
231573Srgrimes# questions.
241573Srgrimes#
251573Srgrimes
261573Srgrimes# This file contains targets and utilities needed by JPRT.
271573Srgrimes
281573Srgrimes# Cygpath is only defined when running on Cygwin
291573Srgrimesifneq ($(CYGPATH), )
301573Srgrimes  # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive
311573Srgrimes  # style paths
321573Srgrimes  ifdef JPRT_ARCHIVE_BUNDLE
331573Srgrimes    override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
34176449Sdas  endif
3592887Sobrien  ifdef JPRT_ARCHIVE_INSTALL_BUNDLE
3692887Sobrien    override JPRT_ARCHIVE_INSTALL_BUNDLE := \
371573Srgrimes        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
3892887Sobrien  endif
391573Srgrimes  ifdef JPRT_ARCHIVE_MODULES_BUNDLE
401573Srgrimes    override JPRT_ARCHIVE_MODULES_BUNDLE := \
411573Srgrimes        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_MODULES_BUNDLE))
428870Srgrimes  endif
431573Srgrimes  ifdef JPRT_ARCHIVE_TEST_BUNDLE
441573Srgrimes    override JPRT_ARCHIVE_TEST_BUNDLE := \
451573Srgrimes        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
468870Srgrimes  endif
478870Srgrimes  ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE
481573Srgrimes    override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \
491573Srgrimes        $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE))
501573Srgrimes  endif
518870Srgrimesendif
521573Srgrimes
538870Srgrimes# When running in JPRT these will be provided. Need defaults so that this makefile
541573Srgrimes# is valid anyway.
551573Srgrimesifndef JPRT_ARCHIVE_BUNDLE
568870Srgrimes  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip
571573Srgrimesendif
581573Srgrimesifndef JPRT_ARCHIVE_INSTALL_BUNDLE
591573Srgrimes  JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
601573Srgrimesendif
611573Srgrimesifndef JPRT_ARCHIVE_MODULES_BUNDLE
621573Srgrimes  JPRT_ARCHIVE_MODULES_BUNDLE=/tmp/jprt_bundles/modules.zip
631573Srgrimesendif
641573Srgrimesifndef JPRT_ARCHIVE_TEST_BUNDLE
651573Srgrimes  JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
661573Srgrimesendif
671573Srgrimesifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
681573Srgrimes  JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
691573Srgrimesendif
701573Srgrimes
711573Srgrimesifeq ($(SKIP_BOOT_CYCLE), false)
721573Srgrimes  jprt_bundle: bootcycle-images
731573Srgrimesendif
741573Srgrimes
751573Srgrimes# This target must be called in the context of a SPEC file
761573Srgrimesjprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE) \
77129312Sdas    $(JPRT_ARCHIVE_MODULES_BUNDLE)
78129312Sdas
79129312Sdasifeq ($(GCOV_ENABLED), true)
80129312Sdas  jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
81129312Sdasendif
82129312Sdas
83129312Sdas# This target must be called in the context of a SPEC file
84129312Sdas$(JPRT_ARCHIVE_BUNDLE): bundles
85129312Sdas	$(MKDIR) -p $(@D)
86129312Sdas	$(RM) $@
871573Srgrimes	$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
8893211Sbde
891573Srgrimes$(JPRT_ARCHIVE_MODULES_BUNDLE): bundles
901573Srgrimes	$(MKDIR) -p $(@D)
911573Srgrimes	$(RM) $@
921573Srgrimes	$(CP) $(BUILD_OUTPUT)/bundles/modules.zip $@
931573Srgrimes
941573Srgrimes$(JPRT_ARCHIVE_TEST_BUNDLE): bundles
951573Srgrimes	$(MKDIR) -p $(@D)
961573Srgrimes	$(RM) $@
971573Srgrimes	$(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@
981573Srgrimes
991573Srgrimes$(JPRT_ARCHIVE_SYMBOLS_BUNDLE): bundles
1001573Srgrimes	$(MKDIR) -p $(@D)
1011573Srgrimes	$(RM) $@
1021573Srgrimes	$(CP) $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip $@
1031573Srgrimes
1041573SrgrimesSRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
1051573SrgrimesSRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
1061573SrgrimesSRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
1071573SrgrimesSRC_JDK_MACOSX_BUNDLE_DIR := $(JDK_MACOSX_BUNDLE_DIR)
1081573SrgrimesSRC_JRE_MACOSX_BUNDLE_DIR := $(JRE_MACOSX_BUNDLE_DIR)
1091573Srgrimes
1101573Srgrimes# Bundle up the images
1111573Srgrimesbundles: all
1121573Srgrimes	@$(call TargetEnter)
1131573Srgrimes	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
1141573Srgrimes	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r \
1151573Srgrimes	    $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
1161573Srgrimes	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r \
1171573Srgrimes	    $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
1188870Srgrimes	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \
1191573Srgrimes	    $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
1201573Srgrimes	$(CD) $(IMAGES_OUTPUTDIR)/jmods && $(ZIP) -y -q -r \
1211573Srgrimes	    $(BUILD_OUTPUT)/bundles/modules.zip .
1221573Srgrimes	if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
1231573Srgrimes	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \
1241573Srgrimes	      $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
1251573Srgrimes	fi
1261573Srgrimes	if [ -d $(SYMBOLS_IMAGE_DIR) ] ; then \
1278870Srgrimes	  $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r \
1281573Srgrimes	      $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip . ; \
1291573Srgrimes	fi
1301573Srgrimes	@$(call TargetExit)
13193211Sbde
1321573Srgrimes# Copy images to one unified location regardless of platform etc.
1331573Srgrimesfinal-images: all
1341573Srgrimes	@$(call TargetEnter)
1351573Srgrimes	$(RM) -r $(BUILD_OUTPUT)/final-images
1361573Srgrimes	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
1371573Srgrimes	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)
138138924Sdas	$(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/
1391573Srgrimes	$(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/
1401573Srgrimes        ifeq ($(OPENJDK_TARGET_OS),macosx)
141138924Sdas	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)
142138924Sdas	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)
1431573Srgrimes	  $(CP) -R -P $(SRC_JDK_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)/
1441573Srgrimes	  $(CP) -R -P $(SRC_JRE_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)/
1451573Srgrimes        endif
1461573Srgrimes	@$(call TargetExit)
1471573Srgrimes
1481573SrgrimesALL_TARGETS += jprt_bundle bundles final-images
1491573Srgrimes