Makefile revision 2327:281a14e87a3b
1# 2# Copyright (c) 2015, 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 24# 25# This is a temporary standalone makefile 26# 27 28BUILD_DIR := $(shell pwd)/build 29CLASSES_DIR := ${BUILD_DIR}/classes 30IMAGE_DIR := ${BUILD_DIR}/image 31RUN_DIR := $(shell pwd)/run 32CLASSPATH := ${JTREG_HOME}/lib/jtreg.jar:${JAVA_HOME}/lib/tools.jar 33SRC_DIR := src/share/classes/ 34SOURCES := ${SRC_DIR}/jdk/test/failurehandler/*.java \ 35 ${SRC_DIR}/jdk/test/failurehandler/action/*.java \ 36 ${SRC_DIR}/jdk/test/failurehandler/jtreg/*.java \ 37 ${SRC_DIR}/jdk/test/failurehandler/value/*.java 38 39CONF_DIR = src/share/conf 40 41JAVA_RELEASE = 7 42 43TARGET_JAR = ${IMAGE_DIR}/lib/jtregFailureHandler.jar 44 45OS_NAME := $(shell uname -o 2>&1) 46 47ifeq ("${OS_NAME}", "Cygwin") 48BUILD_DIR := $(shell cygpath -m "${BUILD_DIR}") 49CLASSES_DIR := $(shell cygpath -m "${CLASSES_DIR}") 50IMAGE_DIR := $(shell cygpath -m "${IMAGE_DIR}") 51RUN_DIR := $(shell cygpath -m "${RUN_DIR}") 52SRC_DIR := $(shell cygpath -m "${SRC_DIR}") 53JAVA_HOME := $(shell cygpath -m "${JAVA_HOME}") 54JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}") 55CLASSPATH := $(shell cygpath -pm "${CLASSPATH}") 56CC := "cl.exe" 57endif 58 59all: clean test 60 61native: require_env 62ifeq ("${OS_NAME}", "Cygwin") 63 "${CC}" src/windows/native/jdk/test/failurehandler/jtreg/*.c \ 64 -I"$(shell cygpath -w "${JAVA_HOME}/include")" \ 65 -I"$(shell cygpath -w "${JAVA_HOME}/include/win32")" \ 66 /link /DLL /OUT:timeoutHandler.dll 67endif 68 69check_defined = $(foreach 1,$1,$(__check_defined)) 70__check_defined = $(if $(value $1),, $(error $1 is not set)) 71 72classes: require_env 73 mkdir -p ${IMAGE_DIR}/bin ${IMAGE_DIR}/lib ${CLASSES_DIR} 74 "${JAVA_HOME}"/bin/javac -target ${JAVA_RELEASE} -source ${JAVA_RELEASE} \ 75 -sourcepath "$(shell pwd)" \ 76 -cp "${CLASSPATH}" \ 77 -d ${CLASSES_DIR} \ 78 ${SOURCES} 79 "${JAVA_HOME}"/bin/jar cf "${TARGET_JAR}" -C "${CLASSES_DIR}" . 80 "${JAVA_HOME}"/bin/jar uf "${TARGET_JAR}" -C "${CONF_DIR}" . 81 82# 83# Use JTREG_TEST_OPTS for test VM options 84# Use JTREG_TESTS for jtreg tests parameter 85# 86test: require_env build 87 rm -rf "${RUN_DIR}" 88 mkdir -p "${RUN_DIR}" 89 "${JTREG_HOME}"/bin/jtreg \ 90 -jdk:"${JAVA_HOME}" \ 91 ${JTREG_TEST_OPTS} \ 92 -timeout:0.1 -va -retain:all \ 93 -noreport \ 94 -agentvm \ 95 -thd:"${TARGET_JAR}" \ 96 -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ 97 -thtimeout:0 \ 98 -od:"${TARGET_JAR}" \ 99 -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ 100 -w:"${RUN_DIR}/JTwork" \ 101 -r:"${RUN_DIR}/JTreport" \ 102 $(if ${JTREG_TESTS}, ${JTREG_TESTS}, test) \ 103 && false || true 104 105debug: JTREG_TEST_OPTS += "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'" 106debug: test 107 108require_env: 109 $(call check_defined, JAVA_HOME) 110 $(call check_defined, JTREG_HOME) 111 112clean: 113 rm -rf "${BUILD_DIR}" "${RUN_DIR}" 114 115build: classes native 116 117.PHONY: all build classes native test require_env clean 118.DEFAULT: all 119 120