|
1 # |
|
2 # Copyright (c) 2012, 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 # Appears to be an open build |
|
47 OPEN_BUILD := \ |
|
48 $(shell \ |
|
49 if [ -d $(root_dir)/jdk/src/closed \ |
|
50 -o -d $(root_dir)/jdk/make/closed \ |
|
51 -o -d $(root_dir)/jdk/test/closed \ |
|
52 -o -d $(root_dir)/hotspot/src/closed \ |
|
53 -o -d $(root_dir)/hotspot/make/closed \ |
|
54 -o -d $(root_dir)/hotspot/test/closed ] ; then \ |
|
55 echo "false"; \ |
|
56 else \ |
|
57 echo "true"; \ |
|
58 fi \ |
|
59 ) |
|
60 ifdef OPENJDK |
|
61 OPEN_BUILD=true |
|
62 endif |
|
63 |
|
64 ########################################################################### |
|
65 # To help in adoption of the new configure&&make build process, a bridge |
|
66 # build will use the old settings to run configure and do the build. |
|
67 |
|
68 # Build with the configure bridge. After running configure, restart make |
|
69 # to parse the new spec file. |
|
70 BRIDGE_TARGETS := all |
|
71 bridgeBuild: bridge2configure |
|
72 @cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(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 ifeq ($(OPEN_BUILD),true) |
|
107 @$(ECHO) " --enable-openjdk-only " >> $@.tmp |
|
108 else |
|
109 # Todo: move to closed? |
|
110 ifdef ALT_MOZILLA_HEADERS_PATH |
|
111 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp |
|
112 endif |
|
113 ifdef ALT_JUNIT_DIR |
|
114 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp |
|
115 endif |
|
116 ifdef ANT_HOME |
|
117 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp |
|
118 endif |
|
119 ifdef ALT_JAVAFX_ZIP_DIR |
|
120 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp |
|
121 endif |
|
122 ifdef ALT_WIXDIR |
|
123 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp |
|
124 endif |
|
125 ifdef ALT_CCSS_SIGNING_DIR |
|
126 @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp |
|
127 endif |
|
128 ifdef ALT_SLASH_JAVA |
|
129 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp |
|
130 endif |
|
131 endif |
|
132 @if [ -f $@ ] ; then \ |
|
133 if ! $(CMP) $@ $@.tmp > /dev/null ; then \ |
|
134 $(CP) $@.tmp $@ ; \ |
|
135 fi ; \ |
|
136 else \ |
|
137 $(CP) $@.tmp $@ ; \ |
|
138 fi |
|
139 $(RM) $@.tmp |
|
140 |
|
141 PHONY_LIST += bridge2configure bridgeBuild |
|
142 |
|
143 ########################################################################### |
|
144 # JPRT targets |
|
145 |
|
146 ifndef JPRT_ARCHIVE_BUNDLE |
|
147 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip |
|
148 endif |
|
149 |
|
150 # These targets execute in a SPEC free context, before calling bridgeBuild |
|
151 # to generate the SPEC. |
|
152 jprt_build_product: DEBUG_LEVEL=release |
|
153 jprt_build_product: BUILD_DIRNAME=*-release |
|
154 jprt_build_product: jprt_build_generic |
|
155 |
|
156 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug |
|
157 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug |
|
158 jprt_build_fastdebug: jprt_build_generic |
|
159 |
|
160 jprt_build_debug: DEBUG_LEVEL=slowdebug |
|
161 jprt_build_debug: BUILD_DIRNAME=*-debug |
|
162 jprt_build_debug: jprt_build_generic |
|
163 |
|
164 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle |
|
165 jprt_build_generic: bridgeBuild |
|
166 |
|
167 # This target must be called in the context of a SPEC file |
|
168 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) |
|
169 @$(call CheckIfMakeAtEnd) |
|
170 |
|
171 # This target must be called in the context of a SPEC file |
|
172 $(JPRT_ARCHIVE_BUNDLE): bundles |
|
173 $(MKDIR) -p $(@D) |
|
174 $(RM) $@ |
|
175 $(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@ |
|
176 |
|
177 # This target must be called in the context of a SPEC file |
|
178 bundles: all |
|
179 @$(call TargetEnter) |
|
180 $(MKDIR) -p $(BUILD_OUTPUT)/bundles |
|
181 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64) |
|
182 $(CD) $(JDK_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip . |
|
183 $(CD) $(JRE_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip . |
|
184 else |
|
185 $(CD) $(JDK_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip . |
|
186 $(CD) $(JRE_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip . |
|
187 endif |
|
188 @$(call TargetExit) |
|
189 |
|
190 # Keep track of phony targets |
|
191 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \ |
|
192 jprt_build_generic bundles jprt_bundle |
|
193 |
|
194 ########################################################################### |
|
195 # Phony targets |
|
196 .PHONY: $(PHONY_LIST) |
|
197 |
|
198 # Force target |
|
199 FRC: |