Initial PSTL commit
[lldb.git] / pstl / build / Makefile.common
1 #===-- Makefile.common ---------------------------------------------------===##
2 #
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file is dual licensed under the MIT and the University of Illinois Open
6 # Source Licenses. See LICENSE.TXT for details.
7 #
8 #===----------------------------------------------------------------------===##
9
10 #------------------------------------------------------------------------------
11 # Define common parts for Parallel STL
12 #------------------------------------------------------------------------------
13
14 .SUFFIXES:
15
16 goals = $(or $(MAKECMDGOALS),all)
17 ifneq (, $(filter-out clean clean_all,$(goals)))
18     ifeq (, $(filter $(backend), tbb))
19         $(info Threading backend was not specified; using TBB)
20         backend=tbb
21     endif
22 endif
23
24 ifndef os_name
25   # Windows sets environment variable OS; for other systems, ask uname
26   ifeq ($(OS),)
27     OS:=$(shell uname)
28     ifeq ($(OS),)
29       $(error "Cannot detect operating system")
30     endif
31     os_name=$(OS)
32   endif
33
34   ifeq ($(OS), Windows_NT)
35     os_name=windows
36   endif
37   ifeq ($(OS), Linux)
38     os_name=linux
39   endif
40   ifeq ($(OS), Darwin)
41     os_name=macos
42   endif
43 endif # !os_name
44
45 cfg ?= release
46 stdver ?= c++11
47
48 override INCLUDES += -I$(proj_root)/include -I$(proj_root)/test
49
50 TEST_MACRO += -D__PSTL_TEST_SUCCESSFUL_KEYWORD=1
51
52 ifeq ($(backend), tbb)
53     BACKEND_MACRO += -D__PSTL_PAR_BACKEND_TBB
54 endif
55
56 target ?= $(os_name)
57 #OS specific keys
58 ifeq ($(target),windows)
59     ifneq (, $(filter $(compiler), gcc g++))
60         include $(proj_root)/build/mingw.inc
61     else
62         include $(proj_root)/build/windows.inc
63     endif
64 else
65     include $(proj_root)/build/unix.inc
66     ifneq (,$(wildcard $(proj_root)/build/$(target).inc))
67         include $(proj_root)/build/$(target).inc
68         $(info included additional file $(proj_root)/build/$(target).inc)
69     endif
70 endif
71
72 # compiler specific keys
73 ifneq (, $(filter $(compiler), gcc g++))
74     include $(proj_root)/build/gcc.inc
75 endif
76
77 ifneq (, $(filter $(compiler), clang clang++))
78     include $(proj_root)/build/clang.inc
79 endif
80
81 ifneq (, $(filter $(compiler), icc icpc icx))
82     include $(proj_root)/build/icc.inc
83 endif
84
85 ifneq (, $(filter $(compiler), icl))
86     include $(proj_root)/build/icl.inc
87 endif
88
89
90 OPTIMIZATION_ENABLED_FLAGS += $(XHOST_FLAG)
91 OPTIMIZATION_DISABLED_FLAGS += $(XHOST_FLAG)
92
93
94 ifeq ($(cfg), debug)
95     TBB_LIB_NAME = tbb_debug
96     BACKEND_MACRO += -DTBB_USE_DEBUG=1
97     DEBUG_MACRO += -DPSTL_USE_DEBUG
98     OPTIMIZATION_KEYS = $(OPTIMIZATION_DISABLED_FLAGS)
99 else
100     OPTIMIZATION_KEYS = $(OPTIMIZATION_ENABLED_FLAGS)
101 endif
102
103 DYN_LDFLAGS += $(PSTL_ARCH)
104
105 CPLUS_FLAGS += $(TEST_MACRO)
106 CPLUS_FLAGS += $(INCLUDES)
107 CPLUS_FLAGS += $(BACKEND_MACRO)
108 CPLUS_FLAGS += $(DEBUG_MACRO)
109 CPLUS_FLAGS += $(CXXFLAGS)
110 CPLUS_FLAGS += $(OPTIMIZATION_KEYS)
111
112 CPLUS_FLAGS += $(DISABLED_WARNINGS)
113 CPLUS_FLAGS += $(PSTL_ARCH)