Commit 533dc055 authored by Graham Inggs's avatar Graham Inggs

Imported Upstream version 2.1~20080605

parent da7a2b13
This diff is collapsed.
......@@ -26,93 +26,50 @@
tbb_root?=.
include $(tbb_root)/build/common.inc
.PHONY: all tbb tbbmalloc test debug examples clean
.PHONY: default all tbb tbbmalloc test examples
all: release debug examples
#workaround for non-depend targets tbb and tbbmalloc which both depend on version_string.tmp
#According to documentation submakes should run in parallel
.NOTPARALLEL: tbb tbbmalloc
tbb: tbb_release tbb_debug
default: tbb tbbmalloc
tbbmalloc: tbbmalloc_release tbbmalloc_debug
all: tbb tbbmalloc test examples
test: tbbmalloc_test_release test_release tbbmalloc_test_debug test_debug
test_no_depends: tbbmalloc_test_release_no_depends test_release_no_depends tbbmalloc_test_debug_no_depends test_debug_no_depends
release: tbb_release tbbmalloc_release tbbmalloc_test_release test_release
debug: tbb_debug tbbmalloc_debug tbbmalloc_test_debug test_debug
examples: tbb tbbmalloc examples_debug clean_examples examples_release
clean: clean_release clean_debug clean_examples
@echo clean done
.PHONY: tbb_release tbb_debug test_release test_debug
# do not delete double-space after -C option
tbb_release: mkdir_release
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root)
tbb_debug: mkdir_debug
tbb: mkdir
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug tbb_root=$(tbb_root)
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root)
test_release: mkdir_release tbb_release test_release_no_depends
test_release_no_depends:
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root)
test_debug: tbb_debug mkdir_debug test_debug_no_depends
test_debug_no_depends:
-$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root)
.PHONY: tbbmalloc_release tbbmalloc_debug tbbmalloc_test_release tbbmalloc_test_debug
tbbmalloc_release: mkdir_release
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root)
tbbmalloc_debug: mkdir_debug
tbbmalloc: mkdir
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc tbb_root=$(tbb_root)
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root)
tbbmalloc_test_release: tbb_release tbbmalloc_release mkdir_release tbbmalloc_test_release_no_depends
tbbmalloc_test_release_no_depends:
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root)
tbbmalloc_test_debug: tbb_debug tbbmalloc_debug mkdir_debug tbbmalloc_test_debug_no_depends
tbbmalloc_test_debug_no_depends:
test: tbb tbbmalloc
-$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test tbb_root=$(tbb_root)
-$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root)
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root)
-$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root)
.PHONY: examples_release examples_debug
examples_release: tbb_release tbbmalloc_release
examples: tbb tbbmalloc
$(MAKE) -C examples -r -f Makefile tbb_root=.. release test
examples_debug: tbb_debug tbbmalloc_debug
$(MAKE) -C examples -r -f Makefile tbb_root=.. debug test
.PHONY: clean clean_examples mkdir info
.PHONY: clean_release clean_debug clean_examples
clean_%:
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root) $@
clean_release:
$(shell $(RM) $(work_dir)_release$(SLASH)*.* $(NUL))
$(shell $(RD) $(work_dir)_release $(NUL))
clean: clean_examples
$(shell $(RM) $(work_dir)_release$(SLASH)*.* >$(NUL) 2>$(NUL))
$(shell $(RD) $(work_dir)_release >$(NUL) 2>$(NUL))
$(shell $(RM) $(work_dir)_debug$(SLASH)*.* >$(NUL) 2>$(NUL))
$(shell $(RD) $(work_dir)_debug >$(NUL) 2>$(NUL))
@echo clean done
clean_debug:
$(shell $(RM) $(work_dir)_debug$(SLASH)*.* $(NUL))
$(shell $(RD) $(work_dir)_debug $(NUL))
clean_examples:
$(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean $(NUL))
$(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL))
.PHONY: mkdir_release mkdir_debug
mkdir_release:
$(shell $(MD) "$(work_dir)_release" $(NUL))
mkdir:
$(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL))
$(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_release" && $(MAKE_TBBVARS) $(tbb_build_prefix)_release)
mkdir_debug:
$(shell $(MD) "$(work_dir)_debug" $(NUL))
$(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL))
$(if $(subst undefined,,$(origin_build_dir)),,cd "$(work_dir)_debug" && $(MAKE_TBBVARS) $(tbb_build_prefix)_debug)
info:
......@@ -121,3 +78,4 @@ info:
@echo compiler=$(compiler)
@echo runtime=$(runtime)
@echo tbb_build_prefix=$(tbb_build_prefix)
Threading Building Blocks - README
To build and test, type 'gmake' in this directory.
See index.html for directions and documentation.
If source is present (./Makefile and src/ directories),
type 'gmake' in this directory to build and test.
See examples/index.html for runnable examples and directions.
See http://threadingbuildingblocks.org for full documentation
and software information.
......@@ -25,28 +25,29 @@
# the GNU General Public License.
COMPILE_ONLY = -c -MMD
PREPROC_ONLY = -E -MMD
PREPROC_ONLY = -E -x c
INCLUDE_KEY = -I
DEFINE_KEY = -D
OUTPUT_KEY = -o #
OUTPUTOBJ_KEY = -o #
PIC_KEY = -fPIC
WARNING_AS_ERROR_KEY = -Werror
WARNING_KEY = -Wall
DYLIB_KEY = -shared
LIBDL = -ldl
#LIBDL = -ldl
TBB_NOSTRICT = 1
CPLUS = g++
INCLUDES += -I$(tbb_root)/src/tbb -I$(tbb_root)/include -I$(tbb_root)/src
LIB_LINK_FLAGS = -shared
LIBS = -lpthread
LIBS = -lpthread
C_FLAGS = $(CPLUS_FLAGS) -x c
ifeq ($(cfg), release)
CPLUS_FLAGS = -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -D__linux__ -D__custom_linux__
CPLUS_FLAGS = -O2 -DUSE_PTHREAD
endif
ifeq ($(cfg), debug)
CPLUS_FLAGS = -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -D__linux__ -D__custom_linux__
CPLUS_FLAGS = -DTBB_DO_ASSERT -g -O0 -DUSE_PTHREAD
endif
ASM=
......@@ -55,9 +56,8 @@ ASM_FLAGS=
TBB_ASM.OBJ=
ifeq (itanium,$(arch))
# Position-independent code (PIC) is a must for IA-64
# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables
CPLUS_FLAGS += $(PIC_KEY)
$(PIC_KEY) =
endif
ifeq (em64t,$(arch))
......@@ -80,7 +80,7 @@ endif
ASSEMBLY_SOURCE=$(arch)-gas
ifeq (itanium,$(arch))
ASM=ias
ASM=as
TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o
endif
#------------------------------------------------------------------------------
......@@ -90,8 +90,9 @@ endif
#------------------------------------------------------------------------------
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
M_INCLUDES = $(INCLUDES) -I$(MALLOC_ROOT) -I$(MALLOC_SOURCE_ROOT)
M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.
#------------------------------------------------------------------------------
......@@ -28,15 +28,18 @@ ifndef arch
ifeq ($(shell uname -m),i386)
export arch:=ia32
endif
ifeq ($(shell uname -m),ia64)
export arch:=itanium
endif
ifeq ($(shell uname -m),amd64)
export arch:=em64t
endif
endif
ifndef runtime
gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//')
os_version:=$(shell uname -r)
os_kernel_version:=$(shell uname -r | sed -e 's/-.*$$//')
# export os_glibc_version_full:=$(shell rpm -qa | grep '^glibc-[0-9]' | sort -u | sed -e 's/^glibc-//')
# os_glibc_version:=$(shell echo "$(os_glibc_version_full)" | sed -e '2,$$d' -e 's/-.*$$//')
# export runtime:=cc$(gcc_version)_libc$(os_glibc_version)_kernel$(os_kernel_version)
export runtime:=cc$(gcc_version)_kernel$(os_kernel_version)
endif
......@@ -44,11 +47,12 @@ native_compiler := gcc
export compiler ?= gcc
debugger ?= gdb
CMD=$(SHELL) -c
CWD=$(shell pwd)
RM?=rm -f
RD?=rmdir
MD?=mkdir -p
NUL= > /dev/null 2>&1
NUL= /dev/null
SLASH=/
MAKE_VERSIONS=sh $(tbb_root)/build/version_info_linux.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp
MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh
......@@ -64,18 +68,12 @@ endif
OBJ = o
DLL = so
ifeq ($(cfg),debug)
DEBUG_SUFFIX = _debug
endif
TBB.DEF =
TBB.DLL = libtbb$(DEBUG_SUFFIX).$(DLL)
TBB.LIB = $(TBB.DLL)
LINK_TBB.LIB = $(TBB.LIB)
MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).so
MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL)
MALLOC.LIB = $(MALLOC.DLL)
TBB_NOSTRICT=1
......@@ -28,9 +28,10 @@
# Define rules for making the TBB shared library.
#------------------------------------------------------------------------------
tbb_root ?= "$(TBB20_INSTALL_DIR)"
tbb_root ?= "$(TBB21_INSTALL_DIR)"
BUILDING_PHASE=1
include $(tbb_root)/build/common.inc
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
#------------------------------------------------------------
# Define static pattern rules dealing with .cpp source files
......@@ -41,9 +42,9 @@ default_tbb: $(TBB.DLL)
.PHONY: default_tbb tbbvars clean
.PRECIOUS: %.$(OBJ)
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb
VPATH = $(tbb_root)/src/tbb/$(ASSEMBLY_SOURCE) $(tbb_root)/src/tbb $(tbb_root)/src/old
CPLUS_FLAGS += $(PIC_KEY) $(WARNING_KEY)
CPLUS_FLAGS += $(PIC_KEY) $(DEFINE_KEY)__TBB_BUILD=1
ifeq (1,$(TBB_NOSTRICT))
# GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict_ansi mode.
......@@ -51,12 +52,11 @@ ifeq (1,$(TBB_NOSTRICT))
# The files below need the -strict_ansi flag downgraded to -ansi to compile
KNOWN_NOSTRICT = concurrent_hash_map.o \
concurrent_vector_v2.o \
concurrent_vector.o
endif
include $(tbb_root)/build/common_rules.inc
# Object files (that were compiled from C++ code) that gmake up TBB
TBB_CPLUS.OBJ = concurrent_hash_map.$(OBJ) \
concurrent_queue.$(OBJ) \
......@@ -70,14 +70,42 @@ TBB_CPLUS.OBJ = concurrent_hash_map.$(OBJ) \
spin_mutex.$(OBJ) \
task.$(OBJ) \
tbb_misc.$(OBJ) \
mutex.$(OBJ)
mutex.$(OBJ) \
recursive_mutex.$(OBJ) \
tbb_thread.$(OBJ)
# OLD/Legacy object files for backward binary compatibility
ifeq (,$(findstring $(DEFINE_KEY)TBB_NO_LEGACY,$(CPLUS_FLAGS)))
TBB_CPLUS_OLD.OBJ = \
concurrent_vector_v2.$(OBJ) \
concurrent_queue_v2.$(OBJ) \
spin_rw_mutex_v2.$(OBJ)
endif
# Object files that gmake up TBB (TBB_ASM.OBJ is platform-specific)
TBB.OBJ = $(TBB_CPLUS.OBJ) $(TBB_ASM.OBJ)
TBB.OBJ = $(TBB_CPLUS.OBJ) $(TBB_CPLUS_OLD.OBJ) $(TBB_ASM.OBJ)
# Suppress superfluous warnings for TBB compilation
WARNING_KEY += $(WARNING_SUPPRESS)
include $(tbb_root)/build/common_rules.inc
ifneq (,$(TBB.DEF))
tbb.def: $(TBB.DEF)
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(TBB.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbb.def 2>$(NUL) || exit 0"
$(TBB.DLL): $(TBB.OBJ) $(TBB.DEF) $(TBB.RES) tbbvars
$(CPLUS) $(TBB.OBJ) $(TBB.RES) $(LIBS) $(PIC_KEY) $(OUTPUT_KEY)$(TBB.DLL) $(LIB_LINK_FLAGS)
LIB_LINK_FLAGS += $(EXPORT_KEY)tbb.def
$(TBB.DLL): tbb.def
endif
$(TBB.DLL): BUILDING_LIBRARY = $(TBB.DLL)
$(TBB.DLL): $(TBB.OBJ) $(TBB.RES) tbbvars $(TBB_NO_VERSION.DLL)
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(TBB.DLL) $(TBB.OBJ) $(TBB.RES) $(LIB_LINK_LIBS) $(LIB_LINK_FLAGS)
ifneq (,$(TBB_NO_VERSION.DLL))
$(TBB_NO_VERSION.DLL):
echo "INPUT ($(TBB.DLL))" > $(TBB_NO_VERSION.DLL)
endif
#clean:
# $(RM) *.$(OBJ) *.$(DLL) *.res *.map *.ilk *.pdb *.exp *.manifest *.tmp *.d core core.*[0-9][0-9]
......
......@@ -24,15 +24,13 @@
# invalidate any other reasons why the executable file might be covered by
# the GNU General Public License.
#------------------------------------------------------
# Define rules for making the TBBMalloc shared library.
#------------------------------------------------------
default_malloc: malloc malloc_test
tbb_root ?= $(TBB20_INSTALL_DIR)
tbb_root ?= $(TBB21_INSTALL_DIR)
BUILDING_PHASE=1
include $(tbb_root)/build/common.inc
DEBUG_SUFFIX=$(findstring _debug,_$(cfg))
# default target
default_malloc: malloc malloc_test
MALLOC_ROOT ?= $(tbb_root)/src/tbbmalloc
MALLOC_SOURCE_ROOT ?= $(MALLOC_ROOT)
......@@ -40,16 +38,15 @@ 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)
# the test lists defined here because they are first used right after
MALLOC_MAIN_TESTS = test_ScalableAllocator.exe test_ScalableAllocator_STL.exe test_malloc_compliance.exe
MALLOC_C_TESTS = test_malloc_pure_c.exe
$(MALLOC_MAIN_TESTS) $(MALLOC_C_TESTS): CPLUS_FLAGS += $(WARNING_KEY)
KNOWN_NOSTRICT = test_malloc_compliance.$(OBJ) test_ScalableAllocator_STL.$(OBJ)
KNOWN_NOSTRICT = test_ScalableAllocator_STL.$(OBJ) #test_malloc_compliance.$(OBJ)
KNOWN_WARNINGS = test_malloc_compliance.$(OBJ)
include $(tbb_root)/build/common_rules.inc
#------------------------------------------------------
# Define rules for making the TBBMalloc shared library.
#------------------------------------------------------
# Object files that gmake up TBBMalloc
MALLOC_CPLUS.OBJ = tbbmalloc.$(OBJ)
MALLOC_CUSTOM.OBJ += tbb_misc_malloc.$(OBJ)
......@@ -58,7 +55,11 @@ MALLOC_ASM.OBJ = $(TBB_ASM.OBJ)
# MALLOC_CPLUS.OBJ is built in two steps due to Intel Compiler Tracker # C69574
MALLOC.OBJ := $(MALLOC_CPLUS.OBJ) $(MALLOC_ASM.OBJ) $(MALLOC_CUSTOM.OBJ) MemoryAllocator.$(OBJ)
MALLOC_CPLUS.OBJ += MemoryAllocator.$(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)
$(MALLOC_CPLUS.OBJ): %.$(OBJ): %.cpp
$(CPLUS) $(COMPILE_ONLY) $(M_CPLUS_FLAGS) $(PIC_KEY) $(M_INCLUDES) $<
......@@ -66,10 +67,22 @@ $(MALLOC_CPLUS.OBJ): %.$(OBJ): %.cpp
tbb_misc_malloc.$(OBJ): tbb_misc.cpp version_string.tmp
$(CPLUS) $(COMPILE_ONLY) $(subst -strict_ansi,-ansi,$(M_CPLUS_FLAGS)) $(PIC_KEY) $(OUTPUTOBJ_KEY)$@ $(INCLUDE_KEY). $(INCLUDES) $<
ifneq (,$(MALLOC.DEF))
tbbmalloc.def: $(MALLOC.DEF)
$(CMD) "$(CPLUS) $(PREPROC_ONLY) $(MALLOC.DEF) $(filter $(DEFINE_KEY)%,$(CPLUS_FLAGS)) >tbbmalloc.def 2>$(NUL) || exit 0"
LIB_LINK_FLAGS += $(EXPORT_KEY)tbbmalloc.def
$(MALLOC.DLL): tbbmalloc.def
endif
$(MALLOC.DLL): TBB.DEF=$(MALLOC.DEF)
$(MALLOC.DLL): $(MALLOC.OBJ) $(MALLOC.DEF) $(TBBMALLOC.RES)
$(CPLUS) $(MALLOC.OBJ) $(TBBMALLOC.RES) $(LIBS) $(PIC_KEY) $(OUTPUT_KEY)$(MALLOC.DLL) $(LIB_LINK_FLAGS)
$(MALLOC.DLL): BUILDING_LIBRARY = $(MALLOC.DLL)
$(MALLOC.DLL): $(MALLOC.OBJ) $(TBBMALLOC.RES) $(MALLOC_NO_VERSION.DLL)
$(LIB_LINK_CMD) $(LIB_OUTPUT_KEY)$(MALLOC.DLL) $(MALLOC.OBJ) $(TBBMALLOC.RES) $(LIB_LINK_LIBS) $(LIB_LINK_FLAGS)
ifneq (,$(MALLOC_NO_VERSION.DLL))
$(MALLOC_NO_VERSION.DLL):
echo "INPUT ($(MALLOC.DLL))" > $(MALLOC_NO_VERSION.DLL)
endif
malloc: $(MALLOC.DLL)
......@@ -81,21 +94,29 @@ malloc: $(MALLOC.DLL)
# Define rules for making the TBBMalloc unit tests
#------------------------------------------------------
add_debug=$(basename $(1))_debug