Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/compiler.mk
# Allows to determine the compiler being used | # Allows to determine the compiler being used | ||||
# | # | ||||
# Feature: compiler | # Feature: compiler | ||||
# Usage: USES=compiler or USES=compiler:ARGS | # Usage: USES=compiler or USES=compiler:ARGS | ||||
# Valid ARGS: env (default, implicit) c++0x c++11-lib c++11-lang c11 openmp nestedfct features | # Valid ARGS: env (default, implicit) c++0x c++11-lib c++11-lang c11 nestedfct features | ||||
# | # | ||||
# c++0x: The port needs a compiler understanding C++0X | # c++0x: The port needs a compiler understanding C++0X | ||||
# c++11-lang: The port needs a compiler understanding C++11 | # c++11-lang: The port needs a compiler understanding C++11 | ||||
# c++14-lang: The port needs a compiler understanding C++14 | # c++14-lang: The port needs a compiler understanding C++14 | ||||
# c++17-lang: The port needs a compiler understanding C++17 | # c++17-lang: The port needs a compiler understanding C++17 | ||||
# gcc-c++11-lib:The port needs g++ compiler with a C++11 library | # gcc-c++11-lib:The port needs g++ compiler with a C++11 library | ||||
# c++11-lib: The port needs a compiler understanding C++11 and with a C++11 ready standard library | # c++11-lib: The port needs a compiler understanding C++11 and with a C++11 ready standard library | ||||
# c11: The port needs a compiler understanding C11 | # c11: The port needs a compiler understanding C11 | ||||
# openmp: The port needs a compiler understanding openmp | |||||
# nestedfct: The port needs a compiler understanding nested functions | # nestedfct: The port needs a compiler understanding nested functions | ||||
# features: The port will determine the features supported by the default compiler | # features: The port will determine the features supported by the default compiler | ||||
# | # | ||||
# Variable to test after <bsd.port.pre.mk> | # Variable to test after <bsd.port.pre.mk> | ||||
# | # | ||||
# COMPILER_TYPE: can be gcc or clang | # COMPILER_TYPE: can be gcc or clang | ||||
# ALT_COMPILER_TYPE: can be gcc or clang depending on COMPILER_TYPE, only set if the base system has 2 compilers | # ALT_COMPILER_TYPE: can be gcc or clang depending on COMPILER_TYPE, only set if the base system has 2 compilers | ||||
# COMPILER_VERSION: first 2 digits of the version: 33 for clang 3.3.*, 47 for gcc 4.7.* | # COMPILER_VERSION: first 2 digits of the version: 33 for clang 3.3.*, 47 for gcc 4.7.* | ||||
# ALT_COMPILER_VERSION: first 2 digits of the version: 33 for clang 3.3.*, 47 for gcc 4.7.* of the ALT_COMPILER_TYPE | # ALT_COMPILER_VERSION: first 2 digits of the version: 33 for clang 3.3.*, 47 for gcc 4.7.* of the ALT_COMPILER_TYPE | ||||
# | # | ||||
# COMPILER_FEATURES: the list of features supported by the compiler includes the standard C++ library. | # COMPILER_FEATURES: the list of features supported by the compiler includes the standard C++ library. | ||||
# CHOSEN_COMPILER_TYPE: can be gcc or clang (type of compiler chosen by the framework) | # CHOSEN_COMPILER_TYPE: can be gcc or clang (type of compiler chosen by the framework) | ||||
# | # | ||||
# MAINTAINER: portmgr@FreeBSD.org | # MAINTAINER: portmgr@FreeBSD.org | ||||
.if !defined(_INCLUDE_USES_COMPILER_MK) | .if !defined(_INCLUDE_USES_COMPILER_MK) | ||||
_INCLUDE_USES_COMPILER_MK= yes | _INCLUDE_USES_COMPILER_MK= yes | ||||
.if empty(compiler_ARGS) | .if empty(compiler_ARGS) | ||||
compiler_ARGS= env | compiler_ARGS= env | ||||
.endif | .endif | ||||
VALID_ARGS= c++11-lib c++11-lang c++14-lang c++17-lang c11 features openmp env nestedfct c++0x gcc-c++11-lib | VALID_ARGS= c++11-lib c++11-lang c++14-lang c++17-lang c11 features env nestedfct c++0x gcc-c++11-lib | ||||
_CC_hash:= ${CC:hash} | _CC_hash:= ${CC:hash} | ||||
_CXX_hash:= ${CXX:hash} | _CXX_hash:= ${CXX:hash} | ||||
.if ${compiler_ARGS} == gcc-c++11-lib | .if ${compiler_ARGS} == gcc-c++11-lib | ||||
_COMPILER_ARGS+= features gcc-c++11-lib | _COMPILER_ARGS+= features gcc-c++11-lib | ||||
.elif ${compiler_ARGS} == c++11-lib | .elif ${compiler_ARGS} == c++11-lib | ||||
_COMPILER_ARGS+= features c++11-lib | _COMPILER_ARGS+= features c++11-lib | ||||
.elif ${compiler_ARGS} == c++0x | .elif ${compiler_ARGS} == c++0x | ||||
_COMPILER_ARGS+= features c++0x | _COMPILER_ARGS+= features c++0x | ||||
.elif ${compiler_ARGS} == c++11-lang | .elif ${compiler_ARGS} == c++11-lang | ||||
_COMPILER_ARGS+= features c++11-lang | _COMPILER_ARGS+= features c++11-lang | ||||
.elif ${compiler_ARGS} == c++14-lang | .elif ${compiler_ARGS} == c++14-lang | ||||
_COMPILER_ARGS+= features c++14-lang | _COMPILER_ARGS+= features c++14-lang | ||||
.elif ${compiler_ARGS} == c++17-lang | .elif ${compiler_ARGS} == c++17-lang | ||||
_COMPILER_ARGS+= features c++17-lang | _COMPILER_ARGS+= features c++17-lang | ||||
.elif ${compiler_ARGS} == c11 | .elif ${compiler_ARGS} == c11 | ||||
_COMPILER_ARGS+= features c11 | _COMPILER_ARGS+= features c11 | ||||
.elif ${compiler_ARGS} == features | .elif ${compiler_ARGS} == features | ||||
_COMPILER_ARGS+= features | _COMPILER_ARGS+= features | ||||
.elif ${compiler_ARGS} == env | .elif ${compiler_ARGS} == env | ||||
_COMPILER_ARGS+= env | _COMPILER_ARGS+= env | ||||
.elif ${compiler_ARGS} == openmp | |||||
_COMPILER_ARGS+= env openmp | |||||
.elif ${compiler_ARGS} == nestedfct | .elif ${compiler_ARGS} == nestedfct | ||||
_COMPILER_ARGS+= env nestedfct | _COMPILER_ARGS+= env nestedfct | ||||
.else | .else | ||||
IGNORE= Invalid argument "${compiler_ARGS}", valid arguments are: ${VALID_ARGS} | IGNORE= Invalid argument "${compiler_ARGS}", valid arguments are: ${VALID_ARGS} | ||||
_COMPILER_ARGS= # | _COMPILER_ARGS= # | ||||
.endif | .endif | ||||
.if ${_COMPILER_ARGS:Mc++*} || ${_COMPILER_ARGS:Mc11} | .if ${_COMPILER_ARGS:Mc++*} || ${_COMPILER_ARGS:Mc11} | ||||
Show All 34 Lines | |||||
ALT_COMPILER_VERSION= ${_ALTCCVERSION:M[0-9]*.[0-9]*:[1]:C/([0-9]+)\.([0-9]+)\..*/\1\2/} | ALT_COMPILER_VERSION= ${_ALTCCVERSION:M[0-9]*.[0-9]*:[1]:C/([0-9]+)\.([0-9]+)\..*/\1\2/} | ||||
.if ${_ALTCCVERSION:Mclang} | .if ${_ALTCCVERSION:Mclang} | ||||
ALT_COMPILER_TYPE= clang | ALT_COMPILER_TYPE= clang | ||||
.elif ${_ALTCCVERSION} != none | .elif ${_ALTCCVERSION} != none | ||||
ALT_COMPILER_TYPE= gcc | ALT_COMPILER_TYPE= gcc | ||||
.endif | .endif | ||||
CHOSEN_COMPILER_TYPE= ${COMPILER_TYPE} | CHOSEN_COMPILER_TYPE= ${COMPILER_TYPE} | ||||
.if ${_COMPILER_ARGS:Mopenmp} | |||||
.if ${COMPILER_TYPE} == clang | |||||
USE_GCC= yes | |||||
CHOSEN_COMPILER_TYPE= gcc | |||||
.endif | |||||
.endif | |||||
.if ${_COMPILER_ARGS:Mnestedfct} | .if ${_COMPILER_ARGS:Mnestedfct} | ||||
.if ${COMPILER_TYPE} == clang | .if ${COMPILER_TYPE} == clang | ||||
USE_GCC= any | USE_GCC= any | ||||
CHOSEN_COMPILER_TYPE= gcc | CHOSEN_COMPILER_TYPE= gcc | ||||
.endif | .endif | ||||
.endif | .endif | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |