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