Merge from vendor branch TNF:
[pkgsrc.git] / mk / bsd.prefs.mk
1 # $NetBSD: bsd.prefs.mk,v 1.16 2000/06/03 07:16:51 hubertf 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 .if exists(/usr/bin/uname)
17 UNAME=/usr/bin/uname
18 .elif exists(/bin/uname)
19 UNAME=/bin/uname
20 .else
21 UNAME=echo Unknown
22 .endif
23
24 .ifndef OPSYS
25 OPSYS!=                 ${UNAME} -s
26 .endif
27 MAKEFLAGS+=             OPSYS=${OPSYS}
28 .ifndef OS_VERSION
29 OS_VERSION!=            ${UNAME} -r
30 .endif
31 MAKEFLAGS+=             OS_VERSION=${OS_VERSION}
32
33 # Preload these for architectures not in all variations of bsd.own.mk.
34 GNU_ARCH.alpha?=        alpha
35 GNU_ARCH.arm32?=        arm
36 GNU_ARCH.i386?=         i386
37 GNU_ARCH.i486?=         i386
38 GNU_ARCH.i586?=         i386
39 GNU_ARCH.i686?=         i386
40 GNU_ARCH.m68k?=         m68k
41 GNU_ARCH.mips?=         mipsel
42 GNU_ARCH.ns32k?=        ns32k
43 GNU_ARCH.sparc?=        sparc
44 GNU_ARCH.vax?=          vax
45 MACHINE_GNU_ARCH?=      ${GNU_ARCH.${MACHINE_ARCH}}
46
47 .if ${OPSYS} == "NetBSD"
48 LOWER_OPSYS?=           netbsd
49 .elif ${OPSYS} == "SunOS"
50 . if ${MACHINE_ARCH} == "unknown"
51 .  if !defined(LOWER_ARCH)
52 LOWER_ARCH!=            ${UNAME} -p
53 .  endif        # !defined(LOWER_ARCH)
54 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
55 . endif
56 LOWER_VENDOR?=          sun
57 LOWER_OPSYS?=           solaris
58 .elif ${OPSYS} == "Linux"
59 LOWER_OPSYS?=           linux
60 . if ${MACHINE_ARCH} == "unknown"
61 .  if !defined(LOWER_ARCH)
62 LOWER_ARCH!=            ${UNAME} -m | sed -e 's/[456]86/386/'
63 .  endif # !defined(LOWER_ARCH)
64 MAKEFLAGS+=             LOWER_ARCH=${LOWER_ARCH}
65 .  if ${LOWER_ARCH} == "i386"
66 LOWER_VENDOR?=          pc
67 .  else
68 LOWER_VENDOR?=          unknown
69 .  endif
70 . endif
71
72 .elif !defined(LOWER_OPSYS)
73 LOWER_OPSYS!=           echo ${OPSYS} | tr A-Z a-z
74 .endif
75 MAKEFLAGS+=             LOWER_OPSYS=${LOWER_OPSYS}
76
77 LOWER_VENDOR?=
78 LOWER_ARCH?=            ${MACHINE_GNU_ARCH}
79
80 MACHINE_PLATFORM?=      ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
81 MACHINE_GNU_PLATFORM?=  ${LOWER_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS}
82
83 # Needed on NetBSD and SunOS (zoularis) to prevent an "install:" target
84 # from being created in bsd.own.mk.
85 NEED_OWN_INSTALL_TARGET=no
86
87 .include <bsd.own.mk>
88
89 .if (${OPSYS} == "NetBSD") || (${OPSYS} == "SunOS") || (${OPSYS} == "Linux")
90 SHAREOWN?=              ${DOCOWN}
91 SHAREGRP?=              ${DOCGRP}
92 SHAREMODE?=             ${DOCMODE}
93 .endif
94
95 .if defined(PREFIX) && (${PREFIX} != ${__PREFIX_SET__})
96 .BEGIN:
97         @${ECHO_MSG} "You can NOT set PREFIX manually or in mk.conf.  Set LOCALBASE or X11BASE"
98         @${ECHO_MSG} "depending on your needs.  See the pkg system documentation for more info."
99         @${FALSE}
100 .endif
101
102 # if the system is IPv6-ready NetBSD, compile with IPv6 support turned on.
103 .if (${OPSYS} == "NetBSD") && !defined(USE_SOCKS) && \
104     exists(/usr/include/netinet6)
105 USE_INET6?=             YES
106 .endif
107
108 # Preload all default values for CFLAGS, LDFLAGS, etc. before bsd.pkg.mk
109 # or a pkg Makefile modifies them.
110 .include <sys.mk>
111
112 .endif