71e098497c
Platform support is determined by _OPSYS_SUPPORTS_CTF from mk/platform, the user enables support by setting PKGSRC_USE_CTF=yes, and packages can explicitly disable support with CTF_SUPPORTED=no or skip certain files with CTF_FILES_SKIP. The path to ctfconvert is configured via TOOLS_PLATFORM.ctfconvert. If all of the requisite variables are enabled, a compiler-specific debug flag is passed via the wrappers to ensure we have DWARF information to convert, _INSTALL_UNSTRIPPED is explicitly defined to avoid binaries being stripped prior to conversion, and the conversion is performed during the install stage. It is recommended that users who enable the feature also set STRIP_DEBUG=yes to reduce the final binary size once the conversion has been performed. This has been used for the past year in Joyent SmartOS builds. FreeBSD is marked as supported but is untested.
84 lines
2 KiB
Makefile
84 lines
2 KiB
Makefile
# $NetBSD: clang.mk,v 1.19 2018/11/12 14:22:58 jperkin 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
|
|
#TOOL_DEPENDS+= clang-[0-9]*:../../lang/clang
|
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
CLANGBASE?= ${LOCALBASE}
|
|
LANGUAGES.clang= # empty
|
|
|
|
.if exists(${CLANGBASE}/bin/clang)
|
|
LANGUAGES.clang+= c objc
|
|
_COMPILER_STRIP_VARS+= CC
|
|
CCPATH= ${CLANGBASE}/bin/clang
|
|
PKG_CC:= ${CCPATH}
|
|
.endif
|
|
|
|
.if exists(${CLANGBASE}/bin/clang++)
|
|
LANGUAGES.clang+= c++
|
|
_COMPILER_STRIP_VARS+= CXX
|
|
CXXPATH= ${CLANGBASE}/bin/clang++
|
|
PKG_CXX:= ${CXXPATH}
|
|
.endif
|
|
|
|
.if exists(${CLANGBASE}/bin/clang-cpp)
|
|
CPPPATH= ${CLANGBASE}/bin/clang-cpp
|
|
PKG_CPP:= ${CPPPATH}
|
|
.endif
|
|
|
|
.if exists(${CCPATH})
|
|
CC_VERSION_STRING!= ${CCPATH} -v 2>&1
|
|
CC_VERSION!= ${CCPATH} --version 2>&1 | ${SED} -n "s/^.* version /clang-/p"
|
|
.else
|
|
CC_VERSION_STRING?= ${CC_VERSION}
|
|
CC_VERSION?= clang
|
|
.endif
|
|
|
|
_COMPILER_ABI_FLAG.32= -m32
|
|
_COMPILER_ABI_FLAG.64= -m64
|
|
_COMPILER_LD_FLAG= -Wl,
|
|
_LINKER_RPATH_FLAG= -R
|
|
_COMPILER_RPATH_FLAG= ${_COMPILER_LD_FLAG}${_LINKER_RPATH_FLAG}
|
|
|
|
_CTF_CFLAGS= -gdwarf-2
|
|
|
|
# The user can choose the level of stack smashing protection.
|
|
.if ${PKGSRC_USE_SSP} == "all"
|
|
_SSP_CFLAGS= -fstack-protector-all
|
|
.else
|
|
_SSP_CFLAGS= -fstack-protector
|
|
.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
|
|
|
|
PKGSRC_FORTRAN?=g95
|
|
|
|
.if !empty(PKGSRC_FORTRAN) && (!empty(USE_LANGUAGES:Mfortran) || !empty(USE_LANGUAGES:Mfortran77))
|
|
. include "../../mk/compiler/${PKGSRC_FORTRAN}.mk"
|
|
.endif
|
|
|
|
_WRAP_EXTRA_ARGS.CC+= -Qunused-arguments
|
|
CWRAPPERS_APPEND.cc+= -Qunused-arguments
|
|
_WRAP_EXTRA_ARGS.CXX+= -Qunused-arguments
|
|
CWRAPPERS_APPEND.cxx+= -Qunused-arguments
|
|
|
|
.endif # COMPILER_CLANG_MK
|