make/Jprt.gmk

changeset 0
75a576e87639
child 1133
50aaf272884f
equal deleted inserted replaced
-1:000000000000 0:75a576e87639
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 is included by the root NewerMakefile and contains targets
27 # and utilities needed by JPRT.
28
29 # Utilities used in this Makefile. Most of this makefile executes without
30 # the context of a spec file from configure.
31 CAT=cat
32 CMP=cmp
33 CP=cp
34 ECHO=echo
35 MKDIR=mkdir
36 PRINTF=printf
37 PWD=pwd
38 # Insure we have a path that looks like it came from pwd
39 # (This is mostly for Windows sake and drive letters)
40 define UnixPath # path
41 $(shell (cd "$1" && $(PWD)))
42 endef
43
44 BUILD_DIR_ROOT:=$(root_dir)/build
45
46 ifdef OPENJDK
47 OPEN_BUILD=true
48 else
49 OPEN_BUILD := $(if $(or $(wildcard $(root_dir)/jdk/src/closed), \
50 $(wildcard $(root_dir)/jdk/make/closed), \
51 $(wildcard $(root_dir)/jdk/test/closed), \
52 $(wildcard $(root_dir)/hotspot/src/closed), \
53 $(wildcard $(root_dir)/hotspot/make/closed), \
54 $(wildcard $(root_dir)/hotspot/test/closed)), \
55 false,true)
56 endif
57
58 HOTSPOT_AVAILABLE := $(if $(wildcard $(root_dir)/hotspot),true,false)
59
60 ###########################################################################
61 # To help in adoption of the new configure&&make build process, a bridge
62 # build will use the old settings to run configure and do the build.
63
64 # Build with the configure bridge. After running configure, restart make
65 # to parse the new spec file.
66 BRIDGE_TARGETS := all
67 # Add bootcycle-images target if legacy variable is set.
68 ifeq ($(SKIP_BOOT_CYCLE),false)
69 BRIDGE_TARGETS += bootcycle-images
70 endif
71 bridgeBuild: bridge2configure
72 @cd $(root_dir) && $(MAKE) -f Makefile $(BRIDGE_TARGETS)
73
74 # Bridge from old Makefile ALT settings to configure options
75 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
76 bash ./configure $(strip $(shell $(CAT) $<))
77
78 # Create a file with configure options created from old Makefile mechanisms.
79 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
80 $(RM) $@
81 $(CP) $< $@
82
83 # Use this file to only change when obvious things have changed
84 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
85 $(RM) $@.tmp
86 $(MKDIR) -p $(BUILD_DIR_ROOT)
87 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
88 ifdef ARCH_DATA_MODEL
89 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
90 endif
91 ifeq ($(ARCH_DATA_MODEL),32)
92 @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
93 endif
94 ifdef ALT_PARALLEL_COMPILE_JOBS
95 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
96 endif
97 ifdef ALT_BOOTDIR
98 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
99 endif
100 ifdef ALT_CUPS_HEADERS_PATH
101 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
102 endif
103 ifdef ALT_FREETYPE_HEADERS_PATH
104 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
105 endif
106 ifdef ENABLE_SJAVAC
107 @$(ECHO) " --enable-sjavac" >> $@.tmp
108 endif
109 ifdef JDK_UPDATE_VERSION
110 @$(ECHO) " --with-update-version=$(JDK_UPDATE_VERSION)" >> $@.tmp
111 endif
112 ifeq ($(HOTSPOT_AVAILABLE),false)
113 ifdef ALT_JDK_IMPORT_PATH
114 @$(ECHO) " --with-import-hotspot=$(call UnixPath,$(ALT_JDK_IMPORT_PATH)) " >> $@.tmp
115 endif
116 endif
117 ifeq ($(OPEN_BUILD),true)
118 @$(ECHO) " --enable-openjdk-only " >> $@.tmp
119 else
120 # Todo: move to closed?
121 ifdef ALT_MOZILLA_HEADERS_PATH
122 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
123 endif
124 ifdef ALT_JUNIT_DIR
125 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
126 endif
127 ifdef ANT_HOME
128 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
129 endif
130 ifdef ALT_JAVAFX_ZIP_DIR
131 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
132 endif
133 ifdef ALT_JMC_ZIP_DIR
134 @$(ECHO) " --with-jmc-zip-dir=$(call UnixPath,$(ALT_JMC_ZIP_DIR)) " >> $@.tmp
135 endif
136 ifdef ALT_WIXDIR
137 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
138 endif
139 ifdef ALT_INSTALL_LZMA_PATH
140 @$(ECHO) " --with-lzma-path=$(call UnixPath,$(ALT_INSTALL_LZMA_PATH)) " >> $@.tmp
141 endif
142 ifdef ALT_INSTALL_UPX_PATH
143 @$(ECHO) " --with-upx-path=$(call UnixPath,$(ALT_INSTALL_UPX_PATH)) " >> $@.tmp
144 endif
145 ifdef ALT_INSTALL_UPX_FILENAME
146 @$(ECHO) " --with-upx-filename=$(call UnixPath,$(ALT_INSTALL_UPX_FILENAME)) " >> $@.tmp
147 endif
148 ifdef ALT_BSDIFF_DIR
149 @$(ECHO) " --with-bsdiff-dir=$(call UnixPath,$(ALT_BSDIFF_DIR)) " >> $@.tmp
150 endif
151 ifdef ALT_CCSS_SIGNING_DIR
152 @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
153 endif
154 ifdef ALT_SLASH_JAVA
155 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
156 endif
157 ifdef ALT_SPARKLE_FRAMEWORK_DIR
158 @$(ECHO) " --with-sparkle-framework=$(call UnixPath,$(ALT_SPARKLE_FRAMEWORK_DIR)) " >> $@.tmp
159 endif
160 endif
161 @if [ -f $@ ] ; then \
162 if ! $(CMP) $@ $@.tmp > /dev/null ; then \
163 $(CP) $@.tmp $@ ; \
164 fi ; \
165 else \
166 $(CP) $@.tmp $@ ; \
167 fi
168 $(RM) $@.tmp
169
170 PHONY_LIST += bridge2configure bridgeBuild
171
172 ###########################################################################
173 # JPRT targets
174
175 ifndef JPRT_ARCHIVE_BUNDLE
176 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
177 endif
178 ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
179 JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
180 endif
181
182 # These targets execute in a SPEC free context, before calling bridgeBuild
183 # to generate the SPEC.
184 jprt_build_product: DEBUG_LEVEL=release
185 jprt_build_product: BUILD_DIRNAME=*-release
186 jprt_build_product: jprt_build_generic
187
188 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
189 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
190 jprt_build_fastdebug: jprt_build_generic
191
192 jprt_build_debug: DEBUG_LEVEL=slowdebug
193 jprt_build_debug: BUILD_DIRNAME=*-debug
194 jprt_build_debug: jprt_build_generic
195
196 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
197 jprt_build_generic: bridgeBuild
198
199 # This target must be called in the context of a SPEC file
200 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
201 @$(call CheckIfMakeAtEnd)
202
203 # This target must be called in the context of a SPEC file
204 $(JPRT_ARCHIVE_BUNDLE): bundles
205 $(MKDIR) -p $(@D)
206 $(RM) $@
207 $(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
208
209 SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
210 SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
211 SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
212 SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
213
214 # Bundle up the images
215 bundles: all bundles-only
216 bundles-only: start-make
217 @$(call TargetEnter)
218 $(MKDIR) -p $(BUILD_OUTPUT)/bundles
219 $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
220 $(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
221 if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
222 $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
223 fi
224 @$(call TargetExit)
225
226 # Copy images to one unified location regardless of platform etc.
227 final-images: all final-images-only
228 final-images-only: start-make
229 @$(call TargetEnter)
230 $(RM) -r $(BUILD_OUTPUT)/final-images
231 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
232 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)
233 $(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/
234 $(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/
235 ifeq ($(OPENJDK_TARGET_OS),macosx)
236 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)
237 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)
238 $(CP) -R -P $(SRC_JDK_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)/
239 $(CP) -R -P $(SRC_JRE_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)/
240 endif
241 @$(call TargetExit)
242
243
244 # Keep track of phony targets
245 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
246 jprt_build_generic bundles jprt_bundle \
247 final-images final-images-only
248
249 ###########################################################################
250 # Phony targets
251 .PHONY: $(PHONY_LIST)
252
253 # Force target
254 FRC:

mercurial