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