author | ihse |
Thu, 15 Mar 2018 09:33:36 +0100 | |
branch | ihse-cflags-rewrite-branch |
changeset 56312 | a52bcf4118eb |
parent 56248 | b61bf4510be2 |
parent 49160 | cefb7b496d17 |
child 56900 | d5d542d50e3c |
permissions | -rw-r--r-- |
38255 | 1 |
# |
49024
953b3fd36b08
8196997: VS2017 The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be removed
lfoltan
parents:
47314
diff
changeset
|
2 |
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
38255 | 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 |
||
47314 | 26 |
$(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk)) |
39393 | 27 |
|
47217 | 28 |
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest |
29 |
GTEST_LAUNCHER_SRC := $(TOPDIR)/test/hotspot/gtest/gtestLauncher.cpp |
|
30 |
GTEST_FRAMEWORK_SRC := $(TOPDIR)/test/fmw/gtest |
|
38255 | 31 |
|
32 |
# On Windows, there are no internal debug symbols so must set copying to true |
|
33 |
# to get any at all. |
|
34 |
ifeq ($(OPENJDK_TARGET_OS), windows) |
|
35 |
GTEST_COPY_DEBUG_SYMBOLS := true |
|
36 |
else |
|
37 |
GTEST_COPY_DEBUG_SYMBOLS := false |
|
38 |
endif |
|
39 |
||
40 |
################################################################################ |
|
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 |
||
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
42901
diff
changeset
|
55 |
# Disabling undef, switch, format-nonliteral and tautological-undefined-compare |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
42901
diff
changeset
|
56 |
# warnings for clang because of test source. |
38255 | 57 |
|
42901
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
58 |
# Note: On AIX, the gtest test classes linked into the libjvm.so push the TOC |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
59 |
# size beyond 64k, so we need to link with bigtoc. However, this means that |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
60 |
# -qpic=large would be advisable to lessen the performance effect of bigtoc. |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
61 |
# But we want to avoid imposing -qpic=large onto the regular libjvm.so, which |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
62 |
# has no problem with its TOC, so do this only for object files which are |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
63 |
# exclusive to the gtest libjvm.so. |
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
64 |
|
38255 | 65 |
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \ |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
49024
diff
changeset
|
66 |
NAME := jvm, \ |
41193
9e274c9c3047
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
39991
diff
changeset
|
67 |
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ |
38255 | 68 |
OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ |
69 |
OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \ |
|
38636
0a04aee4e7a6
8157325: gtest tests are not excluded for minimal builds
ehelin
parents:
38255
diff
changeset
|
70 |
SRC := $(GTEST_TEST_SRC), \ |
0a04aee4e7a6
8157325: gtest tests are not excluded for minimal builds
ehelin
parents:
38255
diff
changeset
|
71 |
EXCLUDES := $(JVM_EXCLUDES), \ |
0a04aee4e7a6
8157325: gtest tests are not excluded for minimal builds
ehelin
parents:
38255
diff
changeset
|
72 |
EXCLUDE_FILES := gtestLauncher.cpp, \ |
0a04aee4e7a6
8157325: gtest tests are not excluded for minimal builds
ehelin
parents:
38255
diff
changeset
|
73 |
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ |
0a04aee4e7a6
8157325: gtest tests are not excluded for minimal builds
ehelin
parents:
38255
diff
changeset
|
74 |
EXTRA_FILES := $(GTEST_FRAMEWORK_SRC)/src/gtest-all.cc, \ |
38255 | 75 |
EXTRA_OBJECT_FILES := $(filter-out %/operator_new$(OBJ_SUFFIX), \ |
76 |
$(BUILD_LIBJVM_ALL_OBJS)), \ |
|
77 |
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \ |
|
78 |
-I$(GTEST_FRAMEWORK_SRC)/include \ |
|
39393 | 79 |
$(addprefix -I,$(GTEST_TEST_SRC)), \ |
41465 | 80 |
CFLAGS_windows := -EHsc, \ |
38255 | 81 |
CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \ |
82 |
CFLAGS_macosx := -DGTEST_OS_MAC=1, \ |
|
42901
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
83 |
CFLAGS_aix := -qpic=large, \ |
56238 | 84 |
DISABLED_WARNINGS_gcc := suggest-attribute=format unknown-pragmas comment \ |
85 |
delete-non-virtual-dtor ignored-qualifiers parentheses reorder \ |
|
86 |
unused-local-typedefs unused-variable address \ |
|
87 |
missing-field-initializers unused-but-set-variable char-subscripts \ |
|
56248
b61bf4510be2
Now I really confirm this compiles without warnings on gcc 7.2.0, 6.3.0, 5.4.1, 4.9.2, 4.8.5.
ihse
parents:
56245
diff
changeset
|
88 |
array-bounds narrowing empty-body unused-but-set-parameter undef \ |
b61bf4510be2
Now I really confirm this compiles without warnings on gcc 7.2.0, 6.3.0, 5.4.1, 4.9.2, 4.8.5.
ihse
parents:
56245
diff
changeset
|
89 |
maybe-uninitialized logical-op \ |
b61bf4510be2
Now I really confirm this compiles without warnings on gcc 7.2.0, 6.3.0, 5.4.1, 4.9.2, 4.8.5.
ihse
parents:
56245
diff
changeset
|
90 |
implicit-fallthrough expansion-to-defined, \ |
38255 | 91 |
DISABLED_WARNINGS_clang := undef switch format-nonliteral \ |
39394 | 92 |
tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \ |
56245 | 93 |
DISABLED_WARNINGS_solstudio := $(BUILD_LIBJVM_DISABLED_WARNINGS_solstudio), \ |
49024
953b3fd36b08
8196997: VS2017 The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be removed
lfoltan
parents:
47314
diff
changeset
|
94 |
DISABLED_WARNINGS_CXX_microsoft := 4996, \ |
38255 | 95 |
LDFLAGS := $(JVM_LDFLAGS), \ |
96 |
LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \ |
|
42901
3da41dfcadf8
8171408: [aix] TOC overflow when linking the gtest libjvm.so
stuefe
parents:
42885
diff
changeset
|
97 |
LDFLAGS_aix := -bbigtoc, \ |
38255 | 98 |
LIBS := $(JVM_LIBS), \ |
99 |
OPTIMIZATION := $(JVM_OPTIMIZATION), \ |
|
100 |
MAPFILE := $(GTEST_JVM_MAPFILE), \ |
|
101 |
USE_MAPFILE_FOR_SYMBOLS := true, \ |
|
102 |
COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ |
|
103 |
ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ |
|
42885 | 104 |
STRIP_SYMBOLS := false, \ |
39394 | 105 |
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ |
106 |
PRECOMPILED_HEADER_EXCLUDE := gtest-all.cc gtestMain.cpp, \ |
|
38255 | 107 |
)) |
108 |
||
109 |
TARGETS += $(BUILD_GTEST_LIBJVM) |
|
110 |
||
111 |
################################################################################ |
|
112 |
||
113 |
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \ |
|
41193
9e274c9c3047
8160630: libjimage.so and others should link statically to libgcc
erikj
parents:
39991
diff
changeset
|
114 |
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ |
49070
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
49024
diff
changeset
|
115 |
NAME := gtestLauncher, \ |
d7859531621b
8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents:
49024
diff
changeset
|
116 |
TYPE := EXECUTABLE, \ |
38255 | 117 |
OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ |
39393 | 118 |
EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \ |
38255 | 119 |
OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \ |
120 |
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \ |
|
121 |
-I$(GTEST_FRAMEWORK_SRC)/include, \ |
|
39991
d89a486fa0d2
8161915: Linking gtestLauncher may end up linking with non-gtest libjvm
mgerdin
parents:
39394
diff
changeset
|
122 |
LDFLAGS := $(LDFLAGS_JDKEXE), \ |
38255 | 123 |
LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ |
124 |
LDFLAGS_solaris := -library=stlport4, \ |
|
42542
e8d67bf2f2de
8169255: Link gtestLauncher statically if libjvm is configured for static linking
erikj
parents:
41465
diff
changeset
|
125 |
LIBS_linux := $(LIBCXX), \ |
38255 | 126 |
LIBS_unix := -ljvm, \ |
127 |
LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \ |
|
128 |
COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ |
|
129 |
ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ |
|
130 |
)) |
|
131 |
||
132 |
$(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM) |
|
133 |
||
134 |
TARGETS += $(BUILD_GTEST_LAUNCHER) |
|
135 |
||
136 |
################################################################################ |