summaryrefslogtreecommitdiff
path: root/mk/compiler.mk
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2003-09-12 13:03:38 +0000
committergrant <grant@pkgsrc.org>2003-09-12 13:03:38 +0000
commitc934b0c4e0919c4858477f0ac0b3cf15bddec388 (patch)
tree2f0b05f9cd70438408d65d8be6f1342ef5a57230 /mk/compiler.mk
parent2083c8a0ce8f082fcf52005d391d539f77b83077 (diff)
downloadpkgsrc-c934b0c4e0919c4858477f0ac0b3cf15bddec388.tar.gz
start of improved compiler handling, mostly derived from the existing
gcc buildlink2.mk files and splitting the non-buildlink2.mk bits out into compiler.mk. this allows USE_GCC2 and USE_GCC3 to work with non-buildlink2 packages again.
Diffstat (limited to 'mk/compiler.mk')
-rw-r--r--mk/compiler.mk97
1 files changed, 97 insertions, 0 deletions
diff --git a/mk/compiler.mk b/mk/compiler.mk
new file mode 100644
index 00000000000..bc6de51d4d1
--- /dev/null
+++ b/mk/compiler.mk
@@ -0,0 +1,97 @@
+# $NetBSD: compiler.mk,v 1.1 2003/09/12 13:03:38 grant Exp $
+
+# This Makefile fragment implements handling for supported
+# C/C++/fortran compilers.
+#
+# The following variables are used:
+#
+# USE_GCC2
+# Use pkgsrc gcc2 from lang/gcc. This is a user-only variable
+# which must NOT be set in package Makefiles.
+#
+# USE_GCC3
+# use pkgsrc gcc3 from lang/gcc3. This is a user-only variable
+# which must NOT be set in package Makefiles.
+#
+# USE_GCC_SHLIB
+# Indicates that a package uses GCC shared libraries, so we
+# register a runtime dependency on the compiler package.
+#
+# The following variables are reserved for future use:
+#
+# USE_MIPSPRO
+# Use the Silicon Graphics, Inc. MIPSpro compiler.
+#
+# USE_SUNPRO
+# Use the Sun Microsystems Inc. WorkShop/Forte/Sun ONE Studio
+# compiler collection.
+#
+
+.if !defined(COMPILER_MK)
+COMPILER_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if defined(USE_GCC2) && empty(PKGPATH:Mlang/gcc) && empty(_PKGSRC_DEPS:Mgcc-2*)
+GCC_REQD?= 2.95.3
+
+# we need to define these early, as they are used by gcc/buildlink2.mk.
+_GCC_SUBPREFIX= gcc-2.95.3/
+_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR}
+_GCC_ARCHSUBDIR= lib/gcc-lib/${MACHINE_GNU_PLATFORM}/2.95.3
+
+. if empty(USE_BUILDLINK2:M[nN][oO])
+. include "../lang/gcc/buildlink2.mk"
+. else
+_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX}
+
+# Packages that link against gcc shared libraries need a full
+# dependency.
+. if defined(USE_GCC_SHLIB)
+DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc
+LDFLAGS+= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib
+. else
+BUILD_DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc
+. endif
+. endif
+PATH:= ${_GCC_PREFIX}bin:${PATH}
+CC= ${_GCC_PREFIX}bin/gcc
+CPP= ${_GCC_PREFIX}bin/cpp
+CXX= ${_GCC_PREFIX}bin/g++
+F77= ${_GCC_PREFIX}bin/g77
+PKG_FC= ${F77}
+
+.elif defined(USE_GCC3) && empty(PKGPATH:Mlang/gcc3) && empty(_PKGSRC_DEPS:Mgcc-3*)
+GCC_REQD?= 3.3
+
+# we need to define these early, as they are used by gcc3/buildlink2.mk.
+_GCC_SUBPREFIX= gcc-3.3/
+_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR}
+
+. if empty(USE_BUILDLINK2:M[nN][oO])
+. include "../lang/gcc3/buildlink2.mk"
+. else
+_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX}
+_GCC_LIBGCCDIR!= \
+ dirname `${_GCC_PREFIX}bin/gcc --print-libgcc-file-name`
+_GCC_ARCHSUBDIR= \
+ ${_GCC_LIBGCCDIR:S|^${LOCALBASE}/${_GCC_SUBPREFIX}||}
+
+# Packages that link against gcc shared libraries need a full
+# dependency.
+. if defined(USE_GCC_SHLIB)
+DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3
+LDFLAGS+= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib
+. else
+BUILD_DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3
+. endif
+. endif
+PATH:= ${_GCC_PREFIX}bin:${PATH}
+CC= ${_GCC_PREFIX}bin/gcc
+CPP= ${_GCC_PREFIX}bin/cpp
+CXX= ${_GCC_PREFIX}bin/g++
+F77= ${_GCC_PREFIX}bin/g77
+PKG_FC= ${F77}
+.endif # USE_GCC3
+
+.endif # COMPILER_MK