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