summaryrefslogtreecommitdiff
path: root/mk/compiler.mk
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2004-05-08 06:03:26 +0000
committergrant <grant@pkgsrc.org>2004-05-08 06:03:26 +0000
commit4f762fb0cea261d1b172ace4e9d80d67fd838ec2 (patch)
tree4f793f78bb7ae4529272129bc7a42350cc326e94 /mk/compiler.mk
parent43d5e1643ccf1a2fa86acfb2a1688a208d1e3128 (diff)
downloadpkgsrc-4f762fb0cea261d1b172ace4e9d80d67fd838ec2.tar.gz
implement {NOT,ONLY}_FOR_COMPILER so that packages can be marked as
requiring a specific compiler (most often those which use gcc-specific hacks^wfeatures). this allows users to define PKGSRC_COMPILER to multiple real compilers in order to implement a compiler preference. for example, PKGSRC_COMPILER="sunpro gcc" will use sunpro as the default compiler, and fall back to gcc where a package is marked NOT_FOR_COMPILER=sunpro or ONLY_FOR_COMPILER=gcc.
Diffstat (limited to 'mk/compiler.mk')
-rw-r--r--mk/compiler.mk44
1 files changed, 39 insertions, 5 deletions
diff --git a/mk/compiler.mk b/mk/compiler.mk
index 89af1a8d833..5e6765e7b19 100644
--- a/mk/compiler.mk
+++ b/mk/compiler.mk
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.27 2004/03/31 09:38:36 sketch Exp $
+# $NetBSD: compiler.mk,v 1.28 2004/05/08 06:03:26 grant Exp $
#
# This Makefile fragment implements handling for supported C/C++/Fortran
# compilers.
@@ -101,10 +101,44 @@ PKGSRC_COMPILER?= mipspro
PKGSRC_COMPILER?= gcc
.endif
-_PKGSRC_COMPILER= # empty
-.for _compiler_ in ${PKGSRC_COMPILER}
-. if empty(_PKGSRC_COMPILER:M${_compiler_})
-_PKGSRC_COMPILER:= ${_compiler_} ${_PKGSRC_COMPILER}
+_COMPILERS= gcc mipspro sunpro
+_PSEUDO_COMPILERS= ccache distcc
+
+.if defined(NOT_FOR_COMPILER) && !empty(NOT_FOR_COMPILER)
+. for _compiler_ in ${_COMPILERS}
+. if ${NOT_FOR_COMPILER:M${_compiler_}} == ""
+_ACCEPTABLE_COMPILERS+= ${_compiler_}
+. endif
+. endfor
+.elif defined(ONLY_FOR_COMPILER) && !empty(ONLY_FOR_COMPILER)
+. for _compiler_ in ${_COMPILERS}
+. if ${ONLY_FOR_COMPILER:M${_compiler_}} != ""
+_ACCEPTABLE_COMPILERS+= ${_compiler_}
+. endif
+. endfor
+.else
+_ACCEPTABLE_COMPILERS+= ${_COMPILERS}
+.endif
+
+.if defined(_ACCEPTABLE_COMPILERS)
+. for _acceptable_ in ${_ACCEPTABLE_COMPILERS}
+. for _compiler_ in ${PKGSRC_COMPILER}
+. if !empty(_ACCEPTABLE_COMPILERS:M${_compiler_}) && !defined(_COMPILER)
+_COMPILER= ${_compiler_}
+. endif
+. endfor
+. endfor
+.endif
+
+.if !defined(_COMPILER)
+PKG_FAIL_REASON+= "No acceptable compiler found for ${PKGNAME}."
+.else
+_PKGSRC_COMPILER:= ${_COMPILER}
+.endif
+
+.for _compiler_ in ${_PSEUDO_COMPILERS}
+. if !empty(PKGSRC_COMPILER:M${_compiler_})
+_PKGSRC_COMPILER:= ${_compiler_} ${_PKGSRC_COMPILER}
. endif
.endfor