pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk make CC_VERSION available to packages by including ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/dd3cf74018cf
branches:  trunk
changeset: 461959:dd3cf74018cf
user:      grant <grant%pkgsrc.org@localhost>
date:      Wed Sep 24 12:22:03 2003 +0000

description:
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:

 mk/bsd.pkg.mk   |   4 +---
 mk/bsd.prefs.mk |   8 +++++++-
 mk/compiler.mk  |  21 ++++++++++++++++++---
 3 files changed, 26 insertions(+), 7 deletions(-)

diffs (94 lines):

diff -r cdabd4b96285 -r dd3cf74018cf mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Sep 24 10:56:29 2003 +0000
+++ b/mk/bsd.pkg.mk     Wed Sep 24 12:22:03 2003 +0000
@@ -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 @@
 
 DISTINFO_FILE?=                ${.CURDIR}/distinfo
 
-.include "../../mk/compiler.mk"
-
 FIX_RPATH+=            LIBS
 .if defined(USE_X11)
 X11_LDFLAGS=           # empty
diff -r cdabd4b96285 -r dd3cf74018cf mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Wed Sep 24 10:56:29 2003 +0000
+++ b/mk/bsd.prefs.mk   Wed Sep 24 12:22:03 2003 +0000
@@ -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 @@
 #
 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 -r cdabd4b96285 -r dd3cf74018cf mk/compiler.mk
--- a/mk/compiler.mk    Wed Sep 24 10:56:29 2003 +0000
+++ b/mk/compiler.mk    Wed Sep 24 12:22:03 2003 +0000
@@ -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 @@
 .    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 @@
 .    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 @@
 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.
 #



Home | Main Index | Thread Index | Old Index