annotate make/common/TestFilesCompilation.gmk @ 58364:b3e8bdfcb968

records: clean up in Serialization code
author chegar
date Mon, 21 Oct 2019 14:41:49 +0100
parents adb3a3aa2e52
children c6fd655677ec
rev   line source
ihse@29156 1 #
erikj@55654 2 # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
ihse@29156 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ihse@29156 4 #
ihse@29156 5 # This code is free software; you can redistribute it and/or modify it
ihse@29156 6 # under the terms of the GNU General Public License version 2 only, as
ihse@29156 7 # published by the Free Software Foundation. Oracle designates this
ihse@29156 8 # particular file as subject to the "Classpath" exception as provided
ihse@29156 9 # by Oracle in the LICENSE file that accompanied this code.
ihse@29156 10 #
ihse@29156 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ihse@29156 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ihse@29156 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ihse@29156 14 # version 2 for more details (a copy is included in the LICENSE file that
ihse@29156 15 # accompanied this code).
ihse@29156 16 #
ihse@29156 17 # You should have received a copy of the GNU General Public License version
ihse@29156 18 # 2 along with this work; if not, write to the Free Software Foundation,
ihse@29156 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ihse@29156 20 #
ihse@29156 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ihse@29156 22 # or visit www.oracle.com if you need additional information or have any
ihse@29156 23 # questions.
ihse@29156 24 #
ihse@29156 25
ihse@29156 26 ifndef _TEST_FILES_COMPILATION_GMK
ihse@29156 27 _TEST_FILES_COMPILATION_GMK := 1
ihse@29156 28
ihse@29156 29 ifeq (,$(_MAKEBASE_GMK))
ihse@29156 30 $(error You must include MakeBase.gmk prior to including TestFilesCompilation.gmk)
ihse@29156 31 endif
ihse@29156 32
ihse@29156 33
ihse@29156 34 include NativeCompilation.gmk
ihse@29156 35
ihse@29156 36 # Setup make rules for creating a set of native test files (libraries or
ihse@29156 37 # executables). This will locate native files matching a certain pattern,
ihse@29156 38 # and compile these into libraries or executables.
ihse@29156 39 #
ihse@29156 40 # Parameter 1 is the name of the rule. This name is used as variable prefix,
ihse@29156 41 # and the targets generated are listed in a variable by that name.
ihse@29156 42 #
ihse@29156 43 # Remaining parameters are named arguments. These include:
ihse@29156 44 # TYPE Must be either PROGRAM or LIBRARY.
ihse@29156 45 # SOURCE_DIRS A list of source directories to search
ihse@29156 46 # OUTPUT_DIR Where to put the resulting files
ihse@49684 47 # EXCLUDE A list of filenames to exclude from compilation
erikj@29312 48 SetupTestFilesCompilation = $(NamedParamsMacroTemplate)
erikj@29312 49 define SetupTestFilesCompilationBody
ihse@29156 50
ihse@29156 51 # Check for duplicate base file names. That would have failed later anyhow, but
ihse@29156 52 # this gives a better error message.
ihse@29156 53 $1_DUPLICATED_NAMES := $$(call dups, $$(notdir $$($1_FILE_LIST)))
ihse@29156 54 ifneq ($$($1_DUPLICATED_NAMES), )
ihse@29156 55 $$(error There are duplicate test file names for $1: $$($1_DUPLICATED_NAMES))
ihse@29156 56 endif
ihse@29156 57
ihse@29156 58 # The list to depend on starts out empty
ihse@29156 59 $1 :=
ihse@29156 60 ifeq ($$($1_TYPE), LIBRARY)
ihse@29156 61 $1_PREFIX = lib
ihse@29156 62 $1_OUTPUT_SUBDIR := lib
ihse@52600 63 $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
ihse@52600 64 $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
erikj@58082 65 $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(call SET_SHARED_LIBRARY_ORIGIN)
ihse@49501 66 $1_COMPILATION_TYPE := LIBRARY
ihse@29156 67 else ifeq ($$($1_TYPE), PROGRAM)
ihse@29156 68 $1_PREFIX = exe
ihse@29156 69 $1_OUTPUT_SUBDIR := bin
ihse@52600 70 $1_BASE_CFLAGS := $(CFLAGS_JDKEXE)
ihse@52600 71 $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE)
ihse@52600 72 $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
ihse@49501 73 $1_COMPILATION_TYPE := EXECUTABLE
ihse@29156 74 else
ihse@29156 75 $$(error Unknown type: $$($1_TYPE))
ihse@29156 76 endif
ihse@29156 77
ihse@29156 78 # Locate all files with the matching prefix
ihse@29156 79 $1_FILE_LIST := \
erikj@55654 80 $$(call FindFiles, $$($1_SOURCE_DIRS), $$($1_PREFIX)*.c $$($1_PREFIX)*.cpp)
ihse@29156 81
ihse@49684 82 $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
ihse@49684 83 $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
ihse@49684 84
ihse@29156 85 # Setup a compilation for each and every one of them
ihse@49684 86 $$(foreach file, $$($1_FILTERED_FILE_LIST),\
ihse@49684 87 $$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
ihse@49684 88 $$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
ihse@29156 89 $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
ihse@49684 90 NAME := $$(unprefixed_name), \
ihse@49501 91 TYPE := $$($1_COMPILATION_TYPE), \
erikj@55313 92 EXTRA_FILES := $$(file), \
ihse@49684 93 OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
ihse@29156 94 OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
ihse@52600 95 CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
ihse@52600 96 CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
ihse@49684 97 LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
ihse@52653 98 DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \
ihse@52653 99 DISABLED_WARNINGS_clang := undef format-nonliteral \
ihse@52653 100 missing-field-initializers sometimes-uninitialized, \
ihse@52600 101 DISABLED_WARNINGS_CXX_solstudio := wvarhidenmem, \
ihse@49684 102 LIBS := $$($1_LIBS_$$(name)), \
iignatyev@52294 103 TOOLCHAIN := $(if $$(filter %.cpp, $$(file)), TOOLCHAIN_LINK_CXX, TOOLCHAIN_DEFAULT), \
sgehwolf@52261 104 OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
erikj@41260 105 COPY_DEBUG_SYMBOLS := false, \
sgehwolf@56177 106 STRIP_SYMBOLS := $$(if $$($1_STRIP_SYMBOLS_$$(name)),$$($1_STRIP_SYMBOLS_$$(name)),false), \
ihse@35032 107 )) \
ihse@29156 108 $$(eval $1 += $$(BUILD_TEST_$$(name)) ) \
ihse@29156 109 )
ihse@29156 110
ihse@29156 111 endef
ihse@29156 112
ihse@29156 113 endif # _TEST_FILES_COMPILATION_GMK