Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / bsd.prefs.mk
blob123f886982c22691ac9001b516d3b56fc84c243c
1 # $NetBSD: bsd.prefs.mk,v 1.335 2013/04/03 13:45:49 obache Exp $
3 # This file includes the mk.conf file, which contains the user settings.
5 # Packages should include this file before any of the .if directives, as
6 # well as before modifying variables like CFLAGS, LDFLAGS, and so on.
7 # Otherwise the behavior may be unexpected.
9 # When mk.conf is included by this file, the following variables are
10 # defined:
12 # ACCEPTABLE_LICENSES
13 # This variable is set to the list of Open Source licenses. See
14 # mk/license.mk for details.
16 # MACHINE_PLATFORM
17 # The platform for which the packages are built. It has the form
18 # ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}.
20 # NATIVE_MACHINE_PLATFORM
21 # The platform on which the packages are built. This is usually
22 # the same as ${MACHINE_PLATFORM}, but can be different when
23 # cross-building packages.
25 # PKGPATH
26 # The path of the package, relative to the pkgsrc top-level
27 # directory. Typical values look like editors/emacs or
28 # misc/openoffice-bin.
30 # Keywords: mk.conf user
33 .if !defined(BSD_PKG_MK)
35 # Let mk.conf know that this is pkgsrc.
36 BSD_PKG_MK=1
37 __PREFIX_SET__:=${PREFIX}
39 # Set PATH if not already set
40 .if !defined(PATH)
41 PATH=/bin:/usr/bin:/sbin:/usr/sbin
42 .endif
44 # Expand MAKE to a full path.
45 .if !defined(_MAKE)
46 _MAKE:= ${MAKE}
47 # allow for MAKE=./make and similar.
48 . if empty(_MAKE:M/*) && !empty(_MAKE:M*/*) && defined(PWD) && exists(${PWD}/${MAKE})
49 _MAKE:= ${PWD}/${MAKE}
50 . endif
51 . for _dir_ in ${PATH:C/\:/ /g}
52 . if empty(_MAKE:M/*)
53 . if exists(${_dir_}/${MAKE})
54 _MAKE:= ${_dir_}/${MAKE}
55 . endif
56 . endif
57 . endfor
58 . if !empty(_MAKE:M/*)
59 MAKEFLAGS+= _MAKE=${_MAKE:Q}
60 . endif
61 .endif
62 MAKE:= ${_MAKE}
64 .if exists(/usr/bin/uname)
65 UNAME=/usr/bin/uname
66 .elif exists(/bin/uname)
67 UNAME=/bin/uname
68 .else
69 UNAME=echo Unknown
70 .endif
72 .if !defined(OPSYS)
73 OPSYS:= ${:!${UNAME} -s!:S/-//g:S/\///g:C/^CYGWIN_.*$/Cygwin/}
74 MAKEFLAGS+= OPSYS=${OPSYS:Q}
75 .endif
77 # OS_VARIANT is used to differentiate operating systems which have a common
78 # basis but offer contrasting environments, for example Linux distributions
79 # or illumos forks.
80 OS_VARIANT?= # empty
82 # The _CMD indirection allows code below to modify these values
83 # without executing the commands at all. Later, recursed make
84 # invocations will skip these blocks entirely thanks to MAKEFLAGS.
85 .if !defined(OS_VERSION)
86 _OS_VERSION_CMD= ${UNAME} -r
87 OS_VERSION= ${_OS_VERSION_CMD:sh}
88 MAKEFLAGS+= OS_VERSION=${OS_VERSION:Q}
89 .endif
91 # Preload these for architectures not in all variations of bsd.own.mk,
92 # which do not match their GNU names exactly.
93 GNU_ARCH.arm26?= arm
94 GNU_ARCH.arm32?= arm
95 GNU_ARCH.i486?= i386
96 GNU_ARCH.i586?= i386
97 GNU_ARCH.i686?= i386
98 GNU_ARCH.m68000?= m68010
99 GNU_ARCH.mips?= mipsel
100 GNU_ARCH.sh3eb?= sh
101 GNU_ARCH.sh3el?= shle
102 NATIVE_MACHINE_GNU_ARCH?= ${GNU_ARCH.${NATIVE_MACHINE_ARCH}:U${NATIVE_MACHINE_ARCH}}
103 MACHINE_GNU_ARCH?= ${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
105 ## If changes are made to how OS_VERSION is set below please keep
106 ## "pkgsrc/pkgtools/osabi/INSTALL" in-sync.
107 .if ${OPSYS} == "NetBSD"
108 LOWER_OPSYS?= netbsd
110 .elif ${OPSYS} == "AIX"
111 LOWER_ARCH!= _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $$1 }'`; \
112 if /usr/sbin/lsattr -El $$_cpuid | grep ' POWER' >/dev/null 2>&1; then \
113 echo rs6000; \
114 else \
115 echo powerpc; \
117 MACHINE_ARCH?= ${LOWER_ARCH}
118 . if exists(/usr/bin/oslevel)
119 _OS_VERSION!= /usr/bin/oslevel
120 . else
121 _OS_VERSION!= echo `${UNAME} -v`.`${UNAME} -r`
122 . endif
123 OS_VERSION= ${_OS_VERSION:C/([0-9]*\.[0-9]*).*/\1/}
124 LOWER_OPSYS_VERSUFFIX= ${_OS_VERSION}
125 LOWER_OPSYS?= aix
126 LOWER_VENDOR?= ibm
128 .elif ${OPSYS} == "BSDOS"
129 LOWER_OPSYS?= bsdi
131 .elif ${OPSYS} == "Cygwin"
132 LOWER_OPSYS?= cygwin
133 LOWER_VENDOR?= pc
134 . if !defined(LOWER_ARCH)
135 LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/'
136 . endif # !defined(LOWER_ARCH)
137 _OS_VERSION!= ${UNAME} -r
138 OS_VERSION= ${_OS_VERSION:C/\(.*\)//}
139 OS_VARIANT!= ${UNAME} -s
141 .elif ${OPSYS} == "Darwin"
142 LOWER_OPSYS?= darwin
143 .if empty(OS_VERSION:M[1-9].*.*)
144 # Automatically select the ABI under Mac OS X Snow Leopard. We don't
145 # use this at the moment because too many third party programs don't
146 # work with it.
148 # _SYSCTL_HW_OPTIONAL_X86_64!= /usr/sbin/sysctl -n hw.optional.x86_64
149 # . if ${_SYSCTL_HW_OPTIONAL_X86_64} == "1"
150 # ABI= 64
151 # .else
152 # ABI= 32
153 #. endif
154 ABI= 32
155 LOWER_ARCH.32= i386
156 LOWER_ARCH.64= x86_64
157 LOWER_ARCH= ${LOWER_ARCH.${ABI}}
158 .else
159 LOWER_ARCH!= ${UNAME} -p
160 .endif
161 MACHINE_ARCH= ${LOWER_ARCH}
162 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
163 LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
164 LOWER_VENDOR?= apple
166 .elif ${OPSYS} == "DragonFly"
167 OS_VERSION:= ${OS_VERSION:C/-.*$//}
168 LOWER_OPSYS?= dragonfly
169 LOWER_ARCH!= ${UNAME} -p
170 . if ${LOWER_ARCH} == "amd64"
171 MACHINE_ARCH= x86_64
172 . else
173 MACHINE_ARCH= ${LOWER_ARCH}
174 . endif
175 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
176 LOWER_VENDOR?= pc
178 .elif ${OPSYS} == "FreeBSD"
179 OS_VERSION:= ${OS_VERSION:C/-.*$//}
180 LOWER_OPSYS?= freebsd
181 LOWER_ARCH!= ${UNAME} -p
182 . if ${LOWER_ARCH} == "amd64"
183 MACHINE_ARCH= x86_64
184 . else
185 MACHINE_ARCH= ${LOWER_ARCH}
186 . endif
187 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
188 LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
189 . if ${LOWER_ARCH} == "i386"
190 LOWER_VENDOR?= pc
191 . endif
192 LOWER_VENDOR?= unknown
194 .elif ${OPSYS} == "Haiku"
195 LOWER_OPSYS?= haiku
196 . if ${MACHINE_ARCH} == "i386"
197 LOWER_VENDOR?= pc
198 . endif
200 .elif ${OPSYS} == "Interix"
201 LOWER_OPSYS?= interix
202 LOWER_VENDOR?= pc
203 . if exists(/usr/lib/libc.so.5.2) || exists(/usr/lib/x86/libc.so.5.2)
204 LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
205 . else
206 LOWER_OPSYS_VERSUFFIX?= 3
207 . if exists(/usr/lib/libc.so.3.5)
208 OS_VERSION= 3.5
209 . elif exists(/usr/lib/libc.so.3.1)
210 OS_VERSION= 3.1
211 . else
212 OS_VERSION= 3.0
213 . endif
214 . endif
216 .elif ${OPSYS} == "MirBSD"
217 LOWER_OPSYS?= mirbsd
218 LOWER_OS_VERSION= ${OS_VERSION}
219 LOWER_OPSYS_VERSUFFIX= ${OS_VERSION}
220 LOWER_ARCH!= arch -s
221 LOWER_VENDOR?= unknown
222 MACHINE_ARCH= ${LOWER_ARCH}
223 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
225 .elif !empty(OPSYS:MIRIX*)
226 LOWER_ARCH!= ${UNAME} -p
227 LOWER_OPSYS?= irix
228 LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
229 LOWER_VENDOR?= sgi
231 .elif ${OPSYS} == "Linux"
232 OS_VERSION:= ${OS_VERSION:C/-.*$//}
233 LOWER_OPSYS?= linux
234 . if !defined(LOWER_ARCH)
235 LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/'
236 . endif # !defined(LOWER_ARCH)
237 MACHINE_ARCH= ${LOWER_ARCH}
238 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
239 . if exists(/etc/debian_version)
240 LOWER_VENDOR?= debian
241 . elif exists(/etc/mandrake-release)
242 LOWER_VENDOR?= mandrake
243 . elif exists(/etc/redhat-version)
244 LOWER_VENDOR?= redhat
245 . elif exists(/etc/slackware-version)
246 LOWER_VENDOR?= slackware
247 . elif exists(/etc/ssdlinux_version)
248 LOWER_VENDOR?= ssd
249 . elif ${LOWER_ARCH} == "i386"
250 LOWER_VENDOR?= pc
251 . endif
252 LOWER_VENDOR?= unknown
254 .elif ${OPSYS} == "OSF1"
255 LOWER_ARCH!= ${UNAME} -p
256 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
257 MACHINE_ARCH?= ${LOWER_ARCH}
258 OS_VERSION:= ${OS_VERSION:C/^V//}
259 LOWER_OPSYS?= osf1
260 LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
261 LOWER_VENDOR?= dec
263 .elif ${OPSYS} == "HPUX"
264 OS_VERSION:= ${OS_VERSION:C/^B.//}
265 .if ${MACHINE_ARCH} == "9000"
266 MACHINE_ARCH= hppa
267 .endif
268 LOWER_OPSYS?= hpux
269 LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
270 LOWER_VENDOR?= hp
272 .elif ${OPSYS} == "SunOS"
273 ABI?= 32
274 . if ${MACHINE_ARCH} == "sparc"
275 SPARC_TARGET_ARCH?= sparcv7
276 . elif ${MACHINE_ARCH} == "sun4"
277 MACHINE_ARCH= sparc
278 SPARC_TARGET_ARCH?= sparcv7
279 . elif ${MACHINE_ARCH} == "i86pc" || ${MACHINE_ARCH} == "i86xpv" || ${MACHINE_ARCH} == "i386"
280 LOWER_ARCH.32= i386
281 LOWER_ARCH.64= x86_64
282 LOWER_ARCH= ${LOWER_ARCH.${ABI}}
283 MACHINE_ARCH= ${LOWER_ARCH}
284 . elif ${MACHINE_ARCH} == "unknown"
285 . if !defined(LOWER_ARCH)
286 LOWER_ARCH!= ${UNAME} -p
287 . endif # !defined(LOWER_ARCH)
288 MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
289 . endif
290 LOWER_VENDOR?= sun
291 LOWER_OPSYS?= solaris
292 LOWER_OPSYS_VERSUFFIX= 2.${OS_VERSION:C/5.//}
293 _UNAME_V!= ${UNAME} -v
294 . if !empty(_UNAME_V:Mjoyent_*)
295 OS_VARIANT= SmartOS
296 . endif
298 .elif ${OPSYS} == "Minix"
299 LOWER_VENDOR?= pc
300 LOWER_OPSYS:= ${OPSYS:tl}
301 LDFLAGS+= -lcompat_minix -lminlib
303 .elif !defined(LOWER_OPSYS)
304 LOWER_OPSYS:= ${OPSYS:tl}
305 .endif
307 # Now commit the [LOWER_]OS_VERSION values computed above, eliding the :sh
308 OS_VERSION:= ${OS_VERSION}
309 LOWER_OS_VERSION:= ${OS_VERSION:tl}
311 MAKEFLAGS+= LOWER_OPSYS=${LOWER_OPSYS:Q}
313 LOWER_VENDOR?= # empty ("arch--opsys")
314 LOWER_ARCH?= ${MACHINE_GNU_ARCH}
315 # Expand now as MACHINE_ARCH can be overriden in mk.conf and
316 # LOWER_ARCH is typically derived from it.
317 NATIVE_LOWER_ARCH:= ${LOWER_ARCH}
318 NATIVE_MACHINE_ARCH:= ${MACHINE_ARCH}
320 NATIVE_MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${NATIVE_MACHINE_ARCH}
321 MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
322 NATIVE_MACHINE_GNU_PLATFORM?= ${NATIVE_MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
323 MACHINE_GNU_PLATFORM?= ${MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
325 # Needed to prevent an "install:" target from being created in bsd.own.mk.
326 NEED_OWN_INSTALL_TARGET=no
328 # This prevents default use of the cross-tool harness in the "src" tree,
329 # in the odd possible case of someone extracting "pkgsrc" underneath "src".
330 USETOOLS= no
331 MAKE_ENV+= USETOOLS=no
333 # Set this before <bsd.own.mk> does, since it doesn't know about Darwin
334 .if ${OPSYS} == "Darwin"
335 OBJECT_FMT?= Mach-O
336 .endif
338 ACCEPTABLE_LICENSES?= ${DEFAULT_ACCEPTABLE_LICENSES}
340 # Provide PKGPATH early on so that mk.conf can use it.
341 PKGPATH?= ${.CURDIR:C|.*/([^/]*/[^/]*)$|\1|}
343 # Load the settings from MAKECONF, which is /etc/mk.conf by default.
344 .include <bsd.own.mk>
346 # /usr/share/mk/bsd.own.mk on NetBSD 1.3 does not define OBJECT_FMT
347 .if !empty(MACHINE_PLATFORM:MNetBSD-1.3*)
348 . if ${MACHINE_ARCH} == "alpha" || \
349 ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
350 ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
351 OBJECT_FMT?= ELF
352 . else
353 OBJECT_FMT?= a.out
354 . endif
355 # override what bootstrap-pkgsrc sets, which isn't right for NetBSD
356 # 1.4.
357 # XXX other ELF platforms in 1.4 need to be added to here.
358 .elif !empty(MACHINE_PLATFORM:MNetBSD-1.4*)
359 . if ${MACHINE_ARCH} == "alpha" || \
360 ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
361 ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
362 OBJECT_FMT= ELF
363 . else
364 OBJECT_FMT= a.out
365 . endif
366 .endif
368 .if ${OPSYS} == "OpenBSD"
369 . if defined(ELF_TOOLCHAIN) && ${ELF_TOOLCHAIN} == "yes"
370 OBJECT_FMT?= ELF
371 . else
372 OBJECT_FMT?= a.out
373 . endif
374 .elif ${OPSYS} == "DragonFly"
375 OBJECT_FMT= ELF
376 .elif ${OPSYS} == "MirBSD"
377 OBJECT_FMT= ELF
378 MKPROFILE= no
379 .elif ${OPSYS} == "AIX"
380 OBJECT_FMT= XCOFF
381 .elif ${OPSYS} == "OSF1"
382 OBJECT_FMT= ECOFF
383 .elif ${OPSYS} == "HPUX"
384 . if ${MACHINE_ARCH} == "ia64" || (defined(ABI) && ${ABI} == "64")
385 OBJECT_FMT= ELF
386 . else
387 OBJECT_FMT= SOM
388 . endif
389 .elif ${OPSYS} == "Cygwin"
390 OBJECT_FMT= PE
391 .endif
393 # Calculate depth
394 .if exists(${.CURDIR}/mk/bsd.pkg.mk)
395 _PKGSRC_TOPDIR= ${.CURDIR}
396 .elif exists(${.CURDIR}/../mk/bsd.pkg.mk)
397 _PKGSRC_TOPDIR= ${.CURDIR}/..
398 .elif exists(${.CURDIR}/../../mk/bsd.pkg.mk)
399 _PKGSRC_TOPDIR= ${.CURDIR}/../..
400 .endif
402 # include the defaults file
403 .include "${_PKGSRC_TOPDIR}/mk/defaults/mk.conf"
405 SHAREOWN?= ${DOCOWN}
406 SHAREGRP?= ${DOCGRP}
407 SHAREMODE?= ${DOCMODE}
409 .if defined(PREFIX) && (${PREFIX} != ${__PREFIX_SET__})
410 .BEGIN:
411 @${ECHO_MSG} "You CANNOT set PREFIX manually or in mk.conf. Set LOCALBASE or X11BASE"
412 @${ECHO_MSG} "depending on your needs. See the pkg system documentation for more info."
413 @${FALSE}
414 .endif
416 # Load the OS-specific definitions for program variables. Default to loading
417 # the NetBSD ones if an OS-specific file doesn't exist.
418 .if exists(${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk)
419 . include "${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk"
420 .else
421 . include "${_PKGSRC_TOPDIR}/mk/platform/NetBSD.mk"
422 PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"
423 .endif
425 PKGDIRMODE?= 755
427 # A meta-package is a package that does not have any files and whose
428 # only purpose is to depend on other packages, giving that collection
429 # a simple name.
431 # This variable must be set before including bsd.prefs.mk directly or
432 # indirectly.
434 # Keywords: meta meta-package META_PACKAGE
436 .if defined(META_PACKAGE)
437 PKG_DESTDIR_SUPPORT= user-destdir
438 NO_CONFIGURE= yes
439 NO_BUILD= yes
440 DISTFILES= # none
441 PLIST_SRC= # none
442 CHECK_PERMS= no
443 USE_LANGUAGES= # empty
444 do-patch:
445 @${DO_NADA}
446 do-install:
447 @${DO_NADA}
448 .endif
450 # After 2011Q1, the default is to use DESTDIR.
451 USE_DESTDIR?= yes
452 # PKG_DESTDIR_SUPPORT can only be one of "none", "destdir", or "user-destdir".
453 PKG_DESTDIR_SUPPORT?= user-destdir
455 .if ${PKG_DESTDIR_SUPPORT} == "none" || empty(USE_DESTDIR:M[Yy][Ee][Ss])
456 . if empty(USE_DESTDIR:M[Yy][Ee][Ss]) && empty(USE_DESTDIR:M[Nn][Oo])
457 PKG_FAIL_REASON+= "USE_DESTDIR must be either \`\`yes'' or \`\`no''"
458 . endif
459 _USE_DESTDIR= no
460 .elif ${PKG_DESTDIR_SUPPORT} == "user-destdir"
461 _USE_DESTDIR= user-destdir
462 .elif ${PKG_DESTDIR_SUPPORT} == "destdir"
463 _USE_DESTDIR= destdir
464 .else
465 PKG_FAIL_REASON+= "PKG_DESTDIR_SUPPORT must be \`\`none'', \`\`destdir'', or \`\`user-destdir''."
466 .endif
468 # This stanza serves to warn the user; deciding to not build
469 # non-DESTDIR-capable packages when not in DESTDIR mode is above.
470 .if ${PKG_DESTDIR_SUPPORT} == "none"
471 WARNINGS+= "[bsd.prefs.mk] The package ${PKGNAME} is missing DESTDIR support."
472 .endif
474 # When using staged installation, everything gets installed into
475 # ${DESTDIR}${PREFIX} instead of ${PREFIX} directly.
477 .if ${_USE_DESTDIR} != "no"
478 DESTDIR= ${WRKDIR}/.destdir
479 . if ${_USE_DESTDIR} == "destdir"
480 _MAKE_PACKAGE_AS_ROOT= yes
481 _MAKE_CLEAN_AS_ROOT= yes
482 _MAKE_INSTALL_AS_ROOT= yes
483 . elif ${_USE_DESTDIR} == "user-destdir"
484 _MAKE_PACKAGE_AS_ROOT= no
485 _MAKE_CLEAN_AS_ROOT= no
486 _MAKE_INSTALL_AS_ROOT= no
487 . endif
488 .else
489 DESTDIR=
490 .endif
492 _MAKE_CLEAN_AS_ROOT?= no
493 # Whether to run the clean target as root.
494 _MAKE_INSTALL_AS_ROOT?= yes
495 # Whether to run the install target as root.
496 _MAKE_PACKAGE_AS_ROOT?= yes
497 # Whether to run the package target as root.
499 # When cross-compilation support is requested, the following options
500 # must be specified as well or guessable:
501 # - MACHINE_ARCH is set to TARGET_ARCH if set.
502 # - CROSS_DESTDIR is guessed from MAKEOBJDIR and MACHINE_ARCH.
503 # - PKG_DBDIR is expanded and prefixed with CROSS_DESTDIR
504 # - DESTDIR support is required
506 # _CROSS_DESTDIR is set for internal use to avoid conditionalising
507 # the use.
509 .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
510 . if defined(TARGET_ARCH)
511 MACHINE_ARCH= ${TARGET_ARCH}
512 . endif
513 CROSS_DESTDIR?= ${MAKEOBJDIR}/destdir.${MACHINE_ARCH}
514 . if !exists(${CROSS_DESTDIR}/usr/include/stddef.h)
515 PKG_FAIL_REASON+= "The cross-compiling root ${CROSS_DESTDIR:Q} is incomplete"
516 . else
517 _CROSS_DESTDIR= ${CROSS_DESTDIR}
518 . endif
519 .endif
521 # Depends on MACHINE_ARCH override above
522 .if ${OPSYS} == "NetBSD"
523 . if ${OBJECT_FMT} == "ELF" && \
524 (${MACHINE_GNU_ARCH} == "arm" || \
525 ${MACHINE_ARCH} == "i386" || \
526 ${MACHINE_ARCH} == "m68k" || \
527 ${MACHINE_ARCH} == "m68000" || \
528 ${MACHINE_GNU_ARCH} == "sh" || \
529 ${MACHINE_GNU_ARCH} == "shle" || \
530 ${MACHINE_ARCH} == "sparc" || \
531 ${MACHINE_ARCH} == "vax")
532 APPEND_ELF= elf
533 . endif
534 .endif
536 PKG_INSTALLATION_TYPES?= overwrite
537 # This is a whitespace-separated list of installation types supported
538 # by the package.
540 # *NOTE*: This variable *must* be set in the package Makefile *before*
541 # the inclusion of bsd.prefs.mk.
543 # Possible: any of: overwrite, pkgviews
544 # Default: overwrite
546 # Set the style of installation to be performed for the package. The
547 # funky make variable modifiers just select the first word of the value
548 # stored in the referenced variable.
550 .for _pref_ in ${PKG_INSTALLATION_PREFS}
551 . if !empty(PKG_INSTALLATION_TYPES:M${_pref_})
552 PKG_INSTALLATION_TYPE?= ${PKG_INSTALLATION_TYPES:M${_pref_}:S/^/_pkginsttype_/1:M_pkginsttype_*:S/^_pkginsttype_//}
553 . endif
554 .endfor
555 PKG_INSTALLATION_TYPE?= none
557 # if the system is IPv6-ready, compile with IPv6 support turned on.
558 .if empty(_OPSYS_HAS_INET6:M[nN][oO])
559 IPV6_READY= YES
560 .else
561 IPV6_READY= NO
562 .endif
564 LOCALBASE?= /usr/pkg
565 X11_TYPE?= modular
566 .if !empty(X11_TYPE:Mnative)
567 . if ${OPSYS} == "SunOS"
568 # On Solaris, we default to using OpenWindows for X11.
569 X11BASE?= /usr/openwin
570 . elif ${OPSYS} == "Cygwin" || ${OPSYS} == "IRIX" || ${OPSYS} == "OSF1" || ${OPSYS} == "HPUX"
571 X11BASE?= /usr
572 . elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*) || \
573 !empty(MACHINE_PLATFORM:MDarwin-10.*-*) || \
574 !empty(MACHINE_PLATFORM:MDarwin-11.*-*)
575 X11BASE?= /usr/X11
576 . elif !empty(MACHINE_PLATFORM:MDarwin-??.*-*)
577 X11BASE?= /opt/X11
578 . elif ${OPSYS} == "NetBSD" && ${X11FLAVOUR:U} == "Xorg"
579 X11BASE?= /usr/X11R7
580 . elif exists(/usr/X11R7/lib/libX11.so)
581 X11BASE?= /usr/X11R7
582 . else
583 X11BASE?= /usr/X11R6
584 . endif
585 .endif
586 CROSSBASE?= ${LOCALBASE}/cross
588 .if defined(FIX_SYSTEM_HEADERS) && ${FIX_SYSTEM_HEADERS} == "yes" && \
589 !defined(BOOTSTRAP_PKG) && \
590 exists(../../pkgtools/compat_headers/buildlink3.mk)
591 . include "../../pkgtools/compat_headers/buildlink3.mk"
592 .endif
594 .if ${X11_TYPE} == "modular"
595 X11BASE= ${LOCALBASE}
596 .endif
598 X11PREFIX= ${LOCALBASE}
600 # Default directory for font encodings
601 .if ${X11_TYPE} == "modular"
602 X11_ENCODINGSDIR?= ${X11BASE}/share/fonts/X11/encodings
603 .else
604 X11_ENCODINGSDIR?= ${X11BASE}/lib/X11/fonts/encodings
605 .endif
607 IMAKE_MAN_SOURCE_PATH= man/man
608 IMAKE_MAN_SUFFIX= 1
609 IMAKE_LIBMAN_SUFFIX= 3
610 IMAKE_KERNMAN_SUFFIX= 4
611 IMAKE_FILEMAN_SUFFIX= 5
612 IMAKE_GAMEMAN_SUFFIX= 6
613 IMAKE_MISCMAN_SUFFIX= 7
614 IMAKE_MAN_DIR= ${IMAKE_MAN_SOURCE_PATH}1
615 IMAKE_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3
616 IMAKE_KERNMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4
617 IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5
618 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6
619 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7
620 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX}
621 IMAKE_MANINSTALL?= maninstall
623 DEPOT_SUBDIR?= packages
624 DEPOTBASE= ${LOCALBASE}/${DEPOT_SUBDIR}
626 # LINK_RPATH_FLAG publicly exports the linker flag used to set the
627 # run-time library search path.
629 .if defined(_OPSYS_LINKER_RPATH_FLAG)
630 LINKER_RPATH_FLAG= ${_OPSYS_LINKER_RPATH_FLAG}
631 .else
632 LINKER_RPATH_FLAG?= ${_LINKER_RPATH_FLAG}
633 .endif
635 # COMPILER_RPATH_FLAG publicly exports the compiler flag used to pass
636 # run-time library search path directives to the linker.
638 .if defined(_OPSYS_COMPILER_RPATH_FLAG)
639 COMPILER_RPATH_FLAG= ${_OPSYS_COMPILER_RPATH_FLAG}
640 .else
641 COMPILER_RPATH_FLAG?= ${_COMPILER_RPATH_FLAG}
642 .endif
644 COMPILER_INCLUDE_DIRS?= ${_OPSYS_INCLUDE_DIRS:U/usr/include}
645 COMPILER_LIB_DIRS?= ${_OPSYS_LIB_DIRS:U/usr/lib${LIBABISUFFIX} /lib${LIBABISUFFIX}}
646 SYSTEM_DEFAULT_RPATH?= ${_OPSYS_SYSTEM_RPATH:U/usr/lib}
648 # WHOLE_ARCHIVE_FLAG and NO_WHOLE_ARCHIVE_FLAG publically export the
649 # linker flags to extract all symbols from a static archive.
651 WHOLE_ARCHIVE_FLAG?= ${_OPSYS_WHOLE_ARCHIVE_FLAG}
652 NO_WHOLE_ARCHIVE_FLAG?= ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG}
654 USE_TOOLS?= # empty
656 # Provide default values for TOOLs used by the top-level make.
657 USE_TOOLS+= [ awk dirname echo grep pwd sed test true
659 # These tools are used by the top-level make only in certain packages and
660 # should eventually be moved into those particular package Makefiles.
662 USE_TOOLS+= date tr
664 # These are tools used directly by bsd.prefs.mk and files included by
665 # bsd.prefs.mk.
667 USE_TOOLS+= awk:pkgsrc cut:pkgsrc echo:pkgsrc pwd:pkgsrc \
668 sed:pkgsrc tr:pkgsrc uname:pkgsrc
670 .include "${_PKGSRC_TOPDIR}/mk/tools/defaults.mk"
672 .if !defined(_PKGSRCDIR)
673 _PKGSRCDIR!= cd ${_PKGSRC_TOPDIR} && ${PWD_CMD}
674 MAKEFLAGS+= _PKGSRCDIR=${_PKGSRCDIR:Q}
675 .endif
676 PKGSRCDIR= ${_PKGSRCDIR}
678 DISTDIR?= ${PKGSRCDIR}/distfiles
679 PACKAGES?= ${PKGSRCDIR}/packages
680 TEMPLATES?= ${PKGSRCDIR}/templates
682 PATCHDIR?= ${.CURDIR}/patches
683 FILESDIR?= ${.CURDIR}/files
684 PKGDIR?= ${.CURDIR}
686 _PKGSRC_DEPS?= # empty
687 _BUILTIN_PKGS?= # empty
689 # If WRKOBJDIR is set, use that tree to build
690 .if defined(WRKOBJDIR)
691 BUILD_DIR?= ${WRKOBJDIR}/${PKGPATH}
692 .else
693 BUILD_DIR!= cd ${.CURDIR} && ${PWD_CMD}
694 .endif
696 # If OBJHOSTNAME is set, use first component of hostname in directory name.
697 # If OBJMACHINE is set, use ${MACHINE_ARCH} in the working directory name.
699 .if defined(OBJHOSTNAME)
700 . if !defined(_HOSTNAME)
701 _HOSTNAME!= ${UNAME} -n
702 MAKEFLAGS+= _HOSTNAME=${_HOSTNAME:Q}
703 . endif
704 WRKDIR_BASENAME?= work.${_HOSTNAME:C|\..*||}
705 MAKEFLAGS+= OBJHOSTNAME=${OBJHOSTNAME:Q}
706 .elif defined(OBJMACHINE)
707 WRKDIR_BASENAME?= work.${MACHINE_ARCH}
708 MAKEFLAGS+= OBJMACHINE=${OBJMACHINE:Q}
709 .else
710 WRKDIR_BASENAME?= work
711 .endif
713 WRKDIR?= ${BUILD_DIR}/${WRKDIR_BASENAME}
715 # There are many uses for a common log file, so define one that may be
716 # picked up and used by tools.mk, bsd.buildlink3.mk, etc.
718 WRKLOG?= ${WRKDIR}/.work.log
720 PKG_DEFAULT_OPTIONS?= # empty
721 PKG_OPTIONS?= # empty
723 # we want this *before* compiler.mk, so that compiler.mk paths override them
724 .if ${X11_TYPE} != "modular" && defined(USE_X11)
725 PREPEND_PATH+= ${X11BASE}/bin
726 .endif
727 PREPEND_PATH+= ${LOCALBASE}/bin
729 # Wrapper framework definitions
730 .include "wrapper/wrapper-defs.mk"
732 # Binary emulator framework definitions
733 .if defined(EMUL_PLATFORMS) && !empty(EMUL_PLATFORMS)
734 . include "emulator/emulator-vars.mk"
735 .endif
737 # System features framework
738 .include "features/features-vars.mk"
740 # Package system format definitions
741 .include "pkgformat/bsd.pkgformat-vars.mk"
743 # Make variable definitions cache
744 .include "bsd.makevars.mk"
746 # If MAKECONF is defined, then pass it down to all recursive make
747 # processes invoked by pkgsrc.
749 PKGSRC_MAKE_ENV+= ${MAKECONF:DMAKECONF=${MAKECONF:Q}}
750 RECURSIVE_MAKE= ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV} ${MAKE}
752 _VARGROUPS+= dirs
753 _USER_VARS.dirs= DISTDIR LOCALBASE PACKAGES PKG_SYSCONFDIR WRKOBJDIR
754 _PKG_VARS.dirs= WRKSRC PATCHDIR FILESDIR PKGDIR
755 _SYS_VARS.dirs= WRKDIR DESTDIR PKG_SYSCONFBASEDIR
757 # List of 64bit operating systems with sizeof(int) != sizeof(void *).
758 # This can be used for software that is not 64bit clean.
760 # Keywords: ONLY_FOR_PLATFORM NOT_FOR_PLATFORM 64bit
762 LP64PLATFORMS= *-*-alpha *-*-sparc64 *-*-x86_64
764 .endif # BSD_PKG_MK