< prev index next >

make/common/TestFilesCompilation.gmk

Print this page


   1 #
   2 # Copyright (c) 2015, 2019, 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


  60   ifeq ($$($1_TYPE), LIBRARY)
  61     $1_PREFIX = lib
  62     $1_OUTPUT_SUBDIR := lib
  63     $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
  64     $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
  65     $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
  66     $1_COMPILATION_TYPE := LIBRARY
  67   else ifeq ($$($1_TYPE), PROGRAM)
  68     $1_PREFIX = exe
  69     $1_OUTPUT_SUBDIR := bin
  70     $1_BASE_CFLAGS := $(CFLAGS_JDKEXE)
  71     $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE)
  72     $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
  73     $1_COMPILATION_TYPE := EXECUTABLE
  74   else
  75     $$(error Unknown type: $$($1_TYPE))
  76   endif
  77 
  78   # Locate all files with the matching prefix
  79   $1_FILE_LIST := \
  80       $$(call FindFiles, $$($1_SOURCE_DIRS), $$($1_PREFIX)*.c $$($1_PREFIX)*.cpp)

  81 
  82   $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
  83   $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
  84 
  85   # Setup a compilation for each and every one of them
  86   $$(foreach file, $$($1_FILTERED_FILE_LIST),\
  87     $$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
  88     $$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
  89     $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
  90         NAME := $$(unprefixed_name), \
  91         TYPE := $$($1_COMPILATION_TYPE), \
  92         EXTRA_FILES := $$(file), \

  93         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
  94         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
  95         CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  96         CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  97         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
  98         DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \
  99         DISABLED_WARNINGS_clang := undef format-nonliteral \
 100             missing-field-initializers sometimes-uninitialized, \
 101         DISABLED_WARNINGS_CXX_solstudio := wvarhidenmem, \
 102         LIBS := $$($1_LIBS_$$(name)), \
 103         TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \
 104         OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
 105         COPY_DEBUG_SYMBOLS := false, \
 106         STRIP_SYMBOLS := $$(if $$($1_STRIP_SYMBOLS_$$(name)),$$($1_STRIP_SYMBOLS_$$(name)),false), \
 107     )) \
 108     $$(eval $1 += $$(BUILD_TEST_$$(name)) )  \
 109   )
 110 
 111 endef
 112 
 113 endif # _TEST_FILES_COMPILATION_GMK
   1 #
   2 # Copyright (c) 2015, 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


  60   ifeq ($$($1_TYPE), LIBRARY)
  61     $1_PREFIX = lib
  62     $1_OUTPUT_SUBDIR := lib
  63     $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
  64     $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
  65     $1_LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
  66     $1_COMPILATION_TYPE := LIBRARY
  67   else ifeq ($$($1_TYPE), PROGRAM)
  68     $1_PREFIX = exe
  69     $1_OUTPUT_SUBDIR := bin
  70     $1_BASE_CFLAGS := $(CFLAGS_JDKEXE)
  71     $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE)
  72     $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
  73     $1_COMPILATION_TYPE := EXECUTABLE
  74   else
  75     $$(error Unknown type: $$($1_TYPE))
  76   endif
  77 
  78   # Locate all files with the matching prefix
  79   $1_FILE_LIST := \
  80       $$(shell $$(FIND) $$($1_SOURCE_DIRS) -type f \( -name "$$($1_PREFIX)*.c" \
  81           -o -name "$$($1_PREFIX)*.cpp" \))
  82 
  83   $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
  84   $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
  85 
  86   # Setup a compilation for each and every one of them
  87   $$(foreach file, $$($1_FILTERED_FILE_LIST),\
  88     $$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
  89     $$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
  90     $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
  91         NAME := $$(unprefixed_name), \
  92         TYPE := $$($1_COMPILATION_TYPE), \
  93         SRC := $$(patsubst %/,%,$$(dir $$(file))), \
  94         INCLUDE_FILES := $$(notdir $$(file)), \
  95         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
  96         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
  97         CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  98         CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  99         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
 100         DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \
 101         DISABLED_WARNINGS_clang := undef format-nonliteral \
 102             missing-field-initializers sometimes-uninitialized, \
 103         DISABLED_WARNINGS_CXX_solstudio := wvarhidenmem, \
 104         LIBS := $$($1_LIBS_$$(name)), \
 105         TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \
 106         OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
 107         COPY_DEBUG_SYMBOLS := false, \
 108         STRIP_SYMBOLS := false, \
 109     )) \
 110     $$(eval $1 += $$(BUILD_TEST_$$(name)) )  \
 111   )
 112 
 113 endef
 114 
 115 endif # _TEST_FILES_COMPILATION_GMK
< prev index next >