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.

129 lines
4.5 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. ifeq ($(tbb_strict),1)
  27. ifeq ($(WARNING_AS_ERROR_KEY),)
  28. $(error WARNING_AS_ERROR_KEY is empty)
  29. endif
  30. # Do not remove line below!
  31. WARNING_KEY += $(WARNING_AS_ERROR_KEY)
  32. endif
  33. ifndef TEST_EXT
  34. TEST_EXT = exe
  35. endif
  36. .PRECIOUS: %.$(OBJ) %.$(TEST_EXT) %.res
  37. INCLUDES += $(INCLUDE_KEY)$(tbb_root)/src $(INCLUDE_KEY)$(tbb_root)/src/rml/include $(INCLUDE_KEY)$(tbb_root)/include
  38. CPLUS_FLAGS += $(WARNING_KEY) $(CXXFLAGS)
  39. ifeq ($(tbb_cpf),1)
  40. CPLUS_FLAGS += $(DEFINE_KEY)__TBB_CPF_BUILD=1
  41. endif
  42. LINK_FLAGS += $(LDFLAGS)
  43. LIB_LINK_FLAGS += $(LDFLAGS)
  44. CPLUS_FLAGS_NOSTRICT = $(subst -strict-ansi,-ansi,$(CPLUS_FLAGS))
  45. LIB_LINK_CMD ?= $(CPLUS) $(PIC_KEY)
  46. ifeq ($(origin LIB_OUTPUT_KEY), undefined)
  47. LIB_OUTPUT_KEY = $(OUTPUT_KEY)
  48. endif
  49. ifeq ($(origin LIB_LINK_LIBS), undefined)
  50. LIB_LINK_LIBS = $(LIBDL) $(LIBS)
  51. endif
  52. CONLY ?= $(CPLUS)
  53. # The most generic rules
  54. %.$(OBJ): %.cpp
  55. $(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDES) $<
  56. %.$(OBJ): %.c
  57. $(CONLY) $(COMPILE_ONLY) $(C_FLAGS) $(INCLUDES) $<
  58. %.$(OBJ): %.asm
  59. $(ASM) $(ASM_FLAGS) $<
  60. %.$(OBJ): %.s
  61. cpp <$< | grep -v '^#' >$*.tmp
  62. $(ASM) $(ASM_FLAGS) -o $@ $*.tmp
  63. # Rule for generating .E file if needed for visual inspection
  64. # Note that due to mapping for ICL all uses of PREPROC_ONLY should be immediately followed by a file name
  65. %.E: %.cpp
  66. $(CPLUS) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $(PREPROC_ONLY) $< >$@
  67. # TODO Rule for generating .asm file if needed for visual inspection
  68. %.asm: %.cpp
  69. $(CPLUS) /c /FAs /Fa $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
  70. # TODO Rule for generating .s file if needed for visual inspection
  71. %.s: %.cpp
  72. $(CPLUS) -S $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDES) $<
  73. # Customizations
  74. ifeq (1,$(TBB_NOSTRICT))
  75. # GNU 3.2.3 headers have a ISO syntax that is rejected by Intel compiler in -strict-ansi mode.
  76. # The Mac uses gcc, so the list is empty for that platform.
  77. # The files below need the -strict-ansi flag downgraded to -ansi to compile
  78. $(KNOWN_NOSTRICT): %.$(OBJ): %.cpp
  79. $(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS_NOSTRICT) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDES) $<
  80. endif
  81. $(KNOWN_WARNINGS): %.$(OBJ): %.cpp
  82. $(CPLUS) $(COMPILE_ONLY) $(subst $(WARNING_KEY),,$(CPLUS_FLAGS)) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDES) $<
  83. tbb_misc.$(OBJ): tbb_misc.cpp version_string.ver
  84. $(CPLUS) $(COMPILE_ONLY) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(CXX_WARN_SUPPRESS) $(INCLUDE_KEY). $(INCLUDES) $<
  85. tbb_misc.E: tbb_misc.cpp version_string.ver
  86. $(CPLUS) $(CPLUS_FLAGS) $(CXX_ONLY_FLAGS) $(INCLUDE_KEY). $(INCLUDES) $(PREPROC_ONLY) $< >$@
  87. %.res: %.rc version_string.ver $(TBB.MANIFEST)
  88. rc /Fo$@ $(INCLUDES) $(filter /D%,$(CPLUS_FLAGS)) $<
  89. ifneq (,$(TBB.MANIFEST))
  90. $(TBB.MANIFEST):
  91. cmd /C "echo #include ^<stdio.h^> >tbbmanifest.c"
  92. cmd /C "echo int main(){return 0;} >>tbbmanifest.c"
  93. cl /nologo $(C_FLAGS) tbbmanifest.c
  94. version_string.ver: $(TBB.MANIFEST)
  95. $(MAKE_VERSIONS)
  96. cmd /C "echo #define TBB_MANIFEST 1 >> version_string.ver"
  97. else
  98. version_string.ver:
  99. $(MAKE_VERSIONS)
  100. endif
  101. # Rules for generating a test DLL
  102. %_dll.$(OBJ): %.cpp
  103. $(CPLUS) $(COMPILE_ONLY) $(OUTPUTOBJ_KEY)$@ $(CPLUS_FLAGS) $(PIC_KEY) $(DEFINE_KEY)_USRDLL $(INCLUDES) $<