common.inc
Go to the documentation of this file.00001 # <copyright>
00002 # Copyright (c) 2013 Intel Corporation. All Rights Reserved.
00003 #
00004 # Redistribution and use in source and binary forms, with or without
00005 # modification, are permitted provided that the following conditions
00006 # are met:
00007 #
00008 # * Redistributions of source code must retain the above copyright
00009 # notice, this list of conditions and the following disclaimer.
00010 # * Redistributions in binary form must reproduce the above copyright
00011 # notice, this list of conditions and the following disclaimer in the
00012 # documentation and/or other materials provided with the distribution.
00013 # * Neither the name of Intel Corporation nor the names of its
00014 # contributors may be used to endorse or promote products derived
00015 # from this software without specific prior written permission.
00016 #
00017 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00018 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00019 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00020 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00021 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00022 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00023 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00024 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00025 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00026 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00027 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 #
00029 #
00030 #------------------------------------------------------------------------
00031 #
00032 # Portions of this software are protected under the following patents:
00033 # U.S. Patent 5,812,852
00034 # U.S. Patent 6,792,599
00035 # U.S. Patent 7,069,556
00036 # U.S. Patent 7,328,433
00037 # U.S. Patent 7,500,242
00038 #
00039 # </copyright>
00040
00041 ifndef omp_os
00042
00043 # Windows sets environment variable OS; for other systems, ask uname
00044 ifeq ($(OS),)
00045 OS:=$(shell uname)
00046 ifeq ($(OS),)
00047 $(error "Cannot detect operating system")
00048 endif
00049 export omp_os=$(OS)
00050 endif
00051
00052 ifeq ($(OS), Windows_NT)
00053 export omp_os=windows
00054 endif
00055 ifeq ($(OS), Linux)
00056 export omp_os=linux
00057 endif
00058 ifeq ($(OS), Darwin)
00059 export omp_os=macos
00060 endif
00061
00062 endif # !omp_os
00063
00064 # Compiling for the Intel(R) Many Integrated Core architecture is non-trivial at the next layer
00065 # of script down, but we can make it consistent here.
00066 ifeq "$(arch)" "mic"
00067 # I really do mean this...
00068 override arch:=32e
00069 override mic:=yes
00070 else
00071 override mic:=no
00072 endif
00073
00074 ifeq (,$(wildcard $(omp_root)/tools/$(omp_os).inc))
00075 $(error "$(omp_os)" is not supported. Add tools/$(omp_os).inc file with os-specific settings )
00076 endif
00077
00078 # detect arch and runtime versions, provide common host-specific definitions
00079 include $(omp_root)/tools/$(omp_os).inc
00080
00081 ifeq ($(arch),)
00082 $(error Architecture not detected)
00083 endif
00084
00085 # Setting defaults
00086 mode?=release
00087
00088 ifeq "$(omp_os)" "windows"
00089 compiler?=icl
00090 else
00091 compiler?=icc
00092 endif
00093
00094 ifneq "$(mic)" "no"
00095 ifeq "$(compiler)" "gcc"
00096 $(error Compiling the runtime with gcc is not supported on Intel\(R\) Many Integrated Core Architecture)
00097 endif
00098
00099 # Magic flags for the build script!
00100 build_args += --os=lrb --mic-arch=knc --mic-os=lin --mic-comp=offload
00101
00102 # Check that the binutils for Intel(R) Many Integrated Core Architecture are available
00103 # First we see whether the objdump on the user's path supports the k1om architecture.
00104 hask1om = $(shell if (objdump --help | grep -s k1om); then echo OK; else echo KO; fi)
00105 ifneq "$(hask1om)" "OK"
00106 # Appropriate binutils are not already set up, so try to add them from the default place.
00107 micBinPath = /usr/linux-k1om-4.7/x86_64-k1om-linux/bin
00108 micBinPresent = $(shell if test -d $(micBinPath); then echo OK; else echo KO; fi)
00109 ifneq "$(micBinPresent)" "OK"
00110 # We can't find them in the normal place, so complain.
00111 $(error Compiling for Intel\(R\) Many Integrated Core Architecture requires that the cross-hosted binutils are available in $(micBinPath).\
00112 See the Tools tab at http://software.intel.com/mic-developer)
00113 endif
00114 export PATH := $(micBinPath):${PATH}
00115 endif
00116 endif
00117
00118 export BUILD_COMPILER := $(compiler)
00119
00120