1 #
   2 # Copyright (c) 2016, 2018, 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 $(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
  27 
  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
  31 
  32 # On Windows, there are no internal debug symbols so must set copying to true
  33 # to get any at all.
  34 ifeq ($(call isTargetOs, windows), true)
  35   GTEST_COPY_DEBUG_SYMBOLS := true
  36 else
  37   GTEST_COPY_DEBUG_SYMBOLS := false
  38 endif
  39 
  40 ################################################################################
  41 
  42 ifeq ($(call isTargetOs, windows), true)
  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 undef, switch, format-nonliteral and tautological-undefined-compare
  56 # warnings for clang because of test source.
  57 
  58 $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
  59     NAME := jvm, \
  60     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
  61     OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
  62     OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \
  63     SRC := $(GTEST_TEST_SRC), \
  64     EXCLUDES := $(JVM_EXCLUDES), \
  65     EXCLUDE_FILES := gtestLauncher.cpp, \
  66     EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
  67     EXTRA_FILES := $(GTEST_FRAMEWORK_SRC)/src/gtest-all.cc, \
  68     EXTRA_OBJECT_FILES := $(filter-out %/operator_new$(OBJ_SUFFIX), \
  69         $(BUILD_LIBJVM_ALL_OBJS)), \
  70     CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
  71         -I$(GTEST_FRAMEWORK_SRC)/include \
  72         $(addprefix -I,$(GTEST_TEST_SRC)), \
  73     CFLAGS_windows := -EHsc, \
  74     CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \
  75     CFLAGS_macosx := -DGTEST_OS_MAC=1, \
  76     DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc) \
  77         undef, \
  78     DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang) \
  79         undef switch format-nonliteral tautological-undefined-compare, \
  80     DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio) \
  81         identexpected, \
  82     DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft) \
  83         4996, \
  84     LDFLAGS := $(JVM_LDFLAGS), \
  85     LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
  86     LIBS := $(JVM_LIBS), \
  87     OPTIMIZATION := $(JVM_OPTIMIZATION), \
  88     MAPFILE := $(GTEST_JVM_MAPFILE), \
  89     USE_MAPFILE_FOR_SYMBOLS := true, \
  90     COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
  91     ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
  92     STRIP_SYMBOLS := false, \
  93     PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
  94     PRECOMPILED_HEADER_EXCLUDE := gtest-all.cc gtestMain.cpp, \
  95     DEFINE_THIS_FILE := false, \
  96 ))
  97 
  98 TARGETS += $(BUILD_GTEST_LIBJVM)
  99 
 100 ################################################################################
 101 
 102 $(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
 103     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 104     NAME := gtestLauncher, \
 105     TYPE := EXECUTABLE, \
 106     OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
 107     EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \
 108     OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \
 109     CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
 110         -I$(GTEST_FRAMEWORK_SRC)/include, \
 111     LDFLAGS := $(LDFLAGS_JDKEXE), \
 112     LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \
 113     LDFLAGS_solaris := -library=stlport4, \
 114     LIBS_linux := $(LIBCXX), \
 115     LIBS_unix := -ljvm, \
 116     LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \
 117     COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
 118     ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
 119     DEFINE_THIS_FILE := false, \
 120 ))
 121 
 122 $(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM)
 123 
 124 TARGETS += $(BUILD_GTEST_LAUNCHER)
 125 
 126 ################################################################################
--- EOF ---