buildtree.make 16.6 KB
Newer Older
N
never 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#  
#

# Usage:
#
# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch
#         GAMMADIR=dir OS_FAMILY=os VARIANT=variant
#
# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the
# environment or on the command-line:
#
# ARCH		- sparc, i486, ... HotSpot cpu and os_cpu source directory
# BUILDARCH     - build directory
# LIBARCH       - the corresponding directory in JDK/JRE
# GAMMADIR	- top of workspace
# OS_FAMILY	- operating system
# VARIANT	- core, compiler1, compiler2, or tiered
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
# HOTSPOT_BUILD_VERSION   - internal, internal-$(USER_RELEASE_SUFFIX) or empty
# JRE_RELEASE_VERSION     - <major>.<minor>.<micro> (1.7.0)
#
# Builds the directory trees with makefiles plus some convenience files in
# each directory:
#
# Makefile	- for "make foo"
# flags.make	- with macro settings
# vm.make	- to support making "$(MAKE) -v vm.make" in makefiles
# adlc.make	- 
# jvmti.make	- generate JVMTI bindings from the spec (JSR-163)
# sa.make	- generate SA jar file and natives
# env.[ck]sh	- environment settings
# test_gamma	- script to run the Queens program
# 
# The makefiles are split this way so that "make foo" will run faster by not
# having to read the dependency files for the vm.

58 59 60
# needs to be set here since this Makefile doesn't include defs.make
OS_VENDOR:=$(shell uname -s)

61
-include $(SPEC)
N
never 已提交
62 63 64 65 66 67 68 69 70 71
include $(GAMMADIR)/make/scm.make
include $(GAMMADIR)/make/altsrc.make


# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
QUIETLY$(MAKE_VERBOSE)	= @

# For now, until the compiler is less wobbly:
TESTFLAGS	= -Xbatch -showversion

72
ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
N
never 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
  PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero
else
  ifdef USE_SUNCC
    PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc
  else
    PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH)
  endif
endif

# Allow overriding of the arch part of the directory but default
# to BUILDARCH if nothing is specified
ifeq ($(VARIANTARCH),)
  VARIANTARCH=$(BUILDARCH)
endif

ifdef FORCE_TIERED
ifeq		($(VARIANT),tiered)
PLATFORM_DIR	= $(OS_FAMILY)_$(VARIANTARCH)_compiler2
else
PLATFORM_DIR	= $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
endif
else
PLATFORM_DIR    = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
endif

#
# We do two levels of exclusion in the shared directory.
# TOPLEVEL excludes are pruned, they are not recursively searched,
# but lower level directories can be named without fear of collision.
# ALWAYS excludes are excluded at any level in the directory tree.
#

ALWAYS_EXCLUDE_DIRS     = $(SCM_DIRS)

ifeq		($(VARIANT),tiered)
TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent
else
ifeq		($(VARIANT),compiler2)
TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent
else
# compiler1 and core use the same exclude list
TOPLEVEL_EXCLUDE_DIRS	= $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent
endif
endif

# Get things from the platform file.
COMPILER	= $(shell sed -n 's/^compiler[ 	]*=[ 	]*//p' $(PLATFORM_FILE))

D
dcubed 已提交
121
# dtracefiles is used on BSD versions that implement Dtrace (like MacOS X)
N
never 已提交
122 123 124
SIMPLE_DIRS	= \
	$(PLATFORM_DIR)/generated/dependencies \
	$(PLATFORM_DIR)/generated/adfiles \
D
dcubed 已提交
125 126
	$(PLATFORM_DIR)/generated/jvmtifiles \
	$(PLATFORM_DIR)/generated/dtracefiles
N
never 已提交
127 128 129 130 131 132 133

TARGETS      = debug fastdebug jvmg optimized product profiled
SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))

# For dependencies and recursive makes.
BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make

D
dcubed 已提交
134 135 136
# dtrace.make is used on BSD versions that implement Dtrace (like MacOS X)
BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make \
	jvmti.make sa.make dtrace.make \
N
never 已提交
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
        env.sh env.csh jdkpath.sh .dbxrc test_gamma

BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)

# Define variables to be set in flags.make.
# Default values are set in make/defs.make.
ifeq ($(HOTSPOT_BUILD_VERSION),)
  HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)
else
  HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)
endif
# Set BUILD_USER from system-dependent hints:  $LOGNAME, $(whoami)
ifndef HOTSPOT_BUILD_USER
  HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME)
endif
ifndef HOTSPOT_BUILD_USER
  HOTSPOT_BUILD_USER := $(shell whoami)
