blob: e858344fdd0901aca07582c7cc85f9bc66fc2134 [file] [log] [blame]
michaelm5ac8c152012-03-06 20:34:38 +00001#
alanb0d058232012-11-02 15:50:11 +00002# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
michaelm5ac8c152012-03-06 20:34:38 +00003# 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#
27# Definitions for Bsd.
28#
29
30# Default for COMPILER_WARNINGS_FATAL on Bsd (C & C++ compiler warnings)
31ifndef COMPILER_WARNINGS_FATAL
32 COMPILER_WARNINGS_FATAL=false
33endif
34
35# Bsd should use parallel compilation for best build times
36ifndef COMPILE_APPROACH
37 COMPILE_APPROACH = parallel
38endif
39
40# Indication that we are doing an incremental build.
41# This may trigger the creation of make depend files.
42ifndef INCREMENTAL_BUILD
43 INCREMENTAL_BUILD = false
44endif
45
46# FullPath just makes sure it never ends with a / and no duplicates
47define FullPath
48$(shell cd $1 2> $(DEV_NULL) && pwd)
49endef
50
51# OptFullPath: Absolute path name of a dir that might not initially exist.
52define OptFullPath
53$(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
54endef
55
56# Location on system where jdk installs might be
57USRJDKINSTANCES_PATH = $(PACKAGE_PATH)
58
59# UNIXCOMMAND_PATH: path to where the most common Unix commands are.
60# NOTE: Must end with / so that it could be empty, allowing PATH usage.
61ifneq "$(origin ALT_UNIXCOMMAND_PATH)" "undefined"
62 UNIXCOMMAND_PATH :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH))
63else
64 UNIXCOMMAND_PATH = /bin/
65endif
66
67# USRBIN_PATH: path to where the most common Unix commands are.
68# NOTE: Must end with / so that it could be empty, allowing PATH usage.
69ifneq "$(origin ALT_USRBIN_PATH)" "undefined"
70 USRBIN_PATH :=$(call PrefixPath,$(ALT_USRBIN_PATH))
71else
72 USRBIN_PATH = /usr/bin/
73endif
74
75# UNIXCCS_PATH: path to where the Solaris ported UNIX commands can be found
76# NOTE: Must end with / so that it could be empty, allowing PATH usage.
77ifneq "$(origin ALT_UNIXCCS_PATH)" "undefined"
78 UNIXCCS_PATH :=$(call PrefixPath,$(ALT_UNIXCCS_PATH))
79else
80 UNIXCCS_PATH = /usr/ccs/bin/
81endif
82
83# SLASH_JAVA: location of all network accessable files
84ifdef ALT_SLASH_JAVA
85 SLASH_JAVA :=$(ALT_SLASH_JAVA)
86else
87 SLASH_JAVA := $(call DirExists,/java,/java,/NOT-SET)
88endif
89
90# JDK_DEVTOOLS_DIR: common path for all the java devtools
91ifdef ALT_JDK_DEVTOOLS_DIR
92 JDK_DEVTOOLS_DIR =$(ALT_JDK_DEVTOOLS_DIR)
93else
94 JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
95endif
96
97# COMPILER_PATH: path to where the compiler and tools are installed.
98# NOTE: Must end with / so that it could be empty, allowing PATH usage.
99ifneq "$(origin ALT_COMPILER_PATH)" "undefined"
100 COMPILER_PATH :=$(call PrefixPath,$(ALT_COMPILER_PATH))
101else
102 ifeq ($(OS_VENDOR), Apple)
103 ifndef DEVELOPER_DIR
104 DEVELOPER_DIR = $(shell /usr/bin/xcode-select -print-path)/usr/bin/
105 endif
106
107 COMPILER_PATH := $(call DirExists,$(DEVELOPER_DIR),/usr/bin/,/NOT-SET)
108 else
109 COMPILER_PATH =/usr/bin/
110 endif
111endif
112
113# OPENWIN_HOME: path to where the X11 environment is installed.
114# NOTE: Must end with / so that it could be empty, allowing PATH usage.
115ifneq ($(ALT_OPENWIN_HOME),)
116 OPENWIN_HOME :=$(call PrefixPath,$(ALT_OPENWIN_HOME))
117else
118 OPENWIN_HOME =$(X11_PATH)
119endif
120
121# DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
122# NOTE: Must end with / so that it could be empty, allowing PATH usage.
123ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined"
124 DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH))
125else
126 DEVTOOLS_PATH =$(PACKAGE_PATH)/bin/
127endif
128
129# _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
130# _BOOTDIR2: Second choice
131ifndef ALT_BOOTDIR
132 _BOOTDIR1 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
133 _BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
134endif
135
136# Always build headless on Bsd
137BUILD_HEADLESS = true
138LIBM=-lm
139
140ifeq ($(OS_VENDOR), Apple)
141 _CUPS_HEADERS_PATH=/usr/include
142else
143 _CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include
144endif
145
andrewecc08bc2012-08-15 14:35:36 +0100146# Set ZLIB_LIBS if not already set
147ifeq ("$(ZLIB_LIBS)", "")
148 ZLIB_LIBS=-lz
149endif
150
michaelm5ac8c152012-03-06 20:34:38 +0000151# Import JDK images allow for partial builds, components not built are
152# imported (or copied from) these import areas when needed.
153
154# BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for
155# multiple platforms, e.g. windows-i586, solaris-sparc, bsd-586, etc.
156ifdef ALT_BUILD_JDK_IMPORT_PATH
157 BUILD_JDK_IMPORT_PATH :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
158else
159 BUILD_JDK_IMPORT_PATH = $(PROMOTED_BUILD_BINARIES)
160endif
161BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH)
162
163# JDK_IMPORT_PATH: location of JDK install tree (this version) to import
164ifdef ALT_JDK_IMPORT_PATH
165 JDK_IMPORT_PATH :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
166else
167 JDK_IMPORT_PATH = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
168endif
169JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH)
170
171# HOTSPOT_IMPORT_PATH: location of hotspot pre-built files
172ifdef ALT_HOTSPOT_IMPORT_PATH
173 HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
174else
175 HOTSPOT_IMPORT_PATH =$(JDK_IMPORT_PATH)
176endif
177HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH)
178
179# HOTSPOT_CLIENT_PATH: location of client jvm library file.
180ifeq ($(ARCH_DATA_MODEL), 32)
181 ifdef ALT_HOTSPOT_CLIENT_PATH
182 HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH))
183 else
184 HOTSPOT_CLIENT_PATH =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client
185 endif
186 HOTSPOT_CLIENT_PATH:=$(call AltCheckValue,HOTSPOT_CLIENT_PATH)
187endif
188
189# HOTSPOT_SERVER_PATH: location of server jvm library file.
190ifdef ALT_HOTSPOT_SERVER_PATH
191 HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH))
192else
193 HOTSPOT_SERVER_PATH =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server
194endif
195HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
196
197# Special define for checking the binaries
198
199# Debug builds should downgrade warnings to just info
200MAPFILE_WARNING-DBG=INFO
201MAPFILE_WARNING-OPT=WARNING
202MAPFILE_WARNING-=WARNING
203MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT))
204
205# Macro to check it's input file for banned dependencies and verify the
206# binary built properly. Relies on process exit code.
207ifndef CROSS_COMPILE_ARCH
208ifeq ($(OS_VENDOR), Apple)
209define binary_file_verification # binary_file
210( \
211 $(ECHO) "Checking for mapfile use in: $1" && \
212 if [ "`$(NM) -g $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
213 $(ECHO) "WARNING: File was not built with a mapfile: $1"; \
214 fi && \
215 $(ECHO) "Library loads for: $1" && \
216 $(OTOOL) -L $1 && \
217 $(ECHO) "RUNPATH for: $1" && \
218 ( $(OTOOL) -l $1 | $(EGREP) 'path ' ) \
219) || true
220endef
221else
222ifeq ($(OS_VENDOR), OpenBSD)
223define binary_file_verification # binary_file
224( \
225 $(ECHO) "Checking for mapfile use in: $1" && \
226 if [ "`$(OBJDUMP) -T $1 | $(EGREP) '[0-9a-f]* g *DF \.text.*SUNWprivate'`" = "" ] ; then \
227 $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
228 fi && \
229 $(ECHO) "Library loads for: $1" && \
230 $(LDD) $1 && \
231 $(ECHO) "RUNPATH for: $1" && \
232 ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
233) || true
234endef
235else
236define binary_file_verification # binary_file
237( \
238 $(ECHO) "Checking for mapfile use in: $1" && \
239 if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
240 $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
241 fi && \
242 $(ECHO) "Library loads for: $1" && \
243 $(LDD) $1 && \
244 $(ECHO) "RUNPATH for: $1" && \
245 ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
246)
247endef
248endif # OS_VENDOR == OpenBSD
249endif # OS_VENDOR == Apple
250else
251define binary_file_verification
252( \
253 $(ECHO) "Skipping binary file verification for cross-compile build" \
254)
255endef
256endif
257