You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
4.9 KiB

  1. # Copyright 2005-2013 Intel Corporation. All Rights Reserved.
  2. #
  3. # This file is part of Threading Building Blocks.
  4. #
  5. # Threading Building Blocks is free software; you can redistribute it
  6. # and/or modify it under the terms of the GNU General Public License
  7. # version 2 as published by the Free Software Foundation.
  8. #
  9. # Threading Building Blocks is distributed in the hope that it will be
  10. # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  11. # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with Threading Building Blocks; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #
  18. # As a special exception, you may use this file as part of a free software
  19. # library without restriction. Specifically, if other files instantiate
  20. # templates or use macros or inline functions from this file, or you compile
  21. # this file and link it with other files to produce an executable, this
  22. # file does not by itself cause the resulting executable to be covered by
  23. # the GNU General Public License. This exception does not however
  24. # invalidate any other reasons why the executable file might be covered by
  25. # the GNU General Public License.
  26. COMPILE_ONLY = -c -MMD
  27. PREPROC_ONLY = -E -x c++
  28. INCLUDE_KEY = -I
  29. DEFINE_KEY = -D
  30. OUTPUT_KEY = -o #
  31. OUTPUTOBJ_KEY = -o #
  32. PIC_KEY = -fPIC
  33. WARNING_AS_ERROR_KEY = -Werror
  34. WARNING_KEY = -Wall
  35. TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor -Wextra
  36. WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor
  37. DYLIB_KEY = -shared
  38. EXPORT_KEY = -Wl,--version-script,
  39. LIBDL = -ldl
  40. TBB_NOSTRICT = 1
  41. CPLUS = $(tbb_tool_prefix)g++
  42. CONLY = $(tbb_tool_prefix)gcc
  43. # -soname is necessary for proper linkage to TBB prebuilt libraries when building application with Android SDK
  44. LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
  45. LINK_FLAGS = -Wl,-rpath-link=.
  46. C_FLAGS = $(CPLUS_FLAGS)
  47. # gcc 4.4 and higher support C++11
  48. ifneq (,$(shell $(CPLUS) -dumpversion | egrep "^(4\.[4-9]|[5-9])"))
  49. # On Android/gcc 4.4.3, -std=c++0x causes ::int64_t and ::uint64_t to be undefined.
  50. CPP11_FLAGS = -std=gnu++0x $(DEFINE_KEY)_TBB_CPP0X
  51. endif
  52. ifeq ($(cfg), release)
  53. CPLUS_FLAGS = -O2
  54. endif
  55. ifeq ($(cfg), debug)
  56. CPLUS_FLAGS = -g -O0 $(DEFINE_KEY)TBB_USE_DEBUG
  57. endif
  58. CPLUS_FLAGS += $(DEFINE_KEY)USE_PTHREAD $(DEFINE_KEY)_GLIBCXX_HAVE_FENV_H
  59. ifneq (,$(findstring $(arch),ia32 intel64))
  60. CPLUS_FLAGS += $(DEFINE_KEY)DO_ITT_NOTIFY
  61. endif
  62. ifneq (0, $(dlopen_workaround))
  63. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_USE_DLOPEN_REENTRANCY_WORKAROUND=1
  64. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_USE_DLOPEN_MAIN_PROGRAM_WORKAROUND=1
  65. else
  66. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_USE_DLOPEN_REENTRANCY_WORKAROUND=0
  67. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_USE_DLOPEN_MAIN_PROGRAM_WORKAROUND=0
  68. endif
  69. ifeq (0, $(dynamic_load))
  70. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_DYNAMIC_LOAD_ENABLED=0
  71. endif
  72. # Paths to the NDK prebuilt tools and libraries
  73. CPLUS_FLAGS += --sysroot=$(SYSROOT)
  74. LIB_LINK_FLAGS += --sysroot=$(SYSROOT)
  75. LIBS = -L$(CPLUS_LIB_PATH) -lgnustl_shared
  76. # This causes CPP11_FLAGS to be issued twice for test_lambda.cpp
  77. # TODO: Fix this in general for all platforms once the correct strategy is determined.
  78. ifneq (00,$(lambdas)$(cpp0x))
  79. CXX_ONLY_FLAGS += $(CPP11_FLAGS)
  80. endif
  81. ifeq (ia32,$(arch))
  82. # TODO: Determine best setting of -march and add to CPLUS_FLAGS
  83. CPLUS_FLAGS += -m32
  84. LIB_LINK_FLAGS += -m32
  85. endif
  86. # Currently, no intel64 support for Android, but if added later, these flags may suffice
  87. ifeq (intel64,$(arch))
  88. CPLUS_FLAGS += -m64
  89. LIB_LINK_FLAGS += -m64
  90. endif
  91. ifeq (arm,$(findstring arm,$(arch)))
  92. CPLUS_FLAGS += -march=armv7-a $(DEFINE_KEY)TBB_USE_GCC_BUILTINS=1 $(DEFINE_KEY)__TBB_64BIT_ATOMICS=0
  93. endif
  94. #------------------------------------------------------------------------------
  95. # Setting assembler data.
  96. #------------------------------------------------------------------------------
  97. TBB_ASM.OBJ=
  98. MALLOC_ASM.OBJ=
  99. ASM = $(tbb_tool_prefix)as
  100. ifeq (intel64,$(arch))
  101. ASM_FLAGS += --64
  102. endif
  103. ifeq (ia32,$(arch))
  104. ASM_FLAGS += --32
  105. endif
  106. ifeq ($(cfg),debug)
  107. ASM_FLAGS += -g
  108. endif
  109. ASSEMBLY_SOURCE=$(arch)-gas
  110. #------------------------------------------------------------------------------
  111. # End of setting assembler data.
  112. #------------------------------------------------------------------------------
  113. #------------------------------------------------------------------------------
  114. # Setting tbbmalloc data.
  115. #------------------------------------------------------------------------------
  116. M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2
  117. #------------------------------------------------------------------------------
  118. # End of setting tbbmalloc data.
  119. #------------------------------------------------------------------------------