Jprt.gmk revision 1275:394de05938d7
1#
2# Copyright (c) 2012, 2013, 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
29ifneq ($(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_INSTALL_BUNDLE
36    override JPRT_ARCHIVE_INSTALL_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
37  endif
38  ifdef JPRT_ARCHIVE_TEST_BUNDLE
39    override JPRT_ARCHIVE_TEST_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
40  endif
41endif
42
43# When running in JPRT these will be provided. Need defaults so that this makefile
44# is valid anyway.
45ifndef JPRT_ARCHIVE_BUNDLE
46  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
47endif
48ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
49  JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
50endif
51ifndef JPRT_ARCHIVE_TEST_BUNDLE
52  JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
53endif
54
55ifeq ($(SKIP_BOOT_CYCLE), false)
56  jprt_bundle: bootcycle-images
57endif
58
59# This target must be called in the context of a SPEC file
60jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE)
61
62# This target must be called in the context of a SPEC file
63$(JPRT_ARCHIVE_BUNDLE): bundles
64	$(MKDIR) -p $(@D)
65	$(RM) $@
66	$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
67
68$(JPRT_ARCHIVE_TEST_BUNDLE): bundles
69	$(MKDIR) -p $(@D)
70	$(RM) $@
71	$(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@
72
73SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
74SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
75SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
76SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
77SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
78
79# Bundle up the images
80bundles: all
81	@$(call TargetEnter)
82	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
83	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
84	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
85	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
86	if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
87	  $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
88	fi
89	@$(call TargetExit)
90
91# Copy images to one unified location regardless of platform etc.
92final-images: all
93	@$(call TargetEnter)
94	$(RM) -r $(BUILD_OUTPUT)/final-images
95	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
96	$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)
97	$(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/
98	$(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/
99        ifeq ($(OPENJDK_TARGET_OS),macosx)
100	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)
101	  $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)
102	  $(CP) -R -P $(SRC_JDK_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)/
103	  $(CP) -R -P $(SRC_JRE_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)/
104        endif
105	@$(call TargetExit)
106
107
108###########################################################################
109# Phony targets
110.PHONY: jprt_bundle bundles final-images
111