Jprt.gmk revision 2374:723f30acba32
1#
2# Copyright (c) 2012, 2016, 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_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
43endif
44
45# When running in JPRT these will be provided. Need defaults so that this makefile
46# is valid anyway.
47ifndef JPRT_ARCHIVE_BUNDLE
48  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip
49endif
50ifndef JPRT_ARCHIVE_TEST_BUNDLE
51  JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
52endif
53ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE
54  JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip
55endif
56
57ifeq ($(SKIP_BOOT_CYCLE), false)
58  jprt_bundle: bootcycle-images
59endif
60
61################################################################################
62# JPRT specific bundling targets
63JPRT_TARGET ?= $(DEFAULT_MAKE_TARGET)
64ifeq ($(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) && $(ZIPEXE) -y -q -r $@ .
75
76  $(JPRT_ARCHIVE_TEST_BUNDLE): test-image
77	$(call MakeDir, $(@D))
78	$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ .
79
80  ##############################################################################
81  # Optional symbols bundle
82  ifeq ($(GCOV_ENABLED), true)
83    jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
84
85    $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
86	$(call MakeDir, $(@D))
87	$(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIPEXE) -y -q -r $@ .
88
89  endif
90
91  ##############################################################################
92
93else
94  # Just fake the main bundle to satisfy JPRT
95  jprt_bundle: $(JPRT_TARGET)
96	@$(call TargetEnter)
97	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
98	$(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
99	    $(JPRT_ARCHIVE_BUNDLE)
100	@$(call TargetExit)
101endif
102
103ALL_TARGETS += jprt_bundle
104
105################################################################################
106
107$(eval $(call IncludeCustomExtension, , Jprt.gmk))
108