1 # $NetBSD: distcc.mk,v 1.29 2006/12/15 12:46:24 martti Exp $
3 # Copyright (c) 2004 The NetBSD Foundation, Inc.
6 # This code is derived from software contributed to The NetBSD Foundation
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. All advertising materials mentioning features or use of this software
18 # must display the following acknowledgement:
19 # This product includes software developed by the NetBSD
20 # Foundation, Inc. and its contributors.
21 # 4. Neither the name of The NetBSD Foundation nor the names of its
22 # contributors may be used to endorse or promote products derived
23 # from this software without specific prior written permission.
25 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 # POSSIBILITY OF SUCH DAMAGE.
38 .if !defined(COMPILER_DISTCC_MK)
39 COMPILER_DISTCC_MK= defined
41 .include "../../mk/bsd.prefs.mk"
43 .if !empty(PKGPATH:Mdevel/distcc)
45 MAKEFLAGS+= IGNORE_DISTCC=yes
48 .if defined(IGNORE_DISTCC)
52 # LANGUAGES.<compiler> is the list of supported languages by the compiler.
53 # _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
54 # requested by the package in USE_LANGUAGES.
56 LANGUAGES.distcc= c c++
57 _LANGUAGES.distcc= # empty
58 .for _lang_ in ${USE_LANGUAGES}
59 _LANGUAGES.distcc+= ${LANGUAGES.distcc:M${_lang_}}
61 .if empty(_LANGUAGES.distcc)
65 .if !defined(_USE_DISTCC)
69 .if !empty(_USE_DISTCC:M[yY][eE][sS])
70 EVAL_PREFIX+= _DISTCCBASE=distcc
71 _DISTCCBASE_DEFAULT= ${LOCALBASE}
73 _DISTCC_DIR= ${WRKDIR}/.distcc
75 . if !empty(_LANGUAGES.distcc:Mc)
78 _DISTCC_CC:= ${_DISTCC_DIR}/bin/${PKG_CC:T}
80 PKG_CC:= ${_DISTCC_CC}
82 . if !empty(_LANGUAGES.distcc:Mc++)
85 _DISTCC_CXX:= ${_DISTCC_DIR}/bin/${PKG_CXX:T}
87 PKG_CXX:= ${_DISTCC_CXX}
90 # Prepend the path to the compiler to the PATH.
91 . if !empty(_LANGUAGES.distcc)
92 PREPEND_PATH+= ${_DISTCC_DIR}/bin
95 # Add the dependency on distcc.
96 BUILD_DEPENDS+= distcc-[0-9]*:../../devel/distcc
98 . if defined(DISTCC_HOSTS) && !empty(DISTCC_HOSTS)
99 PKGSRC_MAKE_ENV+= DISTCC_HOSTS=${DISTCC_HOSTS:Q}
101 . if defined(DISTCC_SSH) && !empty(DISTCC_SSH)
102 PKGSRC_MAKE_ENV+= DISTCC_SSH=${DISTCC_SSH:Q}
104 . if defined(DISTCC_VERBOSE) && !empty(DISTCC_VERBOSE)
105 PKGSRC_MAKE_ENV+= DISTCC_VERBOSE=${DISTCC_VERBOSE:Q}
108 # Create symlinks for the compiler into ${WRKDIR}.
109 . for _var_ in ${_DISTCC_VARS}
110 . if !target(${_DISTCC_${_var_}})
111 override-tools: ${_DISTCC_${_var_}}
113 ${RUN}${MKDIR} ${.TARGET:H}
115 ${LN} -fs ${_DISTCCBASE}/bin/distcc ${.TARGET}
116 . for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
118 if [ ! -x "${_alias_}" ]; then \
119 ${LN} -fs ${_DISTCCBASE}/bin/distcc ${_alias_}; \
124 .endif # _USE_DISTCC == "yes"
126 .endif # COMPILER_DISTCC_MK