make/test/BuildMicrobenchmark.gmk
author gadams
Mon, 04 Mar 2019 08:45:05 -0500
changeset 53988 efa9bc147d50
parent 53834 1b40a0178b2a
child 55008 6977eb6a4b61
permissions -rw-r--r--
4903717: nsk/jdi/ThreadReference/isSuspended/issuspended002 failing Reviewed-by: amenkov, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     1
#
53159
9339773f2530 8216275: Disable annotation processing lint warnings when building microbenchmarks
redestad
parents: 52595
diff changeset
     2
# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     4
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    10
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    15
# accompanied this code).
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    16
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    20
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    23
# questions.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    24
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    25
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    26
# This must be the first rule
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    27
default: all
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    28
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    29
include $(SPEC)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    30
include MakeBase.gmk
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    31
include JavaCompilation.gmk
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    32
include SetupJavaCompilers.gmk
53834
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    33
include TestFilesCompilation.gmk
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    34
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    35
ifeq ($(JMH_CORE_JAR), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    36
  $(info Error: JMH is missing. Please use configure --with-jmh.)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    37
  $(error Cannot continue)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    38
endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    39
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    40
#### Variables
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    41
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    42
MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
53834
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    43
MICROBENCHMARK_IMAGE_DIR := $(TEST_IMAGE_DIR)/micro
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    44
MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    45
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    46
MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    47
MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    48
MICROBENCHMARK_JAR_BIN := $(MICROBENCHMARK_OUTPUT)/jar
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    49
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    50
JMH_UNPACKED_DIR := $(MICROBENCHMARK_OUTPUT)/jmh_jars
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    51
JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    52
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    53
# External dependencies
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    54
JMH_COMPILE_JARS := $(JMH_CORE_JAR) $(JMH_GENERATOR_JAR)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    55
JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JAR)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    56
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    57
MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    58
53834
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    59
# Native dependencies
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    60
MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC)
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    61
MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    62
MICROBENCHMARK_NATIVE_EXCLUDE :=
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
    63
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    64
###
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    65
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    66
# Need double \n to get new lines and no trailing spaces
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    67
MICROBENCHMARK_MANIFEST := Build: $(FULL_VERSION)\n\
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    68
\nJMH-Version: $(JMH_VERSION)\n\
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    69
\nName: OpenJDK Microbenchmark Suite
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    70
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    71
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    72
#### Compile Targets
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    73
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    74
# Building microbenchmark requires the jdk.unsupported and java.management modules,
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    75
# and to have sjavac disabled.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    76
$(eval $(call SetupJavaCompiler, MICROBENCHMARK_JAVA_COMPILER, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    77
    JVM := $(JAVA) --add-modules jdk.unsupported --limit-modules java.management, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    78
    JAVAC := $(NEW_JAVAC), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    79
    DISABLE_SJAVAC := true, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    80
    FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    81
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    82
    SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    83
))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    84
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    85
# Build microbenchmark suite for the current JDK
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    86
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    87
    SETUP := MICROBENCHMARK_JAVA_COMPILER, \
53159
9339773f2530 8216275: Disable annotation processing lint warnings when building microbenchmarks
redestad
parents: 52595
diff changeset
    88
    ADD_JAVAC_FLAGS := -cp $(MICROBENCHMARK_CLASSPATH) -Xlint -Xlint:-processing -Werror, \
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    89
    SRC := $(MICROBENCHMARK_SRC), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    90
    BIN := $(MICROBENCHMARK_CLASSES), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    91
))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    92
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    93
$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    94
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    95
# Unpacking dependencies for inclusion in the benchmark JARs
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    96
$(JMH_UNPACKED_JARS_DONE): $(JMH_RUNTIME_JARS)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    97
	$(RM) -r $(JMH_UNPACKED_DIR)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    98
	$(MKDIR) -p $(JMH_UNPACKED_DIR)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
    99
	$(foreach jar, $(JMH_RUNTIME_JARS), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   100
            $$($(UNZIP) -oq $(jar) -d $(JMH_UNPACKED_DIR)))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   101
	$(RM) -r $(JMH_UNPACKED_DIR)/META-INF
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   102
	$(RM) $(JMH_UNPACKED_DIR)/*.xml
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   103
	$(TOUCH) $@
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   104
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   105
# Create benchmarks JAR file with benchmarks for both the old and new JDK
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   106
$(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   107
    DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   108
    SRCS := $(MICROBENCHMARK_CLASSES) $(JMH_UNPACKED_DIR), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   109
    BIN := $(MICROBENCHMARK_JAR_BIN), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   110
    SUFFIXES := .*, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   111
    EXCLUDE_FILES:= _the.BUILD_JDK_MICROBENCHMARK_batch \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   112
        _the.BUILD_JDK_MICROBENCHMARK.vardeps _unpacked.marker, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   113
    EXTRA_MANIFEST_ATTR := $(MICROBENCHMARK_MANIFEST), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   114
    JARMAIN := org.openjdk.jmh.Main, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   115
    JAR := $(MICROBENCHMARK_JAR), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   116
))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   117
53834
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   118
# Setup compilation of native library dependencies
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   119
$(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   120
    TYPE := LIBRARY, \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   121
    SOURCE_DIRS := $(MICROBENCHMARK_NATIVE_SRC_DIRS), \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   122
    OUTPUT_DIR := $(MICROBENCHMARK_NATIVE_OUTPUT), \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   123
    EXCLUDE := $(MICROBENCHMARK_NATIVE_EXCLUDE), \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   124
))
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   125
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   126
# Setup copy of native dependencies to image output dir
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   127
$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   128
    SRC := $(MICROBENCHMARK_NATIVE_OUTPUT), \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   129
    DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   130
    FILES := $(BUILD_MICROBENCHMARK_LIBRARIES), \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   131
    FLATTEN := true, \
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   132
))
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   133
1b40a0178b2a 8219393: Add native library support for microbenchmarks
redestad
parents: 53159
diff changeset
   134
all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   135
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents:
diff changeset
   136
.PHONY: all