Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / compiler / distcc.mk
blobdf766ccc9e58cf5162543e7cc33a6e265dc79927
1 # $NetBSD: distcc.mk,v 1.30 2008/02/07 20:59:05 rillig Exp $
3 # Copyright (c) 2004 The NetBSD Foundation, Inc.
4 # All rights reserved.
6 # This code is derived from software contributed to The NetBSD Foundation
7 # by Johnny C. Lam.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
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)
44 IGNORE_DISTCC= yes
45 MAKEFLAGS+= IGNORE_DISTCC=yes
46 .endif
48 .if defined(IGNORE_DISTCC)
49 _USE_DISTCC= NO
50 .endif
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_}}
60 .endfor
61 .if empty(_LANGUAGES.distcc)
62 _USE_DISTCC= NO
63 .endif
65 .if !defined(_USE_DISTCC)
66 _USE_DISTCC= YES
67 .endif
69 .if !empty(_USE_DISTCC:M[yY][eE][sS])
70 EVAL_PREFIX+= _DISTCCBASE=distcc
71 _DISTCCBASE_DEFAULT= ${LOCALBASE}
73 _DISTCC_DIR= ${WRKDIR}/.distcc
74 _DISTCC_VARS= # empty
75 . if !empty(_LANGUAGES.distcc:Mc)
76 PKG_CC?= ${CC}
77 _DISTCC_VARS+= CC
78 _DISTCC_CC:= ${_DISTCC_DIR}/bin/${PKG_CC:T}
79 _ALIASES.CC+= cc
80 PKG_CC:= ${_DISTCC_CC}
81 . endif
82 . if !empty(_LANGUAGES.distcc:Mc++)
83 PKG_CXX?= ${CXX}
84 _DISTCC_VARS+= CXX
85 _DISTCC_CXX:= ${_DISTCC_DIR}/bin/${PKG_CXX:T}
86 _ALIASES.CXX+= c++
87 PKG_CXX:= ${_DISTCC_CXX}
88 . endif
90 # Prepend the path to the compiler to the PATH.
91 . if !empty(_LANGUAGES.distcc)
92 PREPEND_PATH+= ${_DISTCC_DIR}/bin
93 . endif
95 # Add the dependency on distcc.
96 TOOL_DEPENDS+= distcc-[0-9]*:../../devel/distcc
98 . if defined(DISTCC_HOSTS) && !empty(DISTCC_HOSTS)
99 PKGSRC_MAKE_ENV+= DISTCC_HOSTS=${DISTCC_HOSTS:Q}
100 . endif
101 . if defined(DISTCC_SSH) && !empty(DISTCC_SSH)
102 PKGSRC_MAKE_ENV+= DISTCC_SSH=${DISTCC_SSH:Q}
103 . endif
104 . if defined(DISTCC_VERBOSE) && !empty(DISTCC_VERBOSE)
105 PKGSRC_MAKE_ENV+= DISTCC_VERBOSE=${DISTCC_VERBOSE:Q}
106 . endif
108 # Create symlinks for the compiler into ${WRKDIR}.
109 . for _var_ in ${_DISTCC_VARS}
110 . if !target(${_DISTCC_${_var_}})
111 override-tools: ${_DISTCC_${_var_}}
112 ${_DISTCC_${_var_}}:
113 ${RUN}${MKDIR} ${.TARGET:H}
114 ${RUN} \
115 ${LN} -fs ${_DISTCCBASE}/bin/distcc ${.TARGET}
116 . for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
117 ${RUN} \
118 if [ ! -x "${_alias_}" ]; then \
119 ${LN} -fs ${_DISTCCBASE}/bin/distcc ${_alias_}; \
121 . endfor
122 . endif
123 . endfor
124 .endif # _USE_DISTCC == "yes"
126 .endif # COMPILER_DISTCC_MK