xref: /openbsd/share/mk/bsd.own.mk (revision 73471bf0)
1#	$OpenBSD: bsd.own.mk,v 1.212 2021/11/23 10:30:08 robert Exp $
2#	$NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $
3
4# Host-specific overrides
5.if defined(MAKECONF) && exists(${MAKECONF})
6.include "${MAKECONF}"
7.elif exists(/etc/mk.conf)
8.include "/etc/mk.conf"
9.endif
10
11# Set `WARNINGS' to `yes' to add appropriate warnings to each compilation
12WARNINGS?=	no
13# Set `SKEY' to `yes' to build with support for S/key authentication.
14SKEY?=		yes
15# Set `YP' to `yes' to build with support for NIS/YP.
16YP?=		yes
17
18CLANG_ARCH=aarch64 amd64 arm i386 mips64 mips64el powerpc powerpc64 riscv64 sparc64
19GCC4_ARCH=alpha hppa sh sparc64
20GCC3_ARCH=m88k
21LLD_ARCH=aarch64 amd64 arm i386 powerpc powerpc64 riscv64
22
23# m88k: ?
24PIE_ARCH=aarch64 alpha amd64 arm hppa i386 mips64 mips64el powerpc powerpc64 riscv64 sh sparc64
25STATICPIE_ARCH=aarch64 alpha amd64 arm hppa i386 mips64 mips64el powerpc powerpc64 riscv64 sh sparc64
26
27.for _arch in ${MACHINE_ARCH}
28.if !empty(GCC3_ARCH:M${_arch})
29COMPILER_VERSION?=gcc3
30.elif !empty(GCC4_ARCH:M${_arch})
31COMPILER_VERSION?=gcc4
32.elif !empty(CLANG_ARCH:M${_arch})
33COMPILER_VERSION?=clang
34.endif
35
36.if !empty(GCC3_ARCH:M${_arch})
37BUILD_GCC3?=yes
38.else
39BUILD_GCC3?=no
40.endif
41.if !empty(GCC4_ARCH:M${_arch})
42BUILD_GCC4?=yes
43.else
44BUILD_GCC4?=no
45.endif
46.if !empty(CLANG_ARCH:M${_arch})
47BUILD_CLANG?=yes
48.else
49BUILD_CLANG?=no
50.endif
51
52.if !empty(LLD_ARCH:M${_arch})
53LINKER_VERSION?=lld
54AR_VERSION?=llvm
55.else
56LINKER_VERSION?=bfd
57AR_VERSION?=binutils
58.endif
59
60.if !empty(STATICPIE_ARCH:M${_arch})
61STATICPIE?=-pie
62.endif
63
64# Executables are always PIC on mips64.
65# Do not pass -fno-pie to the compiler because clang does not accept it.
66.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
67NOPIE_FLAGS?=
68.endif
69
70.if !empty(PIE_ARCH:M${_arch})
71NOPIE_FLAGS?=-fno-pie
72NOPIE_LDFLAGS?=-nopie
73PIE_DEFAULT?=${DEFAULT_PIE_DEF}
74.else
75NOPIE_FLAGS?=
76PIE_DEFAULT?=
77.endif
78.endfor
79
80# where the system object and source trees are kept; can be configurable
81# by the user in case they want them in ~/foosrc and ~/fooobj, for example
82BSDSRCDIR?=	/usr/src
83BSDOBJDIR?=	/usr/obj
84
85BINGRP?=	bin
86BINOWN?=	root
87BINMODE?=	555
88NONBINMODE?=	444
89DIRMODE?=	755
90
91SHAREDIR?=	/usr/share
92SHAREGRP?=	bin
93SHAREOWN?=	root
94SHAREMODE?=	${NONBINMODE}
95
96MANDIR?=	/usr/share/man/man
97MANGRP?=	bin
98MANOWN?=	root
99MANMODE?=	${NONBINMODE}
100
101LIBDIR?=	/usr/lib
102LIBGRP?=	${BINGRP}
103LIBOWN?=	${BINOWN}
104LIBMODE?=	${NONBINMODE}
105
106DOCDIR?=	/usr/share/doc
107DOCGRP?=	bin
108DOCOWN?=	root
109DOCMODE?=	${NONBINMODE}
110
111LOCALEDIR?=	/usr/share/locale
112LOCALEGRP?=	wheel
113LOCALEOWN?=	root
114LOCALEMODE?=	${NONBINMODE}
115
116.if !defined(CDIAGFLAGS)
117CDIAGFLAGS=	-Wall -Wpointer-arith -Wuninitialized -Wstrict-prototypes
118CDIAGFLAGS+=	-Wmissing-prototypes -Wunused -Wsign-compare
119CDIAGFLAGS+=	-Wshadow
120.  if ${COMPILER_VERSION} == "gcc4"
121CDIAGFLAGS+=	-Wdeclaration-after-statement
122.  endif
123.endif
124
125# Shared files for system gnu configure, not used yet
126GNUSYSTEM_AUX_DIR?=${BSDSRCDIR}/share/gnu
127
128INSTALL_COPY?=	-c
129.ifndef DEBUG
130INSTALL_STRIP?=	-s
131.endif
132
133STATIC?=	-static ${STATICPIE}
134
135# Define SYS_INCLUDE to indicate whether you want symbolic links to the system
136# source (``symlinks''), or a separate copy (``copies''); (latter useful
137# in environments where it's not possible to keep /sys publicly readable)
138#SYS_INCLUDE= 	symlinks
139
140# pic relocation flags.
141.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \
142    ${MACHINE_ARCH} == "sparc64"
143PICFLAG?=-fPIC
144.else
145PICFLAG?=-fpic
146.endif
147
148.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "powerpc" || \
149    ${MACHINE_ARCH} == "sparc64"
150# big PIE
151DEFAULT_PIE_DEF=-DPIE_DEFAULT=2
152.else
153# small pie
154DEFAULT_PIE_DEF=-DPIE_DEFAULT=1
155.endif
156
157# don't try to generate PROFILED versions of libraries on machines
158# which don't support profiling.
159.if 0
160NOPROFILE=
161.endif
162
163BUILDUSER?= build
164WOBJGROUP?= wobj
165WOBJUMASK?= 007
166
167BSD_OWN_MK=Done
168
169.PHONY: spell clean cleandir obj manpages print all \
170	depend beforedepend afterdepend cleandepend subdirdepend \
171	all cleanman includes \
172	beforeinstall realinstall maninstall afterinstall install
173