Wed, 26 Jul 2017 15:19:03 +0800
[GC] Don't copy the null pointers.
1 #
2 # Copyright (c) 2006, 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.
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 2015. 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 # Java versions needed
126 ifeq ($(PREVIOUS_JDK_VERSION),)
127 PREVIOUS_JDK_VERSION=$(JDK_PREVIOUS_VERSION)
128 endif
129 ifeq ($(JDK_MAJOR_VERSION),)
130 JDK_MAJOR_VERSION=$(JDK_MAJOR_VER)
131 endif
132 ifeq ($(JDK_MINOR_VERSION),)
133 JDK_MINOR_VERSION=$(JDK_MINOR_VER)
134 endif
135 ifeq ($(JDK_MICRO_VERSION),)
136 JDK_MICRO_VERSION=$(JDK_MICRO_VER)
137 endif
138 ifeq ($(JDK_MKTG_VERSION),)
139 JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
140 endif
141 ifeq ($(JDK_VERSION),)
142 JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
143 endif
144 ifeq ($(FULL_VERSION),)
145 FULL_VERSION="$(JDK_VERSION)"
146 endif
148 # FULL_VERSION is only used to define JRE_RELEASE_VERSION which is used
149 # as JRE version in VM -Xinternalversion output.
150 ifndef JRE_RELEASE_VERSION
151 JRE_RELEASE_VERSION=$(FULL_VERSION)
152 endif
154 ifndef HOTSPOT_RELEASE_VERSION
155 HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
156 endif
158 ifdef HOTSPOT_BUILD_VERSION
159 # specified in command line
160 else
161 ifdef COOKED_BUILD_NUMBER
162 # JRE build
163 HOTSPOT_BUILD_VERSION=
164 else
165 ifdef USER_RELEASE_SUFFIX
166 HOTSPOT_BUILD_VERSION=internal-$(USER_RELEASE_SUFFIX)
167 else
168 HOTSPOT_BUILD_VERSION=internal
169 endif
170 endif
171 endif
173 # Windows should have OS predefined
174 ifeq ($(OS),)
175 OS := $(shell uname -s)
176 ifneq ($(findstring BSD,$(OS)),)
177 OS=bsd
178 endif
179 ifeq ($(OS), Darwin)
180 OS=bsd
181 endif
182 HOST := $(shell uname -n)
183 endif
185 # If not SunOS, not Linux not BSD and not AIX, assume Windows
186 ifneq ($(OS), Linux)
187 ifneq ($(OS), SunOS)
188 ifneq ($(OS), bsd)
189 ifneq ($(OS), AIX)
190 OSNAME=windows
191 else
192 OSNAME=aix
193 endif
194 else
195 OSNAME=bsd
196 endif
197 else
198 OSNAME=solaris
199 endif
200 else
201 OSNAME=linux
202 endif
204 # Determinations of default make arguments and platform specific settings
205 MAKE_ARGS=
207 # ARCH_DATA_MODEL==64 is equivalent to LP64=1
208 ifeq ($(ARCH_DATA_MODEL), 64)
209 ifndef LP64
210 LP64 := 1
211 endif
212 endif
214 # Defaults set for product build
215 EXPORT_SUBDIR=
217 # Change default /java path if requested
218 ifneq ($(ALT_SLASH_JAVA),)
219 SLASH_JAVA=$(ALT_SLASH_JAVA)
220 endif
222 # Default OUTPUTDIR
223 OUTPUTDIR=$(HS_BUILD_DIR)/$(OSNAME)
224 ifneq ($(ALT_OUTPUTDIR),)
225 OUTPUTDIR=$(ALT_OUTPUTDIR)
226 endif
228 # Find latest promoted JDK area
229 JDK_IMPORT_PATH=$(SLASH_JAVA)/re/j2se/$(JDK_VERSION)/promoted/latest/binaries/$(PLATFORM)
230 ifneq ($(ALT_JDK_IMPORT_PATH),)
231 JDK_IMPORT_PATH=$(ALT_JDK_IMPORT_PATH)
232 endif
234 # Other parts of JDK build may require an import JDK that can be executed
235 # on the build host. For cross-compile builds we also need an import JDK
236 # that matches the target arch, so for that we set ALT_JDK_TARGET_IMPORT_PATH
237 ifneq ($(ALT_JDK_TARGET_IMPORT_PATH),)
238 JDK_IMPORT_PATH=$(ALT_JDK_TARGET_IMPORT_PATH)
239 endif
241 # Find JDK used for javac compiles
242 BOOTDIR=$(SLASH_JAVA)/re/j2se/$(PREVIOUS_JDK_VERSION)/latest/binaries/$(PLATFORM)
243 ifneq ($(ALT_BOOTDIR),)
244 BOOTDIR=$(ALT_BOOTDIR)
245 endif
247 # Select name of the export directory and honor ALT overrides
248 EXPORT_PATH=$(OUTPUTDIR)/export-$(PLATFORM)$(EXPORT_SUBDIR)
249 ifneq ($(ALT_EXPORT_PATH),)
250 EXPORT_PATH=$(ALT_EXPORT_PATH)
251 endif
253 # Default jdk image if one is created for you with create_jdk
254 JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-$(PLATFORM)
255 ifneq ($(ALT_JDK_IMAGE_DIR),)
256 JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
257 endif
259 # The platform dependent defs.make defines platform specific variable such
260 # as ARCH, EXPORT_LIST etc. We must place the include here after BOOTDIR is defined.
261 include $(GAMMADIR)/make/$(OSNAME)/makefiles/defs.make
263 # We are trying to put platform specific defintions
264 # files to make/$(OSNAME)/makefiles dictory. However
265 # some definitions are common for both linux and solaris,
266 # so we put them here.
267 ifneq ($(OSNAME),windows)
268 ABS_OUTPUTDIR := $(shell mkdir -p $(OUTPUTDIR); $(CD) $(OUTPUTDIR); $(PWD))
269 ABS_BOOTDIR := $(shell $(CD) $(BOOTDIR); $(PWD))
270 ABS_GAMMADIR := $(shell $(CD) $(GAMMADIR); $(PWD))
271 ABS_OS_MAKEFILE := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME); $(PWD))/Makefile
273 # uname, HotSpot source directory, build directory and JDK use different names
274 # for CPU architectures.
275 # ARCH - uname output
276 # SRCARCH - where to find HotSpot cpu and os_cpu source files
277 # BUILDARCH - build directory
278 # LIBARCH - directory name in JDK/JRE
280 # Use uname output for SRCARCH, but deal with platform differences. If ARCH
281 # is not explicitly listed below, it is treated as x86.
282 SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 mips64 arm ppc ppc64 zero,$(ARCH)))
283 ARCH/ = x86
284 ARCH/sparc = sparc
285 ARCH/sparc64= sparc
286 ARCH/ia64 = ia64
287 ARCH/amd64 = x86
288 ARCH/x86_64 = x86
289 ARCH/mips64 = mips
290 ARCH/ppc64 = ppc
291 ARCH/ppc = ppc
292 ARCH/arm = arm
293 ARCH/zero = zero
295 # BUILDARCH is usually the same as SRCARCH, except for sparcv9
296 BUILDARCH = $(SRCARCH)
297 ifeq ($(BUILDARCH), x86)
298 ifdef LP64
299 BUILDARCH = amd64
300 else
301 BUILDARCH = i486
302 endif
303 endif
304 ifeq ($(BUILDARCH), sparc)
305 ifdef LP64
306 BUILDARCH = sparcv9
307 endif
308 endif
309 ifeq ($(BUILDARCH), mips)
310 BUILDARCH = mips64
311 endif
312 ifeq ($(BUILDARCH), ppc)
313 ifdef LP64
314 BUILDARCH = ppc64
315 endif
316 endif
318 # LIBARCH is 1:1 mapping from BUILDARCH
319 LIBARCH = $(LIBARCH/$(BUILDARCH))
320 LIBARCH/i486 = i386
321 LIBARCH/amd64 = amd64
322 LIBARCH/sparc = sparc
323 LIBARCH/sparcv9 = sparcv9
324 LIBARCH/ia64 = ia64
325 LIBARCH/mips64 = mips64
326 LIBARCH/ppc64 = ppc64
327 LIBARCH/ppc = ppc
328 LIBARCH/arm = arm
329 LIBARCH/zero = $(ZERO_LIBARCH)
331 LP64_ARCH = sparcv9 amd64 ia64 mips64 ppc64 zero
332 endif
334 # Required make macro settings for all platforms
335 MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
336 MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
337 MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
338 MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
339 MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
340 MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
342 # Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile
343 # to overwrite the default definition since OS specific Makefile also
344 # includes this make/defs.make file.
345 MAKE_ARGS += HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION)
347 # Various export sub directories
348 EXPORT_INCLUDE_DIR = $(EXPORT_PATH)/include
349 EXPORT_DOCS_DIR = $(EXPORT_PATH)/docs
350 EXPORT_LIB_DIR = $(EXPORT_PATH)/lib
351 EXPORT_JRE_DIR = $(EXPORT_PATH)/jre
352 EXPORT_JRE_BIN_DIR = $(EXPORT_JRE_DIR)/bin
353 EXPORT_JRE_LIB_DIR = $(EXPORT_JRE_DIR)/lib
354 EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)/$(LIBARCH)
356 # non-universal macosx builds need to appear universal
357 ifeq ($(OS_VENDOR), Darwin)
358 ifneq ($(MACOSX_UNIVERSAL), true)
359 EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)
360 endif
361 endif
363 # Common export list of files
364 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmti.h
365 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmticmlr.h
366 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
367 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
368 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
370 .PHONY: $(HS_ALT_MAKE)/defs.make