summaryrefslogtreecommitdiff
path: root/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
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')
-rw-r--r--mk/bsd.pkg.mk4
-rw-r--r--mk/bsd.prefs.mk8
-rw-r--r--mk/compiler.mk21
3 files changed, 26 insertions, 7 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index c652c2cac74..a1eb3215b08 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1288 2003/09/17 02:38:22 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1289 2003/09/24 12:22:03 grant Exp $
#
# This file is in the public domain.
#
@@ -391,8 +391,6 @@ SHCOMMENT?= ${ECHO_MSG} >/dev/null '***'
DISTINFO_FILE?= ${.CURDIR}/distinfo
-.include "../../mk/compiler.mk"
-
FIX_RPATH+= LIBS
.if defined(USE_X11)
X11_LDFLAGS= # empty
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index d7567c555a4..3062ef236a4 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.127 2003/09/17 05:14:40 itojun Exp $
+# $NetBSD: bsd.prefs.mk,v 1.128 2003/09/24 12:22:04 grant Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
@@ -409,4 +409,10 @@ WRKDIR?= ${BUILD_DIR}/${WRKDIR_BASENAME}
#
WRKLOG?= ${WRKDIR}/.work.log
+.if exists(${.CURDIR}/../../mk/compiler.mk)
+. include "../../mk/compiler.mk"
+.elif exists(${.CURDIR}/../mk/compiler.mk)
+. include "../mk/compiler.mk"
+.endif
+
.endif # BSD_PKG_MK
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.
#