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.

170 lines
8.6 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. ifneq (mic,$(offload))
  27. $(error File mic.offload.inc should not be included directly. Use offload=mic instead.)
  28. endif
  29. ifneq (icc,$(compiler))
  30. $(error Only Intel(R) Compiler is supported for MIC offload compilation)
  31. endif
  32. tbb_offload_build_prefix?=mic_offload_icc$(CPF_SUFFIX)
  33. # The same build prefix should be used in mic.linux.inc
  34. export tbb_mic_build_prefix?=mic_icc$(CPF_SUFFIX)
  35. initial_tbb_root:=$(tbb_root)
  36. ifndef BUILDING_PHASE
  37. tbb_native_debug:
  38. $(MAKE) tbb_debug target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  39. tbb_native_release:
  40. $(MAKE) tbb_release target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  41. tbbmalloc_native_debug:
  42. $(MAKE) tbbmalloc_debug target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  43. tbbmalloc_native_release:
  44. $(MAKE) tbbmalloc_release target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  45. rml_native_debug:
  46. $(MAKE) rml_debug target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  47. rml_native_release:
  48. $(MAKE) rml_release target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  49. tbb_native:
  50. $(MAKE) tbb target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  51. tbbmalloc_native:
  52. $(MAKE) tbbmalloc target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  53. rml_native:
  54. $(MAKE) rml target=mic compiler=icc offload= tbb_root=$(initial_tbb_root)
  55. tbb_host_debug:
  56. $(MAKE) tbb_debug compiler=icc offload= tbb_root=$(initial_tbb_root)
  57. tbb_host_release:
  58. $(MAKE) tbb_release compiler=icc offload= tbb_root=$(initial_tbb_root)
  59. tbbmalloc_host_debug:
  60. $(MAKE) tbbmalloc_debug compiler=icc offload= tbb_root=$(initial_tbb_root)
  61. tbbmalloc_host_release:
  62. $(MAKE) tbbmalloc_release compiler=icc offload= tbb_root=$(initial_tbb_root)
  63. # The work_dir variable can not be set via target-specific variable mechanism
  64. # since it will affect other targets on which the target depends.
  65. # So work_dir is set via eval function inside the recipe.
  66. prepare_test_offload_dir_debug: initial_tbb_build_dir:=$(tbb_build_dir)
  67. prepare_test_offload_dir_debug: tbb_host_debug tbbmalloc_host_debug tbb_native_debug tbbmalloc_native_debug
  68. $(eval work_dir=$(initial_tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix))
  69. $(shell $(MD) "$(work_dir)_debug$(SLASH)mic" >$(NUL) 2>$(NUL))
  70. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_build_prefix)_debug$(SLASH)lib"* "$(work_dir)_debug" >$(NUL) 2>$(NUL))
  71. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_mic_build_prefix)_debug$(SLASH)lib"* "$(work_dir)_debug$(SLASH)mic" >$(NUL) 2>$(NUL))
  72. $(eval export TEST_COMPILATION=1)
  73. prepare_test_offload_dir_release: initial_tbb_build_dir:=$(tbb_build_dir)
  74. prepare_test_offload_dir_release: tbb_host_release tbbmalloc_host_release tbb_native_release tbbmalloc_native_release
  75. $(eval work_dir=$(initial_tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix))
  76. $(shell $(MD) "$(work_dir)_release$(SLASH)mic" >$(NUL) 2>$(NUL))
  77. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_build_prefix)_release$(SLASH)lib"* "$(work_dir)_release" >$(NUL) 2>$(NUL))
  78. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_mic_build_prefix)_release$(SLASH)lib"* "$(work_dir)_release$(SLASH)mic" >$(NUL) 2>$(NUL))
  79. $(eval export TEST_COMPILATION=1)
  80. prepare_test_offload_dir: initial_tbb_build_dir:=$(tbb_build_dir)
  81. prepare_test_offload_dir: tbb tbbmalloc tbb_native tbbmalloc_native
  82. $(eval work_dir=$(initial_tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix))
  83. $(shell $(MD) "$(work_dir)_debug$(SLASH)mic" >$(NUL) 2>$(NUL))
  84. $(shell $(MD) "$(work_dir)_release$(SLASH)mic" >$(NUL) 2>$(NUL))
  85. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_build_prefix)_debug$(SLASH)lib"* "$(work_dir)_debug" >$(NUL) 2>$(NUL))
  86. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_build_prefix)_release$(SLASH)lib"* "$(work_dir)_release" >$(NUL) 2>$(NUL))
  87. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_mic_build_prefix)_debug$(SLASH)lib"* "$(work_dir)_debug$(SLASH)mic" >$(NUL) 2>$(NUL))
  88. $(shell $(CP) "$(initial_tbb_build_dir)$(SLASH)$(tbb_mic_build_prefix)_release$(SLASH)lib"* "$(work_dir)_release$(SLASH)mic" >$(NUL) 2>$(NUL))
  89. $(eval export TEST_COMPILATION=1)
  90. test: prepare_test_offload_dir
  91. tbb_test_debug: prepare_test_offload_dir_debug
  92. tbb_test_release: prepare_test_offload_dir_release
  93. tbbmalloc_test_debug: prepare_test_offload_dir_debug
  94. tbbmalloc_test_release: prepare_test_offload_dir_release
  95. rml_test_debug: rml_native_debug prepare_test_offload_dir_debug
  96. rml_test_release: rml_native_release prepare_test_offload_dir_release
  97. debug_% test_% stress_% time_% perf_%:: work_dir:=$(tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix)
  98. debug_% test_% stress_% time_% perf_%:: export TEST_COMPILATION=1
  99. clean: work_dir:=$(tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix)
  100. # The _clean* targets begin with an underscore symbol to prevent a collision with the clean_% template
  101. clean: _clean_mic_subdir_debug _clean_mic_subdir_release _clean_host _clean_mic
  102. clean_release: work_dir:=$(tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix)
  103. clean_release: _clean_mic_subdir_release _clean_host_release _clean_mic_release
  104. clean_debug: work_dir:=$(tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix)
  105. clean_debug: _clean_mic_subdir_debug _clean_host_debug _clean_mic_debug
  106. clean_%:: work_dir:=$(tbb_build_dir)$(SLASH)$(tbb_offload_build_prefix)
  107. _clean_mic_subdir_debug:
  108. $(shell $(RM) $(work_dir)_debug$(SLASH)mic/$(SLASH)*.* >$(NUL) 2>$(NUL))
  109. $(shell $(RD) $(work_dir)_debug$(SLASH)mic >$(NUL) 2>$(NUL))
  110. _clean_mic_subdir_release:
  111. $(shell $(RM) $(work_dir)_release$(SLASH)mic/$(SLASH)*.* >$(NUL) 2>$(NUL))
  112. $(shell $(RD) $(work_dir)_release$(SLASH)mic >$(NUL) 2>$(NUL))
  113. _clean_host:
  114. $(MAKE) clean tbb_root=$(initial_tbb_root) offload=
  115. _clean_mic:
  116. $(MAKE) clean target=mic tbb_root=$(initial_tbb_root) offload=
  117. _clean_host_release:
  118. $(MAKE) clean_release tbb_root=$(initial_tbb_root) offload=
  119. _clean_host_debug:
  120. $(MAKE) clean_debug tbb_root=$(initial_tbb_root) offload=
  121. _clean_mic_release:
  122. $(MAKE) clean_release target=mic tbb_root=$(initial_tbb_root) offload=
  123. _clean_mic_debug:
  124. $(MAKE) clean_debug target=mic tbb_root=$(initial_tbb_root) offload=
  125. endif
  126. ifeq ($(TEST_COMPILATION),1)
  127. ifdef MIC_LD_LIBRARY_PATH
  128. export MIC_LD_LIBRARY_PATH := ./mic:$(MIC_LD_LIBRARY_PATH)
  129. else
  130. export MIC_LD_LIBRARY_PATH := ./mic
  131. endif
  132. LINK_TBB.LIB=-offload-option,mic,ld,"./mic/$(TBB.LIB)" $(TBB.LIB)
  133. LINK_MALLOC_LIB=-offload-option,mic,ld,"./mic/$(MALLOC.DLL)" $(MALLOC.DLL)
  134. LINK_MALLOC_PROXY_LIB=-offload-option,mic,ld,"./mic/$(MALLOCPROXY.DLL)" $(MALLOCPROXY.DLL)
  135. LINK_FLAGS =
  136. LIB_LINK_FLAGS += $(DYLIB_KEY)
  137. # Do not use -Werror because it is too strict for the early offload compiler.
  138. # Need to set anything because WARNING_AS_ERROR_KEY should not be empty.
  139. # Treat #2426 as a warning. Print errors only.
  140. tbb_strict=0
  141. override WARNING_AS_ERROR_KEY = Warning as error
  142. override WARNING_KEY = -diag-warning 2426 -w0
  143. # Enable mic-specific stuff.
  144. CXX_MIC_STUFF = -offload-attribute-target=mic -D__TBB_MIC_OFFLOAD=1 \
  145. -offload-option,mic,compiler,"-D__TBB_MIC_OFFLOAD=1 -DHARNESS_INCOMPLETE_SOURCES=1 -D__TBB_MIC_NATIVE -DTBB_USE_EXCEPTIONS=0"
  146. CPLUS_FLAGS += $(CXX_MIC_STUFF)
  147. export OFFLOAD_EXECUTION = 1
  148. # Workaround to skip the RML tests in the offload mode
  149. TBB_DEP_NON_RML_TEST =
  150. TBB_DEP_RML_TEST =
  151. RML_TBB_CLIENT.OBJ =
  152. RML_OMP_CLIENT.OBJ =
  153. endif
  154. # detects whether examples are being built.
  155. ifeq ($(BUILDING_PHASE),0)
  156. export UI = con
  157. export x64 = 64
  158. endif # examples