Thu, 04 Apr 2019 17:56:29 +0800
Merge
1 #
2 # Copyright (c) 2006, 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.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
23 #
25 #
26 # This file has been modified by Loongson Technology in 2018. These
27 # modifications are Copyright (c) 2015 Loongson Technology, and are made
28 # available on the same license terms set forth above.
29 #
31 # The common definitions for hotspot builds.
33 # Optionally include SPEC file generated by configure.
34 ifneq ($(SPEC),)
35 include $(SPEC)
36 endif
38 # Directory paths and user name
39 # Unless GAMMADIR is set on the command line, search upward from
40 # the current directory for a parent directory containing "src/share/vm".
41 # If that fails, look for $GAMMADIR in the environment.
42 # When the tree of subdirs is built, this setting is stored in each flags.make.
43 GAMMADIR := $(shell until ([ -d dev ]&&echo $${GAMMADIR:-/GAMMADIR/}) || ([ -d src/share/vm ]&&pwd); do cd ..; done)
44 HS_SRC_DIR=$(GAMMADIR)/src
45 HS_MAKE_DIR=$(GAMMADIR)/make
46 HS_BUILD_DIR=$(GAMMADIR)/build
48 ifeq ($(USER),)
49 USER=$(USERNAME)
50 endif
52 ifeq ($(HS_ALT_MAKE),)
53 ifneq ($(OPENJDK),true)
54 HS_ALT_MAKE=$(GAMMADIR)/make/closed
55 else
56 HS_ALT_MAKE=NO_SUCH_PATH
57 endif
58 endif
60 #
61 # Include alternate defs.make if it exists
62 #
63 -include $(HS_ALT_MAKE)/defs.make
65 # Default to verbose build logs (show all compile lines):
66 MAKE_VERBOSE=y
68 # Make macros for install files or preparing targets
69 CD=cd
70 CP=cp
71 ECHO=echo
72 GREP=grep
73 MKDIR=mkdir
74 MV=mv
75 PWD=pwd
76 RM=rm -f
77 SED=sed
78 TAR=tar
79 ZIPEXE=zip
81 define install-file
82 @$(MKDIR) -p $(@D)
83 @$(RM) $@
84 $(CP) $< $@
85 endef
87 # MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead.
88 # May need to have a MacOS X specific definition of install-dir
89 # sometime in the future.
90 define install-dir
91 @$(MKDIR) -p $(@D)
92 @$(RM) -r $@
93 $(CP) -r $< $@
94 endef
96 define prep-target
97 @$(MKDIR) -p $(@D)
98 @$(RM) $@
99 endef
101 # Default values for JVM_VARIANT* variables if configure hasn't set
102 # it already.
103 ifeq ($(JVM_VARIANTS),)
104 ifeq ($(ZERO_BUILD), true)
105 ifeq ($(SHARK_BUILD), true)
106 JVM_VARIANTS:=zeroshark
107 JVM_VARIANT_ZEROSHARK:=true
108 else
109 JVM_VARIANTS:=zero
110 JVM_VARIANT_ZERO:=true
111 endif
112 else
113 # A default is needed
114 ifeq ($(BUILD_CLIENT_ONLY), true)
115 JVM_VARIANTS:=client
116 JVM_VARIANT_CLIENT:=true
117 endif
118 # Further defaults are platform and arch specific
119 endif
120 endif
122 # hotspot version definitions
123 include $(GAMMADIR)/make/hotspot_version
125 # When config parameter --with-update-version is defined,
126 # Hotspot minor version should be set to that
127 ifneq ($(JDK_UPDATE_VERSION),)
128 HS_MINOR_VER=$(JDK_UPDATE_VERSION)
129 endif
131 # When config parameter --with-build-number is defined,
132 # Hotspot build number should be set to that
133 ifneq ($(JDK_BUILD_NUMBER),)
134 HS_BUILD_NUMBER=$(subst b,,$(JDK_BUILD_NUMBER))
135 endif
137 # Java versions needed
138 ifeq ($(PREVIOUS_JDK_VERSION),)
139 PREVIOUS_JDK_VERSION=$(JDK_PREVIOUS_VERSION)
140 endif
141 ifeq ($(JDK_MAJOR_VERSION),)
142 JDK_MAJOR_VERSION=$(JDK_MAJOR_VER)
143 endif
144 ifeq ($(JDK_MINOR_VERSION),)
145 JDK_MINOR_VERSION=$(JDK_MINOR_VER)
146 endif
147 ifeq ($(JDK_MICRO_VERSION),)
148 JDK_MICRO_VERSION=$(JDK_MICRO_VER)
149 endif
150 ifeq ($(JDK_MKTG_VERSION),)
151 JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
152 endif
153 ifeq ($(JDK_VERSION),)
154 JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
155 endif
156 ifeq ($(FULL_VERSION),)
157 FULL_VERSION="$(JDK_VERSION)"
158 endif
160 # FULL_VERSION is only used to define JRE_RELEASE_VERSION which is used
161 # as JRE version in VM -Xinternalversion output.
162 ifndef JRE_RELEASE_VERSION
163 JRE_RELEASE_VERSION=$(FULL_VERSION)
164 endif
166 ifndef HOTSPOT_RELEASE_VERSION
167 HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
168 endif
170 ifdef HOTSPOT_BUILD_VERSION
171 # specified in command line
172 else
173 ifdef COOKED_BUILD_NUMBER
174 # JRE build
175 HOTSPOT_BUILD_VERSION=
176 else
177 ifdef USER_RELEASE_SUFFIX
178 HOTSPOT_BUILD_VERSION=internal-$(USER_RELEASE_SUFFIX)
179 else
180 HOTSPOT_BUILD_VERSION=internal
181 endif
182 endif
183 endif
185 # Windows should have OS predefined
186 ifeq ($(OS),)
187 OS := $(shell uname -s)
188 ifneq ($(findstring BSD,$(OS)),)
189 OS=bsd
190 endif
191 ifeq ($(OS), Darwin)
192 OS=bsd
193 endif
194 HOST := $(shell uname -n)
195 endif
197 # If not SunOS, not Linux not BSD and not AIX, assume Windows
198 ifneq ($(OS), Linux)
199 ifneq ($(OS), SunOS)
200 ifneq ($(OS), bsd)
201 ifneq ($(OS), AIX)
202 OSNAME=windows
203 else
204 OSNAME=aix
205 endif
206 else
207 OSNAME=bsd
208 endif
209 else
210 OSNAME=solaris
211 endif
212 else
213 OSNAME=linux
214 endif
216 # Determinations of default make arguments and platform specific settings
217 MAKE_ARGS=
219 # ARCH_DATA_MODEL==64 is equivalent to LP64=1
220 ifeq ($(ARCH_DATA_MODEL), 64)
221 ifndef LP64
222 LP64 := 1
223 endif
224 endif
226 # Defaults set for product build
227 EXPORT_SUBDIR=
229 # Change default /java path if requested
230 ifneq ($(ALT_SLASH_JAVA),)
231 SLASH_JAVA=$(ALT_SLASH_JAVA)
232 endif
234 # Default OUTPUTDIR
235 OUTPUTDIR=$(HS_BUILD_DIR)/$(OSNAME)
236 ifneq ($(ALT_OUTPUTDIR),)
237 OUTPUTDIR=$(ALT_OUTPUTDIR)
238 endif
240 # Find latest promoted JDK area
241 JDK_IMPORT_PATH=$(SLASH_JAVA)/re/j2se/$(JDK_VERSION)/promoted/latest/binaries/$(PLATFORM)
242 ifneq ($(ALT_JDK_IMPORT_PATH),)
243 JDK_IMPORT_PATH=$(ALT_JDK_IMPORT_PATH)
244 endif
246 # Other parts of JDK build may require an import JDK that can be executed
247 # on the build host. For cross-compile builds we also need an import JDK
248 # that matches the target arch, so for that we set ALT_JDK_TARGET_IMPORT_PATH
249 ifneq ($(ALT_JDK_TARGET_IMPORT_PATH),)
250 JDK_IMPORT_PATH=$(ALT_JDK_TARGET_IMPORT_PATH)
251 endif
253 # Find JDK used for javac compiles
254 BOOTDIR=$(SLASH_JAVA)/re/j2se/$(PREVIOUS_JDK_VERSION)/latest/binaries/$(PLATFORM)
255 ifneq ($(ALT_BOOTDIR),)
256 BOOTDIR=$(ALT_BOOTDIR)
257 endif
259 # Select name of the export directory and honor ALT overrides
260 EXPORT_PATH=$(OUTPUTDIR)/export-$(PLATFORM)$(EXPORT_SUBDIR)
261 ifneq ($(ALT_EXPORT_PATH),)
262 EXPORT_PATH=$(ALT_EXPORT_PATH)
263 endif
265 # Default jdk image if one is created for you with create_jdk
266 JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-$(PLATFORM)
267 ifneq ($(ALT_JDK_IMAGE_DIR),)
268 JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
269 endif
271 # The platform dependent defs.make defines platform specific variable such
272 # as ARCH, EXPORT_LIST etc. We must place the include here after BOOTDIR is defined.
273 include $(GAMMADIR)/make/$(OSNAME)/makefiles/defs.make
275 # We are trying to put platform specific defintions
276 # files to make/$(OSNAME)/makefiles dictory. However
277 # some definitions are common for both linux and solaris,
278 # so we put them here.
279 ifneq ($(OSNAME),windows)
280 ABS_OUTPUTDIR := $(shell mkdir -p $(OUTPUTDIR); $(CD) $(OUTPUTDIR); $(PWD))
281 ABS_BOOTDIR := $(shell $(CD) $(BOOTDIR); $(PWD))
282 ABS_GAMMADIR := $(shell $(CD) $(GAMMADIR); $(PWD))
283 ABS_OS_MAKEFILE := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME); $(PWD))/Makefile
285 # uname, HotSpot source directory, build directory and JDK use different names
286 # for CPU architectures.
287 # ARCH - uname output
288 # SRCARCH - where to find HotSpot cpu and os_cpu source files
289 # BUILDARCH - build directory
290 # LIBARCH - directory name in JDK/JRE
292 # Use uname output for SRCARCH, but deal with platform differences. If ARCH
293 # is not explicitly listed below, it is treated as x86.
294 SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 ppc64le mips64 zero,$(ARCH)))
295 ARCH/ = x86
296 ARCH/sparc = sparc
297 ARCH/sparc64= sparc
298 ARCH/ia64 = ia64
299 ARCH/amd64 = x86
300 ARCH/x86_64 = x86
301 ARCH/ppc64 = ppc
302 ARCH/ppc64le= ppc
303 ARCH/ppc = ppc
304 ARCH/mips64 = mips
305 ARCH/mips64el = mips
306 ARCH/zero = zero
308 # BUILDARCH is usually the same as SRCARCH, except for sparcv9
309 BUILDARCH ?= $(SRCARCH)
310 ifeq ($(BUILDARCH), x86)
311 ifdef LP64
312 BUILDARCH = amd64
313 else
314 BUILDARCH = i486
315 endif
316 endif
317 ifeq ($(BUILDARCH), sparc)
318 ifdef LP64
319 BUILDARCH = sparcv9
320 endif
321 endif
322 ifeq ($(BUILDARCH), ppc)
323 ifdef LP64
324 BUILDARCH = ppc64
325 endif
326 endif
327 ifeq ($(BUILDARCH), mips)
328 ifdef LP64
329 # ifeq ($(OPENJDK_TARGET_CPU_ENDIAN), little)
330 # BUILDARCH = mips64el
331 # else
332 BUILDARCH = mips64
333 # endif
334 endif
335 endif
337 # LIBARCH is 1:1 mapping from BUILDARCH, except for ARCH=ppc64le
338 ifeq ($(ARCH),ppc64le)
339 LIBARCH ?= ppc64le
340 else
341 LIBARCH ?= $(LIBARCH/$(BUILDARCH))
342 endif
343 LIBARCH ?= $(LIBARCH/$(BUILDARCH))
344 LIBARCH/i486 = i386
345 LIBARCH/amd64 = amd64
346 LIBARCH/sparc = sparc
347 LIBARCH/sparcv9 = sparcv9
348 LIBARCH/ia64 = ia64
349 LIBARCH/ppc64 = ppc64
350 LIBARCH/zero = $(ZERO_LIBARCH)
352 ifeq ($(LIBARCH), mips64)
353 ifeq ($(OPENJDK_TARGET_CPU_ENDIAN), little)
354 LIBARCH = mips64el
355 else
356 LIBARCH = mips64
357 endif
358 endif
360 LP64_ARCH += sparcv9 amd64 ia64 ppc64 mips64 mips64el zero
361 endif
363 # Required make macro settings for all platforms
364 MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
365 MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
366 MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
367 MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
368 MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
369 MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
371 # Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile
372 # to overwrite the default definition since OS specific Makefile also
373 # includes this make/defs.make file.
374 MAKE_ARGS += HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION)
376 # Various export sub directories
377 EXPORT_INCLUDE_DIR = $(EXPORT_PATH)/include
378 EXPORT_DOCS_DIR = $(EXPORT_PATH)/docs
379 EXPORT_LIB_DIR = $(EXPORT_PATH)/lib
380 EXPORT_JRE_DIR = $(EXPORT_PATH)/jre
381 EXPORT_JRE_BIN_DIR = $(EXPORT_JRE_DIR)/bin
382 EXPORT_JRE_LIB_DIR = $(EXPORT_JRE_DIR)/lib
383 EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)/$(LIBARCH)
385 # non-universal macosx builds need to appear universal
386 ifeq ($(OS_VENDOR), Darwin)
387 ifneq ($(MACOSX_UNIVERSAL), true)
388 EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)
389 endif
390 endif
392 # Common export list of files
393 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmti.h
394 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmticmlr.h
395 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
396 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
397 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
399 .PHONY: $(HS_ALT_MAKE)/defs.make