1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
# Copyright 2005-2011 Intel Corporation. All Rights Reserved.
#
# This file is part of Threading Building Blocks.
#
# Threading Building Blocks is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# Threading Building Blocks is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Threading Building Blocks; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# As a special exception, you may use this file as part of a free software
# library without restriction. Specifically, if other files instantiate
# templates or use macros or inline functions from this file, or you compile
# this file and link it with other files to produce an executable, this
# file does not by itself cause the resulting executable to be covered by
# the GNU General Public License. This exception does not however
# invalidate any other reasons why the executable file might be covered by
# the GNU General Public License.
# default target
default_malloc: malloc malloc_test
tbb_root ?= $(TBBROOT)
BUILDING_PHASE=1
TEST_RESOURCE = $(MALLOC.RES)
include $(tbb_root)/build/common.inc
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
MALLOC_ROOT ?= $(tbb_root)/src/tbbmalloc
MALLOC_SOURCE_ROOT ?= $(MALLOC_ROOT)
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/test
VPATH += $(MALLOC_ROOT) $(MALLOC_SOURCE_ROOT)
CPLUS_FLAGS += $(if $(crosstest),$(DEFINE_KEY)__TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
include $(tbb_root)/build/common_rules.inc
#------------------------------------------------------
# Define rules for making the TBBMalloc shared library.
#------------------------------------------------------
# Object files that make up TBBMalloc
MALLOC_CPLUS.OBJ = frontend.$(OBJ) backend.$(OBJ) large_objects.$(OBJ) backref.$(OBJ)
MALLOC.OBJ := $(MALLOC_CPLUS.OBJ) $(MALLOC_ASM.OBJ) itt_notify_malloc.$(OBJ) tbbmalloc.$(OBJ)
PROXY.OBJ := proxy.$(OBJ) tbb_function_replacement.$(OBJ)
M_CPLUS_FLAGS := $(subst $(WARNING_KEY),,$(M_CPLUS_FLAGS)) $(DEFINE_KEY)__TBB_BUILD=1
M_INCLUDES = $(INCLUDES) $(INCLUDE_KEY)$(MALLOC_ROOT) $(INCLUDE_KEY)$(MALLOC_SOURCE_ROOT)
# Suppress superfluous warnings for TBBmalloc compilation
$(MALLOC.OBJ): M_CPLUS_FLAGS += $(WARNING_SUPPRESS)
tbbmalloc.$(OBJ): tbbmalloc.cpp version_string.tmp
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $(INCLUDE_KEY). $<
$(PROXY.OBJ): %.$(OBJ): %.cpp
$(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $<
$(MALLOC_CPLUS.OBJ): %.$(OBJ): %.cpp
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $<
itt_notify_malloc.$(OBJ): itt_notify.cpp
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(OUTPUTOBJ_KEY)$@ $(INCLUDES) $<
MALLOC_LINK_FLAGS = $(LIB_LINK_FLAGS)
PROXY_LINK_FLAGS = $(LIB_LINK_FLAGS)
ifneq (,$(MALLOC.DEF))
tbbmalloc.def: $(MALLOC.DEF)
$(CPLUS) $(PREPROC_ONLY) $< $(CPLUS_FLAGS) $(INCLUDES) > $@
MALLOC_LINK_FLAGS += $(EXPORT_KEY)tbbmalloc.def
$(MALLOC.DLL): tbbmalloc.def
endif
$(MALLOC.DLL): BUILDING_LIBRARY = $(MALLOC.DLL)
$(MALLOC.DLL): $(MALLOC.OBJ) $(MALLOC.RES) $(MALLOC_NO_VERSION.DLL)
$(subst $(CPLUS),$(CONLY),$(LIB_LINK_CMD)) $(LIB_OUTPUT_KEY)$(MALLOC.DLL) $(MALLOC.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(MALLOC_LINK_FLAGS)
ifneq (,$(MALLOCPROXY.DEF))
tbbmallocproxy.def: $(MALLOCPROXY.DEF)
$(CPLUS) $(PREPROC_ONLY) $< $(CPLUS_FLAGS) $(INCLUDES) > $@
PROXY_LINK_FLAGS += $(EXPORT_KEY)tbbmallocproxy.def
$(MALLOCPROXY.DLL): tbbmallocproxy.def
endif
ifneq (,$(MALLOCPROXY.DLL))
$(MALLOCPROXY.DLL): BUILDING_LIBRARY = $(MALLOCPROXY.DLL)
$(MALLOCPROXY.DLL): $(PROXY.OBJ) $(MALLOCPROXY_NO_VERSION.DLL) $(MALLOC.DLL) $(MALLOC.RES)
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOCPROXY.DLL) $(PROXY.OBJ) $(MALLOC.RES) $(LIB_LINK_LIBS) $(LINK_MALLOC.LIB) $(PROXY_LINK_FLAGS)
endif
ifneq (,$(MALLOC_NO_VERSION.DLL))
$(MALLOC_NO_VERSION.DLL):
echo "INPUT ($(MALLOC.DLL))" > $(MALLOC_NO_VERSION.DLL)
endif
ifneq (,$(MALLOCPROXY_NO_VERSION.DLL))
$(MALLOCPROXY_NO_VERSION.DLL):
echo "INPUT ($(MALLOCPROXY.DLL))" > $(MALLOCPROXY_NO_VERSION.DLL)
endif
malloc: $(MALLOC.DLL) $(MALLOCPROXY.DLL)
malloc_dll: $(MALLOC.DLL)
malloc_proxy_dll: $(MALLOCPROXY.DLL)
.PHONY: malloc malloc_dll malloc_proxy_dll
#------------------------------------------------------
# End of rules for making the TBBMalloc shared library
#------------------------------------------------------
#------------------------------------------------------
# Define rules for making the TBBMalloc unit tests
#------------------------------------------------------
add_debug=$(basename $(1))_debug$(suffix $(1))
cross_suffix=$(if $(crosstest),$(if $(DEBUG_SUFFIX),$(subst _debug,,$(1)),$(call add_debug,$(1))),$(1))
MALLOC_MAIN_TESTS = test_ScalableAllocator.$(TEST_EXT) \
test_ScalableAllocator_STL.$(TEST_EXT) \
test_malloc_compliance.$(TEST_EXT) \
test_malloc_regression.$(TEST_EXT) \
test_malloc_init_shutdown.$(TEST_EXT) \
test_malloc_pools.$(TEST_EXT)
MALLOC_OVERLOAD_TESTS = test_malloc_overload.$(TEST_EXT) test_malloc_overload_proxy.$(TEST_EXT) test_malloc_atexit.$(TEST_EXT)
MALLOC_LIB = $(call cross_suffix,$(MALLOC.LIB))
MALLOC_PROXY_LIB = $(call cross_suffix,$(MALLOCPROXY.LIB))
ifeq (windows.gcc,$(tbb_os).$(compiler))
test_malloc_overload.$(TEST_EXT): LIBS += $(MALLOC_PROXY_LIB)
endif
test_malloc_overload.$(TEST_EXT): test_malloc_overload.cpp
$(CPLUS) $(OUTPUT_KEY)$@ $(subst /MT,/MD,$(M_CPLUS_FLAGS)) $(M_INCLUDES) $< $(LIBDL) $(LIBS) $(LINK_FLAGS)
test_malloc_overload_proxy.$(TEST_EXT): test_malloc_overload.cpp $(MALLOC_PROXY_LIB)
$(CPLUS) $(OUTPUT_KEY)$@ $(subst /MT,/MD,$(M_CPLUS_FLAGS)) $(M_INCLUDES) $< $(LIBDL) $(MALLOC_PROXY_LIB) $(LIBS) $(LINK_FLAGS)
test_malloc_whitebox.$(TEST_EXT): test_malloc_whitebox.cpp $(MALLOC_ASM.OBJ) version_string.tmp
$(CPLUS) $(OUTPUT_KEY)$@ $(M_CPLUS_FLAGS) $(M_INCLUDES) $(INCLUDE_KEY). $< $(MALLOC_ASM.OBJ) $(LIBS) $(LIBDL) $(LINK_FLAGS)
test_malloc_lib_unload.$(TEST_EXT): test_malloc_lib_unload.cpp test_malloc_lib_unload_dll.$(DLL)
$(CPLUS) $(OUTPUT_KEY)$@ $(M_CPLUS_FLAGS) $(M_INCLUDES) $< $(LIBS) test_malloc_lib_unload_dll.$(LIBEXT) $(LIBDL) $(LINK_FLAGS)
$(MALLOC_MAIN_TESTS): %.$(TEST_EXT): %.$(OBJ) $(MALLOC_LIB)
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(MALLOC_LIB) $(LIBS) $(LINK_FLAGS)
ifeq (,$(NO_C_TESTS))
MALLOC_C_TESTS = test_malloc_pure_c.$(TEST_EXT)
$(MALLOC_C_TESTS): %.$(TEST_EXT): %.$(OBJ) $(MALLOC_LIB)
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $^ $(LIBS) $(LINK_FLAGS)
endif
# Rules for generating a test DLL
%_dll.$(DLL): %_dll.$(OBJ)
$(LIB_LINK_CMD) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $(PIC_KEY) $< $(LIBS) $(DYLIB_KEY) $(LIB_LINK_FLAGS)
test_malloc_atexit.$(TEST_EXT): test_malloc_atexit.$(OBJ) test_malloc_atexit_dll.$(DLL)
$(CPLUS) $(OUTPUT_KEY)$@ $(CPLUS_FLAGS) $< $(MALLOC_PROXY_LIB) $(MALLOC_LIB) test_malloc_atexit_dll.$(LIBEXT) $(LIBS) $(LINK_FLAGS)
MALLOC_TESTS = $(MALLOC_MAIN_TESTS) $(MALLOC_C_TESTS) test_malloc_whitebox.$(TEST_EXT)
ifneq (,$(MALLOCPROXY.DLL))
MALLOC_TESTS += $(MALLOC_OVERLOAD_TESTS) test_malloc_lib_unload.$(TEST_EXT)
endif
# run_cmd is usually empty
malloc_test: $(call cross_suffix,$(MALLOC.DLL)) malloc_test_no_depends
malloc_test_no_depends: $(TEST_PREREQUISITE) $(MALLOC_TESTS)
$(run_cmd) ./test_malloc_pools.$(TEST_EXT) $(args) 1:4
ifneq (,$(MALLOCPROXY.DLL))
$(run_cmd) ./test_malloc_atexit.$(TEST_EXT) $(args)
$(run_cmd) ./test_malloc_lib_unload.$(TEST_EXT) $(args)
$(run_cmd) $(TEST_LAUNCHER) -l $(call cross_suffix,$(MALLOCPROXY.DLL)) test_malloc_overload.$(TEST_EXT) $(args)
$(run_cmd) $(TEST_LAUNCHER) test_malloc_overload_proxy.$(TEST_EXT) $(args)
endif
$(run_cmd) ./test_malloc_whitebox.$(TEST_EXT) $(args) 1:4
$(run_cmd) $(TEST_LAUNCHER) test_malloc_compliance.$(TEST_EXT) $(args) 1:4
$(run_cmd) ./test_ScalableAllocator.$(TEST_EXT) $(args)
$(run_cmd) ./test_ScalableAllocator_STL.$(TEST_EXT) $(args)
$(run_cmd) ./test_malloc_regression.$(TEST_EXT) $(args)
$(run_cmd) ./test_malloc_init_shutdown.$(TEST_EXT) $(args)
ifeq (,$(NO_C_TESTS))
$(run_cmd) ./test_malloc_pure_c.$(TEST_EXT) $(args)
endif
#------------------------------------------------------
# End of rules for making the TBBMalloc unit tests
#------------------------------------------------------
# Include automatically generated dependences
-include *.d
|