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