endif
# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
# or make/hotspot_distro.
ifndef HOTSPOT_VM_DISTRO
  ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
    include $(GAMMADIR)/make/hotspot_distro
  else
    include $(GAMMADIR)/make/openjdk_distro
  endif
endif

BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION=  JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)

BUILDTREE	= \
	$(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS)

BUILDTREE_COMMENT	= echo "\# Generated by $(BUILDTREE_MAKE)"

all:  $(SUBMAKE_DIRS)

# Run make in each subdirectory recursively.
$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE
	$(QUIETLY) [ -d $@ ] || { mkdir -p $@; }
	$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F)
	$(QUIETLY) touch $@

$(SIMPLE_DIRS):
	$(QUIETLY) mkdir -p $@

# Convenience macro which takes a source relative path, applies $(1) to the
# absolute path, and then replaces $(GAMMADIR) in the result with a 
# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.  
gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))

flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \
	sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \
	echo; \
	echo "GAMMADIR = $(GAMMADIR)"; \
	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
	echo "SRCARCH = $(SRCARCH)"; \
	echo "BUILDARCH = $(BUILDARCH)"; \
	echo "LIBARCH = $(LIBARCH)"; \
	echo "TARGET = $(TARGET)"; \
	echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
	echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
	echo; \
	echo "# Used for platform dispatching"; \
	echo "TARGET_DEFINES  = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
	echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \
	echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \
	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \
	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \
	echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \
	echo "CFLAGS += \$$(TARGET_DEFINES)"; \
	echo; \
	echo "Src_Dirs_V = \\"; \
	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
	echo; \
	echo "Src_Dirs_I = \\"; \
	echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
	echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
	echo "$(call gamma-path,altsrc,share/vm) \\"; \
	echo "$(call gamma-path,commonsrc,share/vm) \\"; \
234 235
	echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \
	echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \
N
never 已提交
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
	[ -n "$(CFLAGS_BROWSE)" ] && \
	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
	    echo && \
	    echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \
	    echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \
	echo; \
251 252
	[ -n "$(SPEC)" ] && \
	    echo "include $(SPEC)"; \
N
never 已提交
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
	) > $@

flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	[ "$(TARGET)" = profiled ] && \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/optimized.make"; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \
	) > $@

../shared_dirs.lst:  $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
	@echo Creating directory list $@
	$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
          find $(HS_ALT_SRC)/share/vm/* -prune \
	  -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
          \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
        fi;
	$(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \
	-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@

Makefile: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \
	) > $@

vm.make: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo include flags_vm.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
	) > $@

adlc.make: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
	) > $@

jvmti.make: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
	) > $@

sa.make: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
	) > $@

D
dcubed 已提交
329 330 331 332 333 334 335 336 337 338
dtrace.make: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo; \
	echo include flags.make; \
	echo; \
	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
	) > $@

N
never 已提交
339 340 341 342 343 344 345 346 347
env.sh: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
	{ \
	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
	} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
	echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
348
	echo "export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER"; \
N
never 已提交
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
	) > $@

env.csh: env.sh
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	[ -n "$$JAVA_HOME" ] && \
	{ echo "if (! \$$?JAVA_HOME) setenv JAVA_HOME \"$$JAVA_HOME\""; }; \
	sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
	) > $@

jdkpath.sh: $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	$(BUILDTREE_COMMENT); \
	echo "JDK=${JAVA_HOME}"; \
	) > $@	   

.dbxrc:  $(BUILDTREE_MAKE)
	@echo Creating $@ ...
	$(QUIETLY) ( \
	echo "echo '# Loading $(PLATFORM_DIR)/$(TARGET)/.dbxrc'"; \
	echo "if [ -f \"\$${HOTSPOT_DBXWARE}\" ]"; \
	echo "then"; \
	echo "	source \"\$${HOTSPOT_DBXWARE}\""; \
	echo "elif [ -f \"\$$HOME/.dbxrc\" ]"; \
	echo "then"; \
	echo "	source \"\$$HOME/.dbxrc\""; \
	echo "fi"; \
	) > $@

# Skip the test for product builds (which only work when installed in a JDK), to
# avoid exiting with an error and causing make to halt.
NO_TEST_MSG	= \
	echo "$@:  skipping the test--this build must be tested in a JDK."

NO_JAVA_HOME_MSG	= \
	echo "JAVA_HOME must be set to run this test."

DATA_MODE = $(DATA_MODE/$(BUILDARCH))
JAVA_FLAG = $(JAVA_FLAG/$(DATA_MODE))

DATA_MODE/i486    = 32
DATA_MODE/sparc   = 32
DATA_MODE/sparcv9 = 64
DATA_MODE/amd64   = 64
DATA_MODE/ia64    = 64
DATA_MODE/zero    = $(ARCH_DATA_MODEL)

JAVA_FLAG/32 = -d32
JAVA_FLAG/64 = -d64

WRONG_DATA_MODE_MSG = \
402
	echo "JAVA_HOME must point to a $(DATA_MODE)-bit OpenJDK."
N
never 已提交
403 404 405 406 407 408 409

CROSS_COMPILING_MSG = \
	echo "Cross compiling for ARCH $(CROSS_COMPILE_ARCH), skipping gamma run."

test_gamma:  $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java
	@echo Creating $@ ...
	$(QUIETLY) ( \
410 411
	echo "#!/bin/sh"; \
	echo ""; \
N
never 已提交
412
	$(BUILDTREE_COMMENT); \
413 414 415 416 417 418 419 420 421 422
	echo ""; \
	echo "# Include environment settings for gamma run"; \
	echo ""; \
	echo ". ./env.sh"; \
	echo ""; \
	echo "# Do not run gamma test for cross compiles"; \
	echo ""; \
	echo "if [ -n \"$(CROSS_COMPILE_ARCH)\" ]; then "; \
	echo "  $(CROSS_COMPILING_MSG)"; \
	echo "  exit 0"; \
N
never 已提交
423
	echo "fi"; \
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
	echo ""; \
	echo "# Make sure JAVA_HOME is set as it is required for gamma"; \
	echo ""; \
	echo "if [ -z \"\$${JAVA_HOME}\" ]; then "; \
	echo "  $(NO_JAVA_HOME_MSG)"; \
	echo "  exit 0"; \
	echo "fi"; \
	echo ""; \
	echo "# Check JAVA_HOME version to be used for the test"; \
	echo ""; \
	echo "\$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion > /dev/null 2>&1"; \
	echo "if [ \$$? -ne 0 ]; then "; \
	echo "  $(WRONG_DATA_MODE_MSG)"; \
	echo "  exit 0"; \
	echo "fi"; \
	echo ""; \
	echo "# Use gamma_g if it exists"; \
	echo ""; \
	echo "GAMMA_PROG=gamma"; \
	echo "if [ -f gamma_g ]; then "; \
	echo "  GAMMA_PROG=gamma_g"; \
	echo "fi"; \
	echo ""; \
	echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \
	echo "  # Ensure architecture for gamma and JAVA_HOME is the same."; \
	echo "  # NOTE: gamma assumes the OpenJDK directory layout."; \
	echo ""; \
	echo "  GAMMA_ARCH=\"\`file \$${GAMMA_PROG} | awk '{print \$$NF}'\`\""; \
	echo "  JVM_LIB=\"\$${JAVA_HOME}/jre/lib/libjava.$(LIBRARY_SUFFIX)\""; \
	echo "  if [ ! -f \$${JVM_LIB} ]; then"; \
	echo "    JVM_LIB=\"\$${JAVA_HOME}/jre/lib/$${LIBARCH}/libjava.$(LIBRARY_SUFFIX)\""; \
	echo "  fi"; \
	echo "  if [ ! -f \$${JVM_LIB} ] || [ -z \"\`file \$${JVM_LIB} | grep \$${GAMMA_ARCH}\`\" ]; then "; \
	echo "    $(WRONG_DATA_MODE_MSG)"; \
	echo "    exit 0"; \
	echo "  fi"; \
	echo "fi"; \
	echo ""; \
	echo "# Compile Queens program for test"; \
	echo ""; \
N
never 已提交
464 465
	echo "rm -f Queens.class"; \
	echo "\$${JAVA_HOME}/bin/javac -d . $(GAMMADIR)/make/test/Queens.java"; \
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
	echo ""; \
	echo "# Set library path solely for gamma launcher test run"; \
	echo ""; \
	echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \
	echo "export LD_LIBRARY_PATH"; \
	echo "unset LD_LIBRARY_PATH_32"; \
	echo "unset LD_LIBRARY_PATH_64"; \
	echo ""; \
	echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \
	echo "  DYLD_LIBRARY_PATH=.:$${DYLD_LIBRARY_PATH:+$$DYLD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/native_threads:\$${JAVA_HOME}/jre/lib:$${DYLD_LIBRARY_PATH:+$$DYLD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \
	echo "  export DYLD_LIBRARY_PATH"; \
	echo "fi"; \
	echo ""; \
	echo "# Use the gamma launcher and JAVA_HOME to run the test"; \
	echo ""; \
	echo "./\$${GAMMA_PROG} $(TESTFLAGS) Queens < /dev/null"; \
N
never 已提交
482 483 484 485 486 487
	) > $@
	$(QUIETLY) chmod +x $@

FORCE:

.PHONY:  all FORCE