Clean up some stuff in fake spec.
#
# Copyright (c) 2017, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#
################################################################################
# Initial bootstrapping, copied and stripped down from Makefile and Init.gmk
################################################################################
# In Cygwin, the MAKE variable gets prepended with the current directory if the
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
ifneq ($(findstring :, $(MAKE)), )
export MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
endif
# Locate this Makefile
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
else
makefile_path := $(lastword $(MAKEFILE_LIST))
endif
TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))
################################################################################
# Functions
################################################################################
define VerifyVariable
ifeq ($$($1), )
ifeq ($2, )
$$(info Error: Variable $1 is missing, needed for run-tests-prebuilt)
$$(error Cannot continue.)
else
$$(info Variable $1 is missing, using default $2)
$1:=$2
endif
else
ifneq ($$(findstring $$(LOG_LEVEL), debug trace), )
$$(info Prebuilt variable $1=$$($1))
endif
endif
endef
# Create an ephemeral spec file
# $1: the output file name
# $2..n: The lines to output to the file.
define CreateNewSpec
$(if $(strip $(16)), \
$(error Internal makefile error: \
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
) \
$(shell rm -f $1) \
$(foreach i, 2 3 4 5 6 7 8 9 10 11 12 13 14 15, \
$(if $(strip $($i)), \
$(call AppendFile, $(strip $($i)), $1) \
) \
)
endef
################################################################################
# Setup ephemeral spec file
################################################################################
# Verify that user has given correct additional input.
# These variables are absolutely necessary
$(eval $(call VerifyVariable,OUTPUTDIR))
$(eval $(call VerifyVariable,BOOT_JDK))
$(eval $(call VerifyVariable,JT_HOME))
# These can have default values based on the ones above
$(eval $(call VerifyVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call VerifyVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
# Provide default values for tools that we need
$(eval $(call VerifyVariable,MAKE,make))
$(eval $(call VerifyVariable,BASH,bash))
# Now that we have verified that we have the required variables available, we
# can include the prebuilt spec file ourselves, without an ephemeral spec
# wrapper. This is required so we can include MakeBase which is needed for
# CreateNewSpec.
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk
include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
# Now we can include additional custom support.
# This might define CUSTOM_NEW_SPEC_LINE
ifneq ($(CUSTOM_MAKE_DIR), )
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
endif
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
$(call CreateNewSpec, $(NEW_SPEC), \
# Generated file -- do not edit!, \
SPEC := $(NEW_SPEC), \
TOPDIR := $(TOPDIR), \
OUTPUTDIR := $(OUTPUTDIR), \
BOOT_JDK := $(BOOT_JDK), \
JT_HOME := $(JT_HOME), \
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
MAKE := $(MAKE), \
BASH := $(BASH), \
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
$(CUSTOM_NEW_SPEC_LINE), \
)
################################################################################
# The run-test-prebuilt target
################################################################################
default: all
run-test-prebuilt:
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
@cd $(TOPDIR) && $(MAKE) -r -R -j 1 -s -I make/common/ \
SPEC=$(NEW_SPEC) \
-f make/RunTests.gmk run-test TEST="$(TEST)"
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
exit 1 ; \
fi
all: run-test-prebuilt
.PHONY: default all