hotspot/make/lib/CompileGtest.gmk
author iignatyev
Mon, 09 May 2016 14:15:40 +0300
changeset 38255 5784bccf53b0
child 38636 0a04aee4e7a6
permissions -rw-r--r--
8148244: Finalize and integrate GTest implementation Reviewed-by: jwilhelm, erikj Contributed-by: stefan.karlsson@oracle.com, stefan.sarne@oracle.com, jesper.wilhelmsson@oracle.com, erik.helin@oracle.com, alexandre.iline@oracle.com, igor.ignatyev@oracle.com, erik.joelsson@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38255
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     1
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     2
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     4
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    10
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    15
# accompanied this code).
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    16
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    20
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    23
# questions.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    24
#
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    25
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    26
GTEST_TEST_SRC := $(HOTSPOT_TOPDIR)/test/native
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    27
GTEST_FRAMEWORK_SRC := $(SRC_ROOT)/test/fmw/gtest
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    28
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    29
# On Windows, there are no internal debug symbols so must set copying to true
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    30
# to get any at all.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    31
ifeq ($(OPENJDK_TARGET_OS), windows)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    32
  GTEST_COPY_DEBUG_SYMBOLS := true
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    33
else
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    34
  GTEST_COPY_DEBUG_SYMBOLS := false
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    35
endif
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    36
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    37
################################################################################
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    38
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    39
GTEST_TEST_SRC_FILES := $(shell $(FIND) $(HOTSPOT_TOPDIR)/test/native -name \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    40
    "test*.cpp" -type f)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    41
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    42
ifeq ($(OPENJDK_TARGET_OS), windows)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    43
  GTEST_JVM_MAPFILE := $(JVM_MAPFILE)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    44
else
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    45
  GTEST_JVM_MAPFILE := $(JVM_OUTPUTDIR)/gtest/mapfile
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    46
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    47
  $(JVM_OUTPUTDIR)/gtest/symbols: $(JVM_OUTPUTDIR)/symbols
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    48
	$(call MakeDir, $(@D))
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    49
	( $(CAT) $< ; echo "runUnitTests" ) > $@
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    50
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    51
  $(GTEST_JVM_MAPFILE): $(JVM_OUTPUTDIR)/gtest/symbols
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    52
	$(call create-mapfile)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    53
endif
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    54
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    55
# Disabling switch warning for clang because of test source.
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    56
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    57
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    58
    TOOLCHAIN := $(JVM_TOOLCHAIN), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    59
    LIBRARY := jvm, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    60
    OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    61
    EXTRA_FILES := $(GTEST_TEST_SRC_FILES) \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    62
        $(GTEST_FRAMEWORK_SRC)/src/gtest-all.cc \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    63
        $(GTEST_TEST_SRC)/gtestMain.cpp, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    64
    OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    65
    EXTRA_OBJECT_FILES := $(filter-out %/operator_new$(OBJ_SUFFIX), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    66
        $(BUILD_LIBJVM_ALL_OBJS)), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    67
    CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    68
        -I$(GTEST_FRAMEWORK_SRC)/include \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    69
        -I$(GTEST_TEST_SRC), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    70
    CFLAGS_windows := /EHsc, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    71
    CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    72
    CFLAGS_macosx := -DGTEST_OS_MAC=1, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    73
    CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    74
    CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    75
    DISABLED_WARNINGS_gcc := undef, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    76
    DISABLED_WARNINGS_clang := undef switch format-nonliteral \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    77
        tautological-undefined-compare, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    78
    DISABLED_WARNINGS_solstudio := identexpected, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    79
    LDFLAGS := $(JVM_LDFLAGS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    80
    LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    81
    LIBS := $(JVM_LIBS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    82
    OPTIMIZATION := $(JVM_OPTIMIZATION), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    83
    MAPFILE := $(GTEST_JVM_MAPFILE), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    84
    USE_MAPFILE_FOR_SYMBOLS := true, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    85
    COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    86
    ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    87
))
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    88
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    89
TARGETS += $(BUILD_GTEST_LIBJVM)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    90
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    91
################################################################################
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    92
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    93
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    94
    TOOLCHAIN := $(JVM_TOOLCHAIN), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    95
    PROGRAM := gtestLauncher, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    96
    OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    97
    EXTRA_FILES := $(GTEST_TEST_SRC)/gtestLauncher.cpp, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    98
    OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
    99
    CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   100
        -I$(GTEST_FRAMEWORK_SRC)/include, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   101
    CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   102
    CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   103
    LDFLAGS := $(LDFLAGS_TESTEXE), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   104
    LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   105
    LDFLAGS_solaris := -library=stlport4, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   106
    LIBS_unix := -ljvm, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   107
    LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   108
    COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   109
    ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   110
))
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   111
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   112
$(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   113
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   114
TARGETS += $(BUILD_GTEST_LAUNCHER)
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   115
5784bccf53b0 8148244: Finalize and integrate GTest implementation
iignatyev
parents:
diff changeset
   116
################################################################################