summaryrefslogtreecommitdiff
path: root/mk/compiler.mk
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2003-09-24 12:22:03 +0000
committergrant <grant@pkgsrc.org>2003-09-24 12:22:03 +0000
commitf8dc52ce38cd225e17b0e74e4978ad4dc46cceeb (patch)
tree99ddce2750caedd6be2d3ff6627986aa0f032363 /mk/compiler.mk
parentc2cf4208ceb6730af7c7d3b0f441c2b12e0800b7 (diff)
downloadpkgsrc-f8dc52ce38cd225e17b0e74e4978ad4dc46cceeb.tar.gz
make CC_VERSION available to packages by including bsd.prefs.mk.
it is of the form 'gcc-<version>' if gcc is being used, or empty otherwise (for now). requested by tron.
Diffstat (limited to 'mk/compiler.mk')
-rw-r--r--mk/compiler.mk21
1 files changed, 18 insertions, 3 deletions
diff --git a/mk/compiler.mk b/mk/compiler.mk
index f77084083de..1e92273b392 100644
--- a/mk/compiler.mk
+++ b/mk/compiler.mk
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.11 2003/09/24 03:01:02 grant Exp $
+# $NetBSD: compiler.mk,v 1.12 2003/09/24 12:22:04 grant Exp $
# This Makefile fragment implements handling for supported
# C/C++/fortran compilers.
@@ -45,8 +45,6 @@
.if !defined(COMPILER_MK)
COMPILER_MK= # defined
-.include "../../mk/bsd.prefs.mk"
-
# Do a dance to determine which version of gcc is being used, if any,
# and whether it satisfies GCC_REQD.
#
@@ -133,6 +131,7 @@ BUILD_DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc
. endif
. endif # buildlink2
+_CC_IS_GCC= YES
PATH:= ${_GCC_PREFIX}bin:${PATH}
CC= ${_GCC_PREFIX}bin/gcc
CPP= ${_GCC_PREFIX}bin/cpp
@@ -167,6 +166,7 @@ BUILD_DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3
. endif
. endif # buildlink2
+_CC_IS_GCC= YES
PATH:= ${_GCC_PREFIX}bin:${PATH}
CC= ${_GCC_PREFIX}bin/gcc
CPP= ${_GCC_PREFIX}bin/cpp
@@ -182,6 +182,21 @@ _GCC_LDFLAGS= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFI
LDFLAGS+= ${_GCC_LDFLAGS}
.endif
+# CC_VERSION can be tested by package Makefiles to tweak things based
+# on the compiler being used. This is only functional for gcc right now.
+#
+CC_VERSION?= # empty
+.if defined(_CC_IS_GCC)
+. if !defined(_CC_VERSION)
+_CC_VERSION!= if ${CC} -dumpversion > /dev/null 2>&1; then \
+ ${ECHO} `${CC} -dumpversion`; \
+ else \
+ ${ECHO} ""; \
+ fi
+. endif
+CC_VERSION= gcc-${_CC_VERSION}
+.endif
+
# The SunPro C++ compiler doesn't support passing linker flags with
# -Wl to CC, so we make buildlink2 perform the required magic.
#