Add files from parent branch HEAD:
[pkgsrc.git] / mk / bsd.prefs.mk
1 # $NetBSD: bsd.prefs.mk,v 1.164 2004/07/30 20:59:08 jlam Exp $
2 #
3 # Make file, included to get the site preferences, if any.  Should
4 # only be included by package Makefiles before any .if defined()
5 # statements or modifications to "passed" variables (CFLAGS, LDFLAGS, ...),
6 # to make sure any variables defined in /etc/mk.conf, $MAKECONF, or
7 # the system defaults (sys.mk and bsd.own.mk) are used.
8
9 # Do not recursively include mk.conf, redefine OPSYS, include bsd.own.mk, etc.
10 .ifndef BSD_PKG_MK
11
12 # Let mk.conf know that this is pkgsrc.
13 BSD_PKG_MK=1
14 __PREFIX_SET__:=${PREFIX}
15
16 # Expand MAKE to a full path.
17 .if !defined(_MAKE)
18 _MAKE:= ${MAKE}
19 .  for _dir_ in ${PATH:C/\:/ /g}
20 .    if empty(_MAKE:M/*)
21 .      if exists(${_dir_}/${MAKE})
22 _MAKE:= ${_dir_}/${MAKE}
23 .      endif
24 .    endif
25 .  endfor
26 .  if !empty(_MAKE:M/*)
27 MAKEFLAGS+=     _MAKE=${_MAKE:Q}
28 .  endif
29 .endif
30 MAKE:=  ${_MAKE}
31
32 .if exists(/usr/bin/uname)
33 UNAME=/usr/bin/uname
34 .elif exists(/bin/uname)
35 UNAME=/bin/uname
36 .else
37 UNAME=echo Unknown
38 .endif
39
40 .if exists(/usr/bin/cut)
41 CUT=/usr/bin/cut
42 .elif exists(/bin/cut)
43 CUT=/bin/cut
44 .else
45 CUT=echo Unknown
46 .endif
47
48 .ifndef OPSYS
49 OPSYS!=                 ${UNAME} -s | tr -d /
50 .endif
51 MAKEFLAGS+=             OPSYS=${OPSYS}
52 .ifndef OS_VERSION
53 OS_VERSION!=            ${UNAME} -r
54 .endif
55 .ifndef LOWER_OS_VERSION
56 LOWER_OS_VERSION!=      echo ${OS_VERSION} | tr 'A-Z' 'a-z'
57 .endif
58 MAKEFLAGS+=             OS_VERSION=${OS_VERSION}
59
60 # Preload these for architectures not in all variations of bsd.own.mk.
61 GNU_ARCH.alpha?=        alpha
62 GNU_ARCH.arm26?=        arm
63 GNU_ARCH.arm32?=        arm
64 GNU_ARCH.i386?=         i386
65 GNU_ARCH.i486?=         i386
66 GNU_ARCH.i586?=         i386
67 GNU_ARCH.i686?=         i386
68 GNU_ARCH.m68000?=       m68010
69 GNU_ARCH.m68k?=         m68k
70 GNU_ARCH.mips?=         mipsel
71 GNU_ARCH.mipseb?=       mipseb
72 GNU_ARCH.mipsel?=       mipsel
73 GNU_ARCH.ns32k?=        ns32k
74 GNU_ARCH.powerpc?=      powerpc
75 GNU_ARCH.sh3eb?=        sh
76 GNU_ARCH.sh3el?=        shle
77 GNU_ARCH.sparc?=        sparc
78 GNU_ARCH.sparc64?=      sparc64
79 GNU_ARCH.vax?=          vax
80 MACHINE_GNU_ARCH?=      ${GNU_ARCH.${MACHINE_ARCH}}
81
82 .if ${OPSYS} == "NetBSD"
83 LOWER_OPSYS?=           netbsd
84
85 .elif ${OPSYS} == "BSDOS"
86 LOWER_OPSYS?=           bsdi
87
88 .elif ${OPSYS} == "FreeBSD"
89 LOWER_OPSYS?=           freebsd
90 LOWER_ARCH!=            ${UNAME} -p
91 MACHINE_ARCH=           ${LOWER_ARCH}
92 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
93 LOWER_OPSYS_VERSUFFIX!= echo ${LOWER_OS_VERSION} | ${CUT} -c -1
94 .  if ${LOWER_ARCH} == "i386"
95 LOWER_VENDOR?=          pc
96 .  else
97 LOWER_VENDOR?=          unknown
98 .  endif
99
100 .elif ${OPSYS} == "SunOS"
101 .  if ${MACHINE_ARCH} == "sparc"
102 SPARC_TARGET_ARCH?=     sparcv7
103 .  elif ${MACHINE_ARCH} == "sun4"
104 MACHINE_ARCH=           sparc
105 SPARC_TARGET_ARCH?=     sparcv7
106 .  elif ${MACHINE_ARCH} == "i86pc"
107 MACHINE_ARCH=           i386
108 .  elif ${MACHINE_ARCH} == "unknown"
109 .    if !defined(LOWER_ARCH)
110 LOWER_ARCH!=            ${UNAME} -p
111 .    endif      # !defined(LOWER_ARCH)
112 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
113 .  endif
114 LOWER_VENDOR?=          sun
115 LOWER_OPSYS?=           solaris
116 LOWER_OPSYS_VERSUFFIX=  2
117
118 .elif ${OPSYS} == "Linux"
119 LOWER_OPSYS?=           linux
120 MACHINE_ARCH:=          ${MACHINE_ARCH:C/i.86/i386/}
121 .  if !defined(LOWER_ARCH)
122 LOWER_ARCH!=            ${UNAME} -m | sed -e 's/i.86/i386/'
123 .  endif # !defined(LOWER_ARCH)
124 .  if ${MACHINE_ARCH} == "unknown" || ${MACHINE_ARCH} == ""
125 MACHINE_ARCH=           ${LOWER_ARCH}
126 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
127 .  endif
128 .  if exists(/etc/debian_version)
129 LOWER_VENDOR?=          debian
130 .  elif exists(/etc/mandrake-release)
131 LOWER_VENDOR?=          mandrake
132 .  elif exists(/etc/redhat-version)
133 LOWER_VENDOR?=          redhat
134 .  elif exists(/etc/slackware-version)
135 LOWER_VENDOR?=          slackware
136 .  elif ${LOWER_ARCH} == "i386"
137 LOWER_VENDOR?=          pc
138 .  else
139 LOWER_VENDOR?=          unknown
140 .  endif
141
142 .elif ${OPSYS} == "Darwin"
143 LOWER_OPSYS?=           darwin
144 LOWER_ARCH!=            ${UNAME} -p
145 MACHINE_ARCH=           ${LOWER_ARCH}
146 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
147 LOWER_VENDOR?=          apple
148
149 .elif ${OPSYS:MIRIX*} != ""
150 LOWER_ARCH!=            ${UNAME} -p
151 LOWER_OPSYS?=           irix${OS_VERSION}
152 LOWER_VENDOR?=          sgi
153
154 .elif ${OPSYS} == "Interix"
155 LOWER_OPSYS?=           interix3
156 LOWER_VENDOR?=          pc
157
158 .elif !defined(LOWER_OPSYS)
159 LOWER_OPSYS!=           echo ${OPSYS} | tr A-Z a-z
160 .endif
161
162 MAKEFLAGS+=             LOWER_OPSYS=${LOWER_OPSYS}
163
164 LOWER_VENDOR?=
165 LOWER_ARCH?=            ${MACHINE_GNU_ARCH}
166
167 MACHINE_PLATFORM?=      ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
168 MACHINE_GNU_PLATFORM?=  ${LOWER_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
169
170 # Needed to prevent an "install:" target from being created in bsd.own.mk.
171 NEED_OWN_INSTALL_TARGET=no
172
173 # This prevents default use of the cross-tool harness in the "src" tree,
174 # in the odd possible case of someone extracting "pkgsrc" underneath "src".
175 USETOOLS=               no
176 MAKE_ENV+=              USETOOLS=no
177
178 # Set this before <bsd.own.mk> does, since it doesn't know about Darwin
179 .if ${OPSYS} == "Darwin"
180 OBJECT_FMT?=            Mach-O
181 .endif
182
183 .include <bsd.own.mk>
184
185 # /usr/share/mk/bsd.own.mk on NetBSD 1.3 does not define OBJECT_FMT
186 .if !empty(MACHINE_PLATFORM:MNetBSD-1.3*)
187 .  if ${MACHINE_ARCH} == "alpha" || \
188       ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
189       ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
190 OBJECT_FMT?=            ELF
191 .  else
192 OBJECT_FMT?=            a.out
193 .  endif
194 # override what bootstrap-pkgsrc sets, which isn't right for NetBSD
195 # 1.4.
196 # XXX other ELF platforms in 1.4 need to be added to here.
197 .elif !empty(MACHINE_PLATFORM:MNetBSD-1.4*)
198 .  if ${MACHINE_ARCH} == "alpha" || \
199       ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
200       ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
201 OBJECT_FMT=             ELF
202 .  else
203 OBJECT_FMT=             a.out
204 .  endif
205 .endif
206
207 .if ${OPSYS} == "OpenBSD"
208 .  if defined(ELF_TOOLCHAIN) && ${ELF_TOOLCHAIN} == "yes"
209 OBJECT_FMT?=    ELF
210 .  else
211 OBJECT_FMT?=    a.out
212 .  endif
213 .endif
214
215 # include the defaults file
216 .if exists(${.CURDIR}/../../mk/bsd.pkg.defaults.mk)
217 .  include "${.CURDIR}/../../mk/bsd.pkg.defaults.mk"
218 .elif exists(${.CURDIR}/../mk/bsd.pkg.defaults.mk)
219 .  include "${.CURDIR}/../mk/bsd.pkg.defaults.mk"
220 .elif exists(${.CURDIR}/mk/bsd.pkg.defaults.mk)
221 .  include "${.CURDIR}/mk/bsd.pkg.defaults.mk"
222 .endif
223
224 .if ${OPSYS} == "NetBSD"
225 .  if ${OBJECT_FMT} == "ELF" && \
226    (${MACHINE_GNU_ARCH} == "arm" || \
227     ${MACHINE_ARCH} == "i386" || \
228     ${MACHINE_ARCH} == "m68k" || \
229     ${MACHINE_ARCH} == "m68000" || \
230     ${MACHINE_GNU_ARCH} == "sh" || \
231     ${MACHINE_GNU_ARCH} == "shle" || \
232     ${MACHINE_ARCH} == "sparc" || \
233     ${MACHINE_ARCH} == "vax")
234 APPEND_ELF=             elf
235 .  endif
236 .endif
237
238 SHAREOWN?=              ${DOCOWN}
239 SHAREGRP?=              ${DOCGRP}
240 SHAREMODE?=             ${DOCMODE}
241
242 .if defined(PREFIX) && (${PREFIX} != ${__PREFIX_SET__})
243 .BEGIN:
244         @${ECHO_MSG} "You can NOT set PREFIX manually or in mk.conf.  Set LOCALBASE or X11BASE"
245         @${ECHO_MSG} "depending on your needs.  See the pkg system documentation for more info."
246         @${FALSE}
247 .endif
248
249 # Preload all default values for CFLAGS, LDFLAGS, etc. before bsd.pkg.mk
250 # or a pkg Makefile modifies them.
251 .include <sys.mk>
252
253 # Load the OS-specific definitions for program variables.  Default to loading
254 # the NetBSD ones if an OS-specific file doesn't exist.
255 .if exists(${.CURDIR}/../../mk/defs.${OPSYS}.mk)
256 .  include "${.CURDIR}/../../mk/defs.${OPSYS}.mk"
257 .elif exists(${.CURDIR}/../mk/defs.${OPSYS}.mk)
258 .  include "${.CURDIR}/../mk/defs.${OPSYS}.mk"
259 .elif exists(${.CURDIR}/mk/defs.${OPSYS}.mk)
260 .  include "${.CURDIR}/mk/defs.${OPSYS}.mk"
261 .elif exists(${.CURDIR}/../../mk/defs.NetBSD.mk)
262 .  include "${.CURDIR}/../../mk/defs.NetBSD.mk"
263 .elif exists(${.CURDIR}/../mk/defs.NetBSD.mk)
264 .  include "${.CURDIR}/../mk/defs.NetBSD.mk"
265 .elif exists(${.CURDIR}/mk/defs.NetBSD.mk)
266 .  include "${.CURDIR}/mk/defs.NetBSD.mk"
267 .endif
268
269 PKGDIRMODE?=            755
270 PKG_PHASE?=             none
271 #
272 # The PHASES_AFTER_<phase> variables list every phase "greater than or
273 # equal to" <phase>.
274 #
275 PHASES_AFTER_FETCH=     fetch ${PHASES_AFTER_EXTRACT}
276 PHASES_AFTER_EXTRACT=   extract ${PHASES_AFTER_PATCH}
277 PHASES_AFTER_PATCH=     patch ${PHASES_AFTER_TOOLS}
278 PHASES_AFTER_TOOLS=     tools ${PHASES_AFTER_BUILDLINK}
279 PHASES_AFTER_BUILDLINK= buildlink ${PHASES_AFTER_CONFIGURE}
280 PHASES_AFTER_CONFIGURE= configure ${PHASES_AFTER_BUILD}
281 PHASES_AFTER_BUILD=     build ${PHASES_AFTER_INSTALL}
282 PHASES_AFTER_INSTALL=   install ${PHASES_AFTER_PACKAGE}
283 PHASES_AFTER_PACKAGE=   package
284
285 # Set the style of installation to be performed for the package.  The
286 # funky make variable modifiers just select the first word of the value
287 # stored in the referenced variable.
288 #
289 .for _pref_ in ${PKG_INSTALLATION_PREFS}
290 .  if !empty(PKG_INSTALLATION_TYPES:M${_pref_})
291 PKG_INSTALLATION_TYPE?= ${PKG_INSTALLATION_TYPES:M${_pref_}:S/^/_pkginsttype_/1:M_pkginsttype_*:S/^_pkginsttype_//}
292 .  endif
293 .endfor
294 PKG_INSTALLATION_TYPE?= none
295
296 # if the system is IPv6-ready, compile with IPv6 support turned on.
297 .if defined(USE_INET6)
298 .  if empty(USE_INET6:M[Yy][Ee][Ss]) || defined(USE_SOCKS)
299 USE_INET6=              NO
300 .  else
301 PKG_DEFAULT_OPTIONS+=   inet6
302 USE_INET6=              YES
303 .  endif
304 .elif empty(_OPSYS_HAS_INET6:M[nN][oO]) && !defined(USE_SOCKS)
305 PKG_DEFAULT_OPTIONS+=   inet6
306 USE_INET6=              YES
307 .else
308 USE_INET6=              NO
309 .endif
310
311 LOCALBASE?=             ${DESTDIR}/usr/pkg
312 .if ${OPSYS} == "SunOS"
313 # On Solaris, we default to using OpenWindows for X11.
314 X11BASE?=       ${DESTDIR}/usr/openwin
315 .elif !defined(X11_TYPE) || defined(X11_TYPE) && !empty(X11_TYPE:Mnative)
316 X11BASE?=       ${DESTDIR}/usr/X11R6
317 .endif
318 CROSSBASE?=     ${LOCALBASE}/cross
319
320 # If xpkgwedge.def is found, then clearly we're using xpkgwedge.
321 .if exists(${LOCALBASE}/lib/X11/config/xpkgwedge.def) || \
322     exists(${X11BASE}/lib/X11/config/xpkgwedge.def)
323 USE_XPKGWEDGE=  yes
324 .else
325 USE_XPKGWEDGE?= yes
326 .endif
327
328 .if defined(_OPSYS_NEEDS_XPKGWEDGE) && \
329     !empty(_OPSYS_NEEDS_XPKGWEDGE:M[yY][eE][sS])
330 USE_XPKGWEDGE=  yes
331 .endif
332
333 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
334 USE_XPKGWEDGE=          yes
335 _XPKGWEDGE_REQD=        1.9
336 .else
337 _XPKGWEDGE_REQD=        1.5
338 .endif
339
340 # Set X11PREFIX to reflect the install directory of X11 packages.
341 # Set XMKMF_CMD properly if xpkgwedge is installed.
342 #
343 # The check for the existence of ${X11BASE}/lib/X11/config/xpkgwedge.def
344 # is to catch users of xpkgwedge<1.0.
345 #
346 XMKMF?=                 ${XMKMF_CMD} ${XMKMF_FLAGS} -a
347 XMKMF_FLAGS?=           # empty
348 .if !empty(USE_XPKGWEDGE:M[Yy][Ee][Ss]) 
349 X11PREFIX=              ${LOCALBASE}
350 XMKMF_CMD?=             ${X11PREFIX}/bin/pkgxmkmf
351 .else
352 X11PREFIX=              ${X11BASE}
353 XMKMF_CMD?=             ${X11PREFIX}/bin/xmkmf
354 .endif
355
356 DEPOT_SUBDIR?=          packages
357 DEPOTBASE=              ${LOCALBASE}/${DEPOT_SUBDIR}
358
359 # LINK_RPATH_FLAG publicly exports the linker flag used to set the
360 # run-time library search path.
361 #
362 .if defined(_OPSYS_LINKER_RPATH_FLAG)
363 LINKER_RPATH_FLAG=      ${_OPSYS_LINKER_RPATH_FLAG}
364 .else
365 LINKER_RPATH_FLAG?=     ${_LINKER_RPATH_FLAG}
366 .endif
367
368 # COMPILER_RPATH_FLAG publicly exports the compiler flag used to pass
369 # run-time library search path directives to the linker.
370 #
371 .if defined(_OPSYS_COMPILER_RPATH_FLAG)
372 COMPILER_RPATH_FLAG=    ${_OPSYS_COMPILER_RPATH_FLAG}
373 .else
374 COMPILER_RPATH_FLAG?=   ${_COMPILER_RPATH_FLAG}
375 .endif
376
377 # WHOLE_ARCHIVE_FLAG and NO_WHOLE_ARCHIVE_FLAG publically export the
378 # linker flags to extract all symbols from a static archive.
379 WHOLE_ARCHIVE_FLAG?=    ${_OPSYS_WHOLE_ARCHIVE_FLAG}
380 NO_WHOLE_ARCHIVE_FLAG?= ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG}
381
382 .ifndef DIGEST
383 DIGEST:=                ${LOCALBASE}/bin/digest
384 MAKEFLAGS+=             DIGEST=${DIGEST}
385 .endif
386
387 # Only add the DIGEST_VERSION value to MAKEFLAGS when we know
388 # we've got a valid version number, retrieved from the digest(1)
389 # binary. This is different to PKGTOOLS_VERSION, since, in that
390 # case, the build dies when pkg_info(1) is out of date.
391
392 .if !exists(${DIGEST})
393 DIGEST_VERSION=         20010301
394 .elif !defined(DIGEST_VERSION)
395 DIGEST_VERSION!=        ${DIGEST} -V 2>/dev/null
396 MAKEFLAGS+=             DIGEST_VERSION=${DIGEST_VERSION}
397 .endif
398
399 # This is the package database directory for the default view.
400 PKG_DBDIR?=             ${DESTDIR}/var/db/pkg
401
402 # _PKG_DBDIR is the actual packages database directory where we register
403 # packages.
404 #
405 .if ${PKG_INSTALLATION_TYPE} == "overwrite"
406 _PKG_DBDIR=             ${PKG_DBDIR}
407 .elif ${PKG_INSTALLATION_TYPE} == "pkgviews"
408 _PKG_DBDIR=             ${DEPOTBASE}
409 .endif
410
411 PKG_ADD_CMD?=           ${PKG_TOOLS_BIN}/pkg_add
412 PKG_ADMIN_CMD?=         ${PKG_TOOLS_BIN}/pkg_admin
413 PKG_CREATE_CMD?=        ${PKG_TOOLS_BIN}/pkg_create
414 PKG_DELETE_CMD?=        ${PKG_TOOLS_BIN}/pkg_delete
415 PKG_INFO_CMD?=          ${PKG_TOOLS_BIN}/pkg_info
416 PKG_VIEW_CMD?=          ${PKG_TOOLS_BIN}/pkg_view
417 LINKFARM_CMD?=          ${PKG_TOOLS_BIN}/linkfarm
418
419 .if !defined(PKGTOOLS_VERSION)
420 PKGTOOLS_VERSION!=      ${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
421 MAKEFLAGS+=             PKGTOOLS_VERSION=${PKGTOOLS_VERSION}
422 .endif
423
424 # The binary pkg_install tools all need to consistently to refer to the
425 # correct package database directory.
426 #
427 .if ${PKGTOOLS_VERSION} < 20030823
428 PKGTOOLS_ENV?=          PKG_DBDIR=${_PKG_DBDIR}
429 PKGTOOLS_ARGS?=         # empty
430 .else
431 PKGTOOLS_ENV?=          # empty
432 PKGTOOLS_ARGS?=         -K ${_PKG_DBDIR}
433 .endif
434
435 # Views are rooted in ${LOCALBASE}, all packages are depoted in
436 # ${DEPOTBASE}, and the package database directory for the default view
437 # is in ${PKG_DBDIR}.
438 #
439 PKG_VIEW_ARGS?=         -W ${LOCALBASE} -d ${DEPOTBASE} -k ${PKG_DBDIR}
440
441 PKG_ADD?=               ${PKGTOOLS_ENV} ${PKG_ADD_CMD} ${PKGTOOLS_ARGS}
442 PKG_ADMIN?=             ${PKGTOOLS_ENV} ${PKG_ADMIN_CMD} ${PKGTOOLS_ARGS}
443 PKG_CREATE?=            ${PKGTOOLS_ENV} ${PKG_CREATE_CMD} ${PKGTOOLS_ARGS}
444 PKG_DELETE?=            ${PKGTOOLS_ENV} ${PKG_DELETE_CMD} ${PKGTOOLS_ARGS}
445 PKG_INFO?=              ${PKGTOOLS_ENV} ${PKG_INFO_CMD} ${PKGTOOLS_ARGS}
446 PKG_VIEW?=              ${PKGTOOLS_ENV} ${PKG_VIEW_CMD} ${PKG_VIEW_ARGS}
447 LINKFARM?=              ${LINKFARM_CMD}
448
449 # "${PKG_BEST_EXISTS} pkgpattern" prints out the name of the installed
450 # package that best matches pkgpattern.  Use this instead of
451 # "${PKG_INFO} -e pkgpattern" if the latter would return more than one
452 # package name.
453 #
454 PKG_BEST_EXISTS?=       ${PKG_ADMIN} -b -d ${_PKG_DBDIR} -S lsbest
455
456 USE_BUILDLINK3?=        no      # default to not using buildlink3
457 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
458 USE_BUILDLINK3=         yes     # pkgviews requires buildlink3
459 .endif
460
461 .if exists(${LOCALBASE}/bsd/share/mk/zoularis.mk)
462 PKG_FAIL_REASON+=       'You appear to have a deprecated Zoularis installation.'
463 PKG_FAIL_REASON+=       'Please update your system to bootstrap-pkgsrc and remove the'
464 PKG_FAIL_REASON+=       '${LOCALBASE}/bsd directory.'
465 PKG_FAIL_REASON+=       'See http://mail-index.NetBSD.org/tech-pkg/2004/02/14/0004.html'
466 PKG_FAIL_REASON+=       'for more details.'
467 .endif
468
469 _PKGSRCDIR?=            ${.CURDIR:C|/[^/]*/[^/]*$||}
470 PKGPATH?=               ${.CURDIR:C|.*/([^/]*/[^/]*)$|\1|}
471
472 DISTDIR?=               ${_PKGSRCDIR}/distfiles
473 PACKAGES?=              ${_PKGSRCDIR}/packages
474 TEMPLATES?=             ${_PKGSRCDIR}/templates
475
476 PATCHDIR?=              ${.CURDIR}/patches
477 SCRIPTDIR?=             ${.CURDIR}/scripts
478 FILESDIR?=              ${.CURDIR}/files
479 PKGDIR?=                ${.CURDIR}
480
481 _PKGSRC_DEPS?=          # empty
482
483 # If WRKOBJDIR is set, use that tree to build
484 .if defined(WRKOBJDIR)
485 BUILD_DIR?=             ${WRKOBJDIR}/${PKGPATH}
486 .else
487 BUILD_DIR!=             cd ${.CURDIR} && ${PWD_CMD}
488 .endif
489
490 # If OBJHOSTNAME is set, use first component of hostname in directory name.
491 # If OBJMACHINE is set, use ${MACHINE_ARCH} in the working directory name.
492 #
493 .if defined(OBJHOSTNAME)
494 .  if !defined(_HOSTNAME)
495 _HOSTNAME!=             ${UNAME} -n
496 MAKEFLAGS+=             _HOSTNAME=${_HOSTNAME}
497 .  endif
498 WRKDIR_BASENAME?=       work.${_HOSTNAME:C|\..*||}
499 MAKEFLAGS+=             OBJHOSTNAME=${OBJHOSTNAME}
500 .elif defined(OBJMACHINE)
501 WRKDIR_BASENAME?=       work.${MACHINE_ARCH}
502 MAKEFLAGS+=             OBJMACHINE=${OBJMACHINE}
503 .else
504 WRKDIR_BASENAME?=       work
505 .endif
506
507 WRKDIR?=                ${BUILD_DIR}/${WRKDIR_BASENAME}
508
509 # There are many uses for a common log file, so define one that may be
510 # picked up and used by tools.mk, bsd.buildlink3.mk, etc.
511 #
512 WRKLOG?=                ${WRKDIR}/.work.log
513
514 PKG_DEFAULT_OPTIONS?=   # empty
515 PKG_OPTIONS?=           # empty
516
517 .endif  # BSD_PKG_MK