summaryrefslogtreecommitdiff
path: root/mk/compiler/ccache.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-02-01 00:31:00 +0000
committerjlam <jlam@pkgsrc.org>2004-02-01 00:31:00 +0000
commit61733f55775232e611c778b1c505327508f010cc (patch)
tree7cb3836535a745f7a065ffd61260b1bbffbf3a6c /mk/compiler/ccache.mk
parentf2e2901312cc551fe247312ab3af2452cae681bc (diff)
downloadpkgsrc-61733f55775232e611c778b1c505327508f010cc.tar.gz
New compiler specification framework, based on mk/compiler.mk. The
changes from the old compiler.mk are: * Split apart the compiler-specific logic into separate files. This should make supporting other compilers a bit easier. * Deprecate all of the USE_* compiler.mk variables, e.g. USE_GCC[23], USE_SUNPRO, etc. It's all replaced with a new PKGSRC_COMPILER variable. * Clean up the GCC handling so that it's all controlled by a single variable GCC_REQD. The following behaviour is expected: (a) If USE_PKGSRC_GCC is defined, then pretend there is no GCC on the system. (b) If there is no GCC, then the appropriate GCC corresponding to GCC_REQD is installed and used. (c) If there is a GCC, if it satisfies GCC_REQD, then use it; otherwise install and use the appropriate GCC package. (d) If lang/gcc is installed and GCC_REQD > 2.95.3, then lang/gcc3 is installed and used. (e) If lang/gcc3 is installed and GCC_REQD = 2.95.3, then gcc3 is still used instead of installing lang/gcc. New features include: * PKGSRC_COMPILER takes a list of values specifying the chain of compilers to call when building packages. Valid values are: distcc distributed C/C++ (chainable) ccache compiler cache (chainable) gcc GNU mipspro Silicon Graphics, Inc. MIPSpro sunpro Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio The default is "gcc". You can use ccache and/or distcc with an appropriate PKGSRC_COMPILER setting, e.g. "ccache distcc gcc". * Change GCC_REQD to hold a list of values that we scan through to find the highest version of GCC required by the build. Package Makefiles should now do "GCC_REQD+=..." instead of "GCC_REQD=...".
Diffstat (limited to 'mk/compiler/ccache.mk')
-rw-r--r--mk/compiler/ccache.mk45
1 files changed, 45 insertions, 0 deletions
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
new file mode 100644
index 00000000000..b1b0fae7353
--- /dev/null
+++ b/mk/compiler/ccache.mk
@@ -0,0 +1,45 @@
+# $NetBSD: ccache.mk,v 1.1 2004/02/01 00:31:00 jlam Exp $
+
+.if !defined(COMPILER_CCACHE_MK)
+COMPILER_CCACHE_MK= defined
+
+.if !empty(PKGPATH:Mdevel/ccache)
+IGNORE_CCACHE= yes
+MAKEFLAGS+= IGNORE_CCACHE=yes
+.endif
+
+.if defined(IGNORE_CCACHE)
+_USE_CCACHE= NO
+.endif
+
+.if !defined(_USE_CCACHE)
+_USE_CCACHE= YES
+.endif
+
+.if !empty(_USE_CCACHE:M[yY][eE][sS])
+#
+# Add the dependency on ccache.
+BUILD_DEPENDS+= ccache-[0-9]*:../../devel/ccache
+.endif
+
+EVAL_PREFIX+= _CCACHEBASE=ccache
+_CCACHEBASE_DEFAULT= ${LOCALBASE}
+_CCACHEBASE?= ${LOCALBASE}
+
+.if exists(${_CCACHEBASE}/bin/ccache)
+_CCACHE_DIR= ${WRKDIR}/.ccache
+PATH:= ${_CCACHE_DIR}/bin:${PATH}
+
+CC= ${_CCACHE_DIR}/bin/cc
+CXX= ${_CCACHE_DIR}/bin/c++
+
+. for _target_ in CC CXX
+override-tools: ${${_target_}}
+${${_target_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${LN} -fs ${_CCACHEBASE}/bin/ccache ${.TARGET}
+. endfor
+.endif
+
+.endif # COMPILER_CCACHE_MK