1 # Copyright (c) 2005-2019 Intel Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # GNU Makefile that builds and runs example.
19 PERF_RUN_ARGS=silent auto 1000000000 1000 20
22 ifneq (,$(shell which icc 2>/dev/null))
27 TBBLIB_DEBUG = -ltbb_debug
29 ifeq ($(offload), mic)
30 override CXXFLAGS += -D__TBB_MIC_OFFLOAD=1
31 # Replace -ltbb with -tbb in the offload mode
33 TBBLIB_DEBUG += -offload-option,mic,ld,"-ltbb_debug"
36 ifeq ($(shell uname), Linux)
37 ifeq ($(target), android)
38 LIBS+= --sysroot=$(SYSROOT)
39 run_cmd=../../common/android.linux.launcher.sh
43 else ifeq ($(shell uname), Darwin)
44 override CXXFLAGS += -Wl,-rpath,$(TBBROOT)/lib
47 # autodetect C++11 support
48 include ../../common/examples-common.inc
52 release: main.cpp primes.cpp
53 $(CXX) -O2 -DNDEBUG $(CXXFLAGS) -o $(PROG) $^ $(TBBLIB) $(LIBS) $(CXX0XFLAGS)
55 debug: main.cpp primes.cpp
56 $(CXX) -O0 -g -DTBB_USE_DEBUG $(CXXFLAGS) -o $(PROG) $^ $(TBBLIB_DEBUG) $(LIBS) $(CXX0XFLAGS)
62 $(run_cmd) ./$(PROG) $(ARGS)
67 $(run_cmd) ./$(PROG) $(PERF_RUN_ARGS)