diff options
author | ahoka <ahoka@pkgsrc.org> | 2010-09-23 22:26:06 +0000 |
---|---|---|
committer | ahoka <ahoka@pkgsrc.org> | 2010-09-23 22:26:06 +0000 |
commit | 316d010152b39637ecf576497b810f98cbca1117 (patch) | |
tree | d308a995aa626f38ab588843bb885e1df05144b6 /mk | |
parent | 2148c99540a13a0b09410906d6271f1b16b72fe5 (diff) | |
download | pkgsrc-316d010152b39637ecf576497b810f98cbca1117.tar.gz |
Add support for clang.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/compiler.mk | 6 | ||||
-rw-r--r-- | mk/compiler/clang.mk | 76 |
2 files changed, 80 insertions, 2 deletions
diff --git a/mk/compiler.mk b/mk/compiler.mk index 1d65e7237a3..7907e9c344b 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -1,4 +1,4 @@ -# $NetBSD: compiler.mk,v 1.71 2010/07/30 07:58:58 asau Exp $ +# $NetBSD: compiler.mk,v 1.72 2010/09/23 22:26:06 ahoka Exp $ # # This Makefile fragment implements handling for supported C/C++/Fortran # compilers. @@ -12,6 +12,7 @@ # Valid values are: # ccc Compaq C Compilers (Tru64) # ccache compiler cache (chainable) +# clang Clang C and Objective−C compiler # distcc distributed C/C++ (chainable) # f2c Fortran 77 to C compiler (chainable) # icc Intel C++ Compiler (Linux) @@ -101,7 +102,8 @@ COMPILER_USE_SYMLINKS?= yes _USE_PKGSRC_GCC= yes .endif -_COMPILERS= ccc gcc icc ido mipspro mipspro-ucode sunpro xlc hp pcc +_COMPILERS= ccc gcc icc ido mipspro mipspro-ucode \ + sunpro xlc hp pcc clang _PSEUDO_COMPILERS= ccache distcc f2c g95 .if defined(NOT_FOR_COMPILER) && !empty(NOT_FOR_COMPILER) diff --git a/mk/compiler/clang.mk b/mk/compiler/clang.mk new file mode 100644 index 00000000000..32ce787c6c0 --- /dev/null +++ b/mk/compiler/clang.mk @@ -0,0 +1,76 @@ +# $NetBSD: clang.mk,v 1.1 2010/09/23 22:26:07 ahoka Exp $ +# +# This is the compiler definition for the clang compiler. +# +# User-settable variables: +# +# CLANGBASE +# The base directory where the compiler is installed. +# + +.if !defined(COMPILER_CLANG_MK) +COMPILER_CLANG_MK= defined + +# Add the dependency on clang +# TODO: may be installed already, check for this +BUILD_DEPENDS+= clang-[0-9]*:../../lang/clang + +.include "../../mk/bsd.prefs.mk" + +CLANGBASE?= ${PREFIX} + +LANGUAGES.clang= # empty + +#_CLANG_DIR= ${WRKDIR}/.clang +_CLANG_DIR= ${CLANGBASE}/bin +_CLANG_VARS= # empty + +.if exists(${CLANGBASE}/bin/clang) +LANGUAGES.hp+= c +_CLANG_VARS+= CC +_CLANG_CC= ${_CLANG_DIR}/clang +_ALIASES.CC= cc gcc c89 c99 +CCPATH= ${CLANGBASE}/bin/clang +PKG_CC:= ${_CLANG_CC} +.endif + +# NOTE: clang C++ support is still experimental, enable later +.if exists(${CLANGBASE}/bin/clang++) +#LANGUAGES.hp+= c++ +#_CLANG_VARS+= CXX +#_CLANG_CXX= ${_CLANG_DIR}/clang++ +#_ALIASES.CXX= c++ g++ +#CXXPATH= ${CLANGBASE}/bin/clang++ +#PKG_CXX:= ${_CLANG_CXX} +.endif + +_COMPILER_STRIP_VARS+= ${_CLANG_VARS} + +# Mimic GCC behaviour by defaulting to C89 +#.if !empty(USE_LANGUAGES:Mc99) +#_WRAP_EXTRA_ARGS.CC+= -std=gnu99 +#.else +#_WRAP_EXTRA_ARGS.CC+= -std=gnu89 +#.endif + +_LINKER_RPATH_FLAG= -rpath, + +_COMPILER_RPATH_FLAG= -Wl,-rpath, + +.if exists(${CCPATH}) +CC_VERSION_STRING!= ${CCPATH} -v 2>&1 +CC_VERSION!= ${CCPATH} -dumpversion 2>&1 +.else +CC_VERSION_STRING?= ${CC_VERSION} +CC_VERSION?= clang +.endif + +# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the +# ones requested by the package in USE_LANGUAGES. +# +_LANGUAGES.clang= # empty +.for _lang_ in ${USE_LANGUAGES} +_LANGUAGES.clang+= ${LANGUAGES.clang:M${_lang_}} +.endfor + +.endif # COMPILER_CLANG_MK |