1#	$NetBSD: bsd.own.mk,v 1.696.2.3 2012/09/17 19:00:33 riz Exp $
2
3# This needs to be before bsd.init.mk
4.if defined(BSD_MK_COMPAT_FILE)
5.include <${BSD_MK_COMPAT_FILE}>
6.endif
7
8.if !defined(_BSD_OWN_MK_)
9_BSD_OWN_MK_=1
10
11MAKECONF?=	/etc/mk.conf
12.-include "${MAKECONF}"
13
14#
15# CPU model, derived from MACHINE_ARCH
16#
17MACHINE_CPU=	${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/m68000/m68k/:S/armeb/arm/:S/powerpc64/powerpc/}
18
19#
20# Subdirectory used below ${RELEASEDIR} when building a release
21#
22RELEASEMACHINEDIR?=	${MACHINE}
23
24#
25# Subdirectory or path component used for the following paths:
26#   distrib/${RELEASEMACHINE}
27#   distrib/notes/${RELEASEMACHINE}
28#   etc/etc.${RELEASEMACHINE}
29# Used when building a release.
30#
31RELEASEMACHINE?=	${MACHINE}
32
33#
34# NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
35# ensure that things defined by <bsd.own.mk> (default targets,
36# INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
37#
38NEED_OWN_INSTALL_TARGET?=	yes
39
40#
41# This lists the platforms which do not have working in-tree toolchains.  For
42# the in-tree gcc toolchain, this list is empty.
43#
44# If some future port is not supported by the in-tree toolchain, this should
45# be set to "yes" for that port only.
46#
47TOOLCHAIN_MISSING?=	no
48
49#
50# Platforms still using GCC 4.1
51#
52.if ${MACHINE_CPU}  == "vax"
53HAVE_GCC?=    4
54.else
55# Otherwise, default to GCC4.5
56HAVE_GCC?=    45
57.endif
58
59.if \
60    ${MACHINE_ARCH} == "i386" || \
61    ${MACHINE_ARCH} == "powerpc" || \
62    ${MACHINE_ARCH} == "x86_64"
63USE_COMPILERCRTSTUFF?=	no
64.endif
65USE_COMPILERCRTSTUFF?=	yes
66
67HAVE_GDB?=	7
68
69.if empty(.MAKEFLAGS:M-V*)
70.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)
71PRINTOBJDIR=	${MAKE} -r -V .OBJDIR -f /dev/null xxx
72.else
73PRINTOBJDIR=	${MAKE} -V .OBJDIR
74.endif
75.else
76PRINTOBJDIR=	echo # prevent infinite recursion
77.endif
78
79#
80# Determine if running in the NetBSD source tree by checking for the
81# existence of build.sh and tools/ in the current or a parent directory,
82# and setting _SRC_TOP_ to the result.
83#
84.if !defined(_SRC_TOP_)			# {
85_SRC_TOP_!= cd "${.CURDIR}"; while :; do \
86		here=`pwd`; \
87		[ -f build.sh  ] && [ -d tools ] && { echo $$here; break; }; \
88		case $$here in /) echo ""; break;; esac; \
89		cd ..; done
90
91.MAKEOVERRIDES+=	_SRC_TOP_
92
93.endif					# }
94
95#
96# If _SRC_TOP_ != "", we're within the NetBSD source tree, so set
97# defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
98#
99.if (${_SRC_TOP_} != "")		# {
100
101NETBSDSRCDIR?=	${_SRC_TOP_}
102
103.if !defined(_SRC_TOP_OBJ_)
104_SRC_TOP_OBJ_!=		cd "${_SRC_TOP_}" && ${PRINTOBJDIR}
105.MAKEOVERRIDES+=	_SRC_TOP_OBJ_
106.endif
107
108.endif	# _SRC_TOP_ != ""		# }
109
110
111.if (${_SRC_TOP_} != "") && \
112    (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN))
113USETOOLS?=	yes
114.endif
115USETOOLS?=	no
116
117
118.if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \
119    ${MACHINE_ARCH} == "sh3"
120.BEGIN:
121	@echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
122	@false
123.elif defined(REQUIRETOOLS) && \
124      (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \
125      ${USETOOLS} == "no"
126.BEGIN:
127	@echo "USETOOLS=no, but this component requires a version-specific host toolchain"
128	@false
129.endif
130
131#
132# Host platform information; may be overridden
133#
134.if !defined(HOST_OSTYPE)
135_HOST_OSNAME!=	uname -s
136_HOST_OSREL!=	uname -r
137# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
138# something that does not look like an identifier, then use uname -m.
139_HOST_ARCH!=	uname -p 2>/dev/null
140_HOST_ARCH:=	${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}
141.if empty(_HOST_ARCH)
142_HOST_ARCH!=	uname -m
143.endif
144HOST_OSTYPE:=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
145.MAKEOVERRIDES+= HOST_OSTYPE
146.endif # !defined(HOST_OSTYPE)
147
148.if ${USETOOLS} == "yes"						# {
149
150#
151# Provide a default for TOOLDIR.
152#
153.if !defined(TOOLDIR)
154TOOLDIR:=	${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE}
155.MAKEOVERRIDES+= TOOLDIR
156.endif
157
158#
159# This is the prefix used for the NetBSD-sourced tools.
160#
161_TOOL_PREFIX?=	nb
162
163#
164# If an external toolchain base is specified, use it.
165#
166.if defined(EXTERNAL_TOOLCHAIN)						# {
167AR=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar
168AS=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as
169LD=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld
170NM=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm
171OBJCOPY=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy
172OBJDUMP=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump
173RANLIB=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib
174SIZE=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size
175STRIP=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip
176
177TOOL_CC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
178TOOL_CPP.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp
179TOOL_CXX.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++
180TOOL_FC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77
181TOOL_OBJC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
182.else									# } {
183# Define default locations for common tools.
184.if ${USETOOLS_BINUTILS:Uyes} == "yes"					#  {
185AR=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar
186AS=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as
187LD=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld
188NM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm
189OBJCOPY=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy
190OBJDUMP=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump
191RANLIB=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib
192SIZE=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size
193STRIP=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip
194
195# GCC supports C, C++, Fortran and Objective C
196TOOL_CC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
197TOOL_CPP.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp
198TOOL_CXX.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++
199TOOL_FC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77
200TOOL_OBJC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
201.endif									#  }
202
203# Clang supports C, C++ and Objective C
204TOOL_CC.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
205TOOL_CPP.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
206TOOL_CXX.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++
207TOOL_OBJC.clang=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
208
209# PCC supports C and Fortran
210TOOL_CC.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc
211TOOL_CPP.pcc=		${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp
212
213#
214# Make sure DESTDIR is set, so that builds with these tools always
215# get appropriate -nostdinc, -nostdlib, etc. handling.  The default is
216# <empty string>, meaning start from /, the root directory.
217#
218DESTDIR?=
219
220.if !defined(HOSTPROG) && !defined(HOSTLIB)
221.  if ${DESTDIR} != ""
222CPPFLAGS+=	--sysroot=${DESTDIR}
223LDFLAGS+=	--sysroot=${DESTDIR}
224.  else
225CPPFLAGS+=	--sysroot=/
226LDFLAGS+=	--sysroot=/
227.  endif
228.endif
229.endif	# EXTERNAL_TOOLCHAIN						# }
230
231HOST_MKDEP=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
232
233DBSYM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
234ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
235ELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
236INSTALL=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install
237LEX=		${TOOLDIR}/bin/${_TOOL_PREFIX}lex
238LINT=		CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint
239LORDER=		NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder
240MKDEP=		CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
241PAXCTL=		${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl
242TSORT=		${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q
243YACC=		${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
244
245TOOL_AMIGAAOUT2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb
246TOOL_AMIGAELF2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb
247TOOL_AMIGATXLT=		${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt
248TOOL_ASN1_COMPILE=	${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile
249TOOL_AWK=		${TOOLDIR}/bin/${_TOOL_PREFIX}awk
250TOOL_CAP_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb
251TOOL_CAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}cat
252TOOL_CKSUM=		${TOOLDIR}/bin/${_TOOL_PREFIX}cksum
253TOOL_CLANG_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen
254TOOL_COMPILE_ET=	${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et
255TOOL_CONFIG=		${TOOLDIR}/bin/${_TOOL_PREFIX}config
256TOOL_CRUNCHGEN=		MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen
257TOOL_CTAGS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctags
258TOOL_CTFCONVERT=	${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert
259TOOL_CTFMERGE=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge
260TOOL_DB=		${TOOLDIR}/bin/${_TOOL_PREFIX}db
261TOOL_DISKLABEL=		${TOOLDIR}/bin/nbdisklabel-${MAKEWRAPPERMACHINE}
262TOOL_EQN=		${TOOLDIR}/bin/${_TOOL_PREFIX}eqn
263TOOL_FDISK=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk
264TOOL_FGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}fgen
265TOOL_GENASSYM=		${TOOLDIR}/bin/${_TOOL_PREFIX}genassym
266TOOL_GENCAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}gencat
267TOOL_GMAKE=		${TOOLDIR}/bin/${_TOOL_PREFIX}gmake
268TOOL_GREP=		${TOOLDIR}/bin/${_TOOL_PREFIX}grep
269TOOL_GROFF=		PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff
270TOOL_HEXDUMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump
271TOOL_HP300MKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot
272TOOL_HP700MKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hp700-mkboot
273TOOL_INDXBIB=		${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib
274TOOL_INSTALLBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}installboot
275TOOL_INSTALL_INFO=	${TOOLDIR}/bin/${_TOOL_PREFIX}install-info
276TOOL_JOIN=		${TOOLDIR}/bin/${_TOOL_PREFIX}join
277TOOL_LLVM_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen
278TOOL_M4=		${TOOLDIR}/bin/${_TOOL_PREFIX}m4
279TOOL_MACPPCFIXCOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff
280TOOL_MAKEFS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makefs
281TOOL_MAKEINFO=		${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo
282TOOL_MAKEWHATIS=	${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis
283TOOL_MANDOC_ASCII=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii
284TOOL_MANDOC_HTML=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml
285TOOL_MANDOC_LINT=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint
286TOOL_MDSETIMAGE=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage
287TOOL_MENUC=		MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc
288TOOL_M68KELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
289TOOL_MIPSELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
290TOOL_MKCSMAPPER=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper
291TOOL_MKESDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb
292TOOL_MKLOCALE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale
293TOOL_MKMAGIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}file
294TOOL_MKTEMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp
295TOOL_MKUBOOTIMAGE=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage
296TOOL_MSGC=		MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
297TOOL_MTREE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
298TOOL_NBPERF=		${TOOLDIR}/bin/${_TOOL_PREFIX}perf
299TOOL_PAX=		${TOOLDIR}/bin/${_TOOL_PREFIX}pax
300TOOL_PIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}pic
301TOOL_PIGZ=		${TOOLDIR}/bin/${_TOOL_PREFIX}pigz
302TOOL_PKG_CREATE=	${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create
303TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage
304TOOL_PWD_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb
305TOOL_REFER=		${TOOLDIR}/bin/${_TOOL_PREFIX}refer
306TOOL_ROFF_ASCII=	PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff
307TOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
308TOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
309TOOL_ROFF_PS=		${TOOL_GROFF} -Tps
310TOOL_ROFF_RAW=		${TOOL_GROFF} -Z
311TOOL_RPCGEN=		RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen
312TOOL_SED=		${TOOLDIR}/bin/${_TOOL_PREFIX}sed
313TOOL_SLC=		${TOOLDIR}/bin/${_TOOL_PREFIX}slc
314TOOL_SOELIM=		${TOOLDIR}/bin/${_TOOL_PREFIX}soelim
315TOOL_SPARKCRC=		${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc
316TOOL_STAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}stat
317TOOL_STRFILE=		${TOOLDIR}/bin/${_TOOL_PREFIX}strfile
318TOOL_SUNLABEL=		${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel
319TOOL_TBL=		${TOOLDIR}/bin/${_TOOL_PREFIX}tbl
320TOOL_TIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}tic
321TOOL_UUDECODE=		${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode
322TOOL_VGRIND=		${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f
323TOOL_ZIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}zic
324
325.else	# USETOOLS != yes						# } {
326
327# Clang supports C, C++ and Objective C
328TOOL_CC.clang=		clang
329TOOL_CPP.clang=		clang-cpp
330TOOL_CXX.clang=		clang++
331TOOL_OBJC.clang=	clang
332
333# GCC supports C, C++, Fortran and Objective C
334TOOL_CC.gcc=	gcc
335TOOL_CPP.gcc=	cpp
336TOOL_CXX.gcc=	c++
337TOOL_FC.gcc=	g77
338TOOL_OBJC.gcc=	gcc
339
340# PCC supports C and Fortran
341TOOL_CC.pcc=		pcc
342TOOL_CPP.pcc=		/usr/libexec/pcpp
343
344TOOL_AMIGAAOUT2BB=	amiga-aout2bb
345TOOL_AMIGAELF2BB=	amiga-elf2bb
346TOOL_AMIGATXLT=		amiga-txlt
347TOOL_ASN1_COMPILE=	asn1_compile
348TOOL_AWK=		awk
349TOOL_CAP_MKDB=		cap_mkdb
350TOOL_CAT=		cat
351TOOL_CKSUM=		cksum
352TOOL_CLANG_TBLGEN=	clang-tblgen
353TOOL_COMPILE_ET=	compile_et
354TOOL_CONFIG=		config
355TOOL_CRUNCHGEN=		crunchgen
356TOOL_CTAGS=		ctags
357TOOL_CTFCONVERT=	ctfconvert
358TOOL_CTFMERGE=		ctfmerge
359TOOL_DB=		db
360TOOL_DISKLABEL=		disklabel
361TOOL_EQN=		eqn
362TOOL_FDISK=		fdisk
363TOOL_FGEN=		fgen
364TOOL_GENASSYM=		genassym
365TOOL_GENCAT=		gencat
366TOOL_GMAKE=		gmake
367TOOL_GREP=		grep
368TOOL_GROFF=		groff
369TOOL_HEXDUMP=		hexdump
370TOOL_HP300MKBOOT=	hp300-mkboot
371TOOL_HP700MKBOOT=	hp700-mkboot
372TOOL_INDXBIB=		indxbib
373TOOL_INSTALLBOOT=	installboot
374TOOL_INSTALL_INFO=	install-info
375TOOL_JOIN=		join
376TOOL_LLVM_TBLGEN=	llvm-tblgen
377TOOL_M4=		m4
378TOOL_MACPPCFIXCOFF=	macppc-fixcoff
379TOOL_MAKEFS=		makefs
380TOOL_MAKEINFO=		makeinfo
381TOOL_MAKEWHATIS=	/usr/libexec/makewhatis
382TOOL_MANDOC_ASCII=	mandoc -Tascii
383TOOL_MANDOC_HTML=	mandoc -Thtml -Oman=../html%S/%N.html -Ostyle=../style.css
384TOOL_MANDOC_LINT=	mandoc -Tlint
385TOOL_MDSETIMAGE=	mdsetimage
386TOOL_MENUC=		menuc
387TOOL_M68KELF2AOUT=	m68k-elf2aout
388TOOL_MIPSELF2ECOFF=	mips-elf2ecoff
389TOOL_MKCSMAPPER=	mkcsmapper
390TOOL_MKESDB=		mkesdb
391TOOL_MKLOCALE=		mklocale
392TOOL_MKMAGIC=		file
393TOOL_MKTEMP=		mktemp
394TOOL_MKUBOOTIMAGE=	mkubootimage
395TOOL_MSGC=		msgc
396TOOL_MTREE=		mtree
397TOOL_NBPERF=		nbperf
398TOOL_PAX=		pax
399TOOL_PIC=		pic
400TOOL_PIGZ=		pigz
401TOOL_PKG_CREATE=	pkg_create
402TOOL_POWERPCMKBOOTIMAGE=	powerpc-mkbootimage
403TOOL_PWD_MKDB=		pwd_mkdb
404TOOL_REFER=		refer
405TOOL_ROFF_ASCII=	nroff
406TOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
407TOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
408TOOL_ROFF_PS=		${TOOL_GROFF} -Tps
409TOOL_ROFF_RAW=		${TOOL_GROFF} -Z
410TOOL_RPCGEN=		rpcgen
411TOOL_SED=		sed
412TOOL_SOELIM=		soelim
413TOOL_SPARKCRC=		sparkcrc
414TOOL_STAT=		stat
415TOOL_STRFILE=		strfile
416TOOL_SUNLABEL=		sunlabel
417TOOL_TBL=		tbl
418TOOL_TIC=		tic
419TOOL_UUDECODE=		uudecode
420TOOL_VGRIND=		vgrind -f
421TOOL_ZIC=		zic
422
423.endif	# USETOOLS != yes						# }
424
425# Fallback to ensure that all variables are defined to something
426TOOL_CC.false=		false
427TOOL_CPP.false=		false
428TOOL_CXX.false=		false
429TOOL_FC.false=		false
430TOOL_OBJC.false=	false
431
432AVAILABLE_COMPILER?=	${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} false
433
434.for _t in CC CPP CXX FC OBJC
435ACTIVE_${_t}=	${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]}
436SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@}
437.endfor
438# make bugs prevent moving this into the .for loop
439CC=		${TOOL_CC.${ACTIVE_CC}}
440CPP=		${TOOL_CPP.${ACTIVE_CPP}}
441CXX=		${TOOL_CXX.${ACTIVE_CXX}}
442FC=		${TOOL_FC.${ACTIVE_FC}}
443OBJC=		${TOOL_OBJC.${ACTIVE_OBJC}}
444
445# OBJCOPY flags to create a.out binaries for old firmware
446# shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
447.if ${MACHINE_CPU} == "arm"
448OBJCOPY_ELF2AOUT_FLAGS?=	\
449	-O a.out-arm-netbsd	\
450	-R .ident		\
451	-R .ARM.attributes	\
452	-R .arm.atpcs		\
453	-R .comment		\
454	-R .debug_abbrev	\
455	-R .debug_info		\
456	-R .debug_line		\
457	-R .debug_frame		\
458	-R .debug_loc		\
459	-R .debug_pubnames	\
460	-R .debug_aranges	\
461	-R .debug_str		\
462	-R .debug_pubtypes	\
463	-R .note.netbsd.ident
464.endif
465
466#
467# Targets to check if DESTDIR or RELEASEDIR is provided
468#
469.if !target(check_DESTDIR)
470check_DESTDIR: .PHONY .NOTMAIN
471.if !defined(DESTDIR)
472	@echo "setenv DESTDIR before doing that!"
473	@false
474.else
475	@true
476.endif
477.endif
478
479.if !target(check_RELEASEDIR)
480check_RELEASEDIR: .PHONY .NOTMAIN
481.if !defined(RELEASEDIR)
482	@echo "setenv RELEASEDIR before doing that!"
483	@false
484.else
485	@true
486.endif
487.endif
488
489#
490# Build a dynamically linked /bin and /sbin, with the necessary shared
491# libraries moved from /usr/lib to /lib and the shared linker moved
492# from /usr/libexec to /lib
493#
494# Note that if the BINDIR is not /bin or /sbin, then we always use the
495# non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
496# and /sbin).  See <bsd.shlib.mk>.
497#
498MKDYNAMICROOT?=	yes
499
500#
501# Where the system object and source trees are kept; can be configurable
502# by the user in case they want them in ~/foosrc and ~/fooobj (for example).
503#
504BSDSRCDIR?=	/usr/src
505BSDOBJDIR?=	/usr/obj
506NETBSDSRCDIR?=	${BSDSRCDIR}
507
508BINGRP?=	wheel
509BINOWN?=	root
510BINMODE?=	555
511NONBINMODE?=	444
512
513# These are here mainly because we don't want suid root in case
514# a Makefile defines BINMODE.
515RUMPBINGRP?=	wheel
516RUMPBINOWN?=	root
517RUMPBINMODE?=	555
518RUMPNONBINMODE?=444
519
520MANDIR?=	/usr/share/man
521MANGRP?=	wheel
522MANOWN?=	root
523MANMODE?=	${NONBINMODE}
524MANINSTALL?=	${_MANINSTALL}
525
526INFODIR?=	/usr/share/info
527INFOGRP?=	wheel
528INFOOWN?=	root
529INFOMODE?=	${NONBINMODE}
530
531LIBDIR?=	/usr/lib
532
533LINTLIBDIR?=	/usr/libdata/lint
534LIBGRP?=	${BINGRP}
535LIBOWN?=	${BINOWN}
536LIBMODE?=	${NONBINMODE}
537
538DOCDIR?=	/usr/share/doc
539HTMLDOCDIR?=	/usr/share/doc/html
540DOCGRP?=	wheel
541DOCOWN?=	root
542DOCMODE?=	${NONBINMODE}
543
544NLSDIR?=	/usr/share/nls
545NLSGRP?=	wheel
546NLSOWN?=	root
547NLSMODE?=	${NONBINMODE}
548
549KMODULEGRP?=	wheel
550KMODULEOWN?=	root
551KMODULEMODE?=	${NONBINMODE}
552
553LOCALEDIR?=	/usr/share/locale
554LOCALEGRP?=	wheel
555LOCALEOWN?=	root
556LOCALEMODE?=	${NONBINMODE}
557
558FIRMWAREDIR?=	/libdata/firmware
559FIRMWAREGRP?=	wheel
560FIRMWAREOWN?=	root
561FIRMWAREMODE?=	${NONBINMODE}
562
563DEBUGDIR?=	/usr/libdata/debug
564DEBUGGRP?=	wheel
565DEBUGOWN?=	root
566DEBUGMODE?=	${NONBINMODE}
567
568#
569# Data-driven table using make variables to control how
570# toolchain-dependent targets and shared libraries are built
571# for different platforms and object formats.
572#
573# OBJECT_FMT:		currently either "ELF" or "a.out".
574#
575# All platforms are ELF.
576#
577OBJECT_FMT=	ELF
578
579#
580# If this platform's toolchain is missing, we obviously cannot build it.
581#
582.if ${TOOLCHAIN_MISSING} != "no"
583MKBINUTILS:= no
584MKGDB:= no
585MKGCC:= no
586.endif
587
588#
589# If we are using an external toolchain, we can still build the target's
590# binutils, but we cannot build GCC's support libraries, since those are
591# tightly-coupled to the version of GCC being used.
592#
593.if defined(EXTERNAL_TOOLCHAIN)
594MKGCC:= no
595.endif
596
597#
598# The m68000 port is incomplete.
599#
600.if ${MACHINE_ARCH} == "m68000"
601NOPIC=		# defined
602MKISCSI=	no
603# XXX GCC 4 outputs mcount() calling sequences that try to load values
604# from over 64KB away and this fails to assemble.
605.if defined(HAVE_GCC)
606NOPROFILE=	# defined
607.endif
608.endif
609
610#
611# The ia64 port is incomplete.
612#
613.if ${MACHINE_ARCH} == "ia64"
614MKLINT=		no
615MKGDB=		no
616.endif
617
618#
619# On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
620# not just shared libraries, so don't build the _pic version.
621#
622.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
623    ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb"
624MKPICLIB:=	no
625.endif
626
627#
628# On VAX using ELF, all objects are PIC, not just shared libraries,
629# so don't build the _pic version.
630#
631.if ${MACHINE_ARCH} == "vax"
632MKPICLIB=	no
633.endif
634
635#
636# Location of the file that contains the major and minor numbers of the
637# version of a shared library.  If this file exists a shared library
638# will be built by <bsd.lib.mk>.
639#
640SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
641
642#
643# GNU sources and packages sometimes see architecture names differently.
644#
645GNU_ARCH.coldfire=m68k
646GNU_ARCH.i386=i486
647GCC_CONFIG_ARCH.i386=i486
648GCC_CONFIG_TUNE.i386=nocona
649GCC_CONFIG_TUNE.x86_64=nocona
650GNU_ARCH.m68000=m68010
651GNU_ARCH.sh3eb=sh
652GNU_ARCH.sh3el=shle
653GNU_ARCH.mips64eb=mips64
654MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
655
656#
657# In order to identify NetBSD to GNU packages, we sometimes need
658# an "elf" tag for historically a.out platforms.
659#
660.if (${MACHINE_GNU_ARCH} == "arm" || \
661     ${MACHINE_GNU_ARCH} == "armeb" || \
662     ${MACHINE_ARCH} == "i386" || \
663     ${MACHINE_CPU} == "m68k" || \
664     ${MACHINE_GNU_ARCH} == "sh" || \
665     ${MACHINE_GNU_ARCH} == "shle" || \
666     ${MACHINE_ARCH} == "sparc" || \
667     ${MACHINE_ARCH} == "vax")
668MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf
669.else
670MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
671.endif
672
673#
674# Determine if arch uses native kernel modules with rump
675#
676.if ${MACHINE_ARCH} == "i386" || \
677    ${MACHINE_ARCH} == "x86_64"
678RUMPKMOD=	# defined
679.endif
680
681TARGETS+=	all clean cleandir depend dependall includes \
682		install lint obj regress tags html analyze
683PHONY_NOTMAIN =	all clean cleandir depend dependall distclean includes \
684		install lint obj regress beforedepend afterdepend \
685		beforeinstall afterinstall realinstall realdepend realall \
686		html subdir-all subdir-install subdir-depend analyze
687.PHONY:		${PHONY_NOTMAIN}
688.NOTMAIN:	${PHONY_NOTMAIN}
689
690.if ${NEED_OWN_INSTALL_TARGET} != "no"
691.if !target(install)
692install:	beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
693beforeinstall:
694subdir-install:
695realinstall:
696afterinstall:
697.endif
698all:		realall subdir-all
699subdir-all:
700realall:
701depend:		realdepend subdir-depend
702subdir-depend:
703realdepend:
704distclean:	cleandir
705cleandir:	clean
706
707dependall:	.NOTMAIN realdepend .MAKE
708	@cd "${.CURDIR}"; ${MAKE} realall
709.endif
710
711#
712# Define MKxxx variables (which are either yes or no) for users
713# to set in /etc/mk.conf and override in the make environment.
714# These should be tested with `== "no"' or `!= "no"'.
715# The NOxxx variables should only be set by Makefiles.
716#
717# Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
718# with changes to the MK* variables here.
719#
720
721#
722# Supported NO* options (if defined, MK* will be forced to "no",
723# regardless of user's mk.conf setting).
724#
725# Source makefiles should set NO*, and not MK*, and must do so before
726# including bsd.own.mk.
727#
728.for var in \
729	NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
730	NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
731.if defined(${var})
732MK${var:S/^NO//}:=	no
733.endif
734.endfor
735
736#
737# Older-style variables that enabled behaviour when set.
738#
739.for var in MANZ UNPRIVED UPDATE
740.if defined(${var})
741MK${var}:=	yes
742.endif
743.endfor
744
745#
746# MK* options which have variable defaults.
747#
748.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" || \
749    ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
750MKCOMPAT?=	yes
751.else
752# Don't let this build where it really isn't supported.
753MKCOMPAT:=	no
754.endif
755
756#.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" || \
757
758.if ${MACHINE} == "evbppc"
759MKCOMPATMODULES?=	yes
760.else
761MKCOMPATMODULES:=	no
762.endif
763
764#
765# Default mips64 to softfloat now.
766# emips is always softfloat.
767#
768.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \
769    ${MACHINE} == "emips"
770MKSOFTFLOAT?=	yes
771.endif
772
773.if ${MACHINE} == "emips"
774SOFTFLOAT_BITS=	32
775.endif
776
777#
778# MK* backward compatibility.
779#
780.if defined(MKBFD)
781MKBINUTILS?=	${MKBFD}
782.endif
783
784#
785# We want to build zfs only for i386 and amd64 by default for now.
786#
787.if ${MACHINE} == "amd64" || ${MACHINE} == "i386"
788MKZFS?=		yes
789.endif
790
791#
792# MK* options which default to "yes".
793#
794_MKVARS.yes= \
795	MKATF \
796	MKBINUTILS \
797	MKCRYPTO MKCOMPLEX MKCVS MKCXX \
798	MKDOC \
799	MKGCC MKGCCCMDS MKGDB MKGROFF \
800	MKHESIOD MKHTML \
801	MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
802	MKKERBEROS \
803	MKKMOD \
804	MKLDAP MKLINKLIB MKLINT MKLVM \
805	MKMAN MKMANDOC \
806	MKMDNS \
807	MKMAKEMANDB \
808	MKNLS \
809	MKNPF \
810	MKOBJ \
811	MKPAM MKPERFUSE \
812	MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
813	MKSHARE MKSKEY MKSTATICLIB \
814	MKX11FONTS \
815	MKYP
816.for var in ${_MKVARS.yes}
817${var}?=	yes
818.endfor
819
820#
821# Exceptions to the above:
822#
823#.if ${MACHINE} == "evbppc"
824#MKKMOD=		no
825#.endif
826
827#
828# MK* options which default to "no".  Note that MKZFS has a different
829# default for some platforms, see above.
830#
831_MKVARS.no= \
832	MKBSDGREP MKBSDTAR \
833	MKCATPAGES MKCRYPTO_RC5 MKDEBUG \
834	MKDEBUGLIB MKDTRACE MKEXTSRC \
835	MKMANZ MKOBJDIRS \
836	MKLLVM MKPCC \
837	MKPIGZGZIP \
838	MKREPRO \
839	MKSOFTFLOAT MKSTRIPIDENT \
840	MKUNPRIVED MKUPDATE MKX11 MKZFS
841.for var in ${_MKVARS.no}
842${var}?=no
843.endfor
844
845#
846# Do we default to XFree86 or Xorg for this platform?
847#
848.if \
849    ${MACHINE} == "acorn32"	|| \
850    ${MACHINE} == "alpha"	|| \
851    ${MACHINE} == "amiga"	|| \
852    ${MACHINE} == "ews4800mips"	|| \
853    ${MACHINE} == "mac68k"	|| \
854    ${MACHINE} == "newsmips"	|| \
855    ${MACHINE} == "pmax"	|| \
856    ${MACHINE} == "sun3"	|| \
857    ${MACHINE} == "x68k"
858X11FLAVOUR?=	XFree86
859.else
860X11FLAVOUR?=	Xorg
861.endif
862
863#
864# Force some options off if their dependencies are off.
865#
866
867.if ${MKCXX} == "no"
868MKATF:=		no
869MKGROFF:=	no
870.endif
871
872.if ${MKCRYPTO} == "no"
873MKKERBEROS:=	no
874MKLDAP:=	no
875.endif
876
877.if ${MKMAN} == "no"
878MKCATPAGES:=	no
879MKHTML:=	no
880.endif
881
882_MANINSTALL=	maninstall
883.if ${MKCATPAGES} != "no"
884_MANINSTALL+=	catinstall
885.endif
886.if ${MKHTML} != "no"
887_MANINSTALL+=	htmlinstall
888.endif
889
890.if ${MKLINKLIB} == "no"
891MKLINT:=	no
892MKPICINSTALL:=	no
893MKPROFILE:=	no
894.endif
895
896.if ${MKPIC} == "no"
897MKPICLIB:=	no
898.endif
899
900.if ${MKOBJ} == "no"
901MKOBJDIRS:=	no
902.endif
903
904.if ${MKSHARE} == "no"
905MKCATPAGES:=	no
906MKDOC:=		no
907MKINFO:=	no
908MKHTML:=	no
909MKMAN:=		no
910MKNLS:=		no
911.endif
912
913#
914# install(1) parameters.
915#
916COPY?=		-c
917.if ${MKUPDATE} == "no"
918PRESERVE?=	
919.else
920PRESERVE?=	-p
921.endif
922RENAME?=	-r
923HRDLINK?=	-l h
924SYMLINK?=	-l s
925
926METALOG?=	${DESTDIR}/METALOG
927METALOG.add?=	${TOOL_CAT} -l >> ${METALOG}
928.if (${_SRC_TOP_} != "")	# only set INSTPRIV if inside ${NETBSDSRCDIR}
929.if ${MKUNPRIVED} != "no"
930INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256
931.else
932INSTPRIV.unpriv=
933.endif
934INSTPRIV?=	${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc
935.endif
936STRIPFLAG?=	
937
938.if ${NEED_OWN_INSTALL_TARGET} != "no"
939INSTALL_DIR?=		${INSTALL} ${INSTPRIV} -d
940INSTALL_FILE?=		${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
941INSTALL_LINK?=		${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
942INSTALL_SYMLINK?=	${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
943HOST_INSTALL_FILE?=	${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
944HOST_INSTALL_DIR?=	${INSTALL} -d
945HOST_INSTALL_SYMLINK?=	${INSTALL} ${SYMLINK} ${RENAME}
946.endif
947
948#
949# Set defaults for the USE_xxx variables.
950#
951
952#
953# USE_* options which default to "no" and will be forced to "no" if their
954# corresponding MK* variable is set to "no".
955#
956.for var in USE_SKEY
957.if (${${var:S/USE_/MK/}} == "no")
958${var}:= no
959.else
960${var}?= no
961.endif
962.endfor
963
964#
965# USE_* options which default to "yes" unless their corresponding MK*
966# variable is set to "no".
967#
968.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
969.if (${${var:S/USE_/MK/}} == "no")
970${var}:= no
971.else
972${var}?= yes
973.endif
974.endfor
975
976#
977# USE_* options which default to "yes".
978#
979.for var in USE_JEMALLOC
980${var}?= yes
981.endfor
982
983#
984# USE_* options which default to "no".
985#
986# For now, disable pigz as compressor by default
987.for var in USE_PIGZGZIP USE_LIBTRE
988${var}?= no
989.endfor
990
991.if ${USE_PIGZGZIP} != "no"
992TOOL_GZIP=		${TOOL_PIGZ}
993.else
994TOOL_GZIP=		gzip
995.endif
996
997#
998# Where X11 sources are and where it is installed to.
999#
1000.if !defined(X11SRCDIR)
1001.if exists(${NETBSDSRCDIR}/../xsrc)
1002X11SRCDIR!=		cd "${NETBSDSRCDIR}/../xsrc" && pwd
1003.else
1004X11SRCDIR=		/usr/xsrc
1005.endif
1006.endif # !defined(X11SRCDIR)
1007
1008X11SRCDIR.xc?=		${X11SRCDIR}/xfree/xc
1009X11SRCDIR.local?=	${X11SRCDIR}/local
1010.if ${X11FLAVOUR} == "Xorg"
1011X11ROOTDIR?=		/usr/X11R7
1012.else
1013X11ROOTDIR?=		/usr/X11R6
1014.endif
1015X11BINDIR?=		${X11ROOTDIR}/bin
1016X11ETCDIR?=		/etc/X11
1017X11FONTDIR?=		${X11ROOTDIR}/lib/X11/fonts
1018X11INCDIR?=		${X11ROOTDIR}/include
1019X11LIBDIR?=		${X11ROOTDIR}/lib/X11
1020X11MANDIR?=		${X11ROOTDIR}/man
1021X11SHAREDIR?=		${X11ROOTDIR}/share
1022X11USRLIBDIR?=		${X11ROOTDIR}/lib
1023
1024#
1025# New modular-xorg based builds
1026#
1027X11SRCDIRMIT?=		${X11SRCDIR}/external/mit
1028.for _lib in \
1029	FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
1030	Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpm \
1031	Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
1032	fontenc xkbfile xkbui Xaw lbxutil Xfontcache pciaccess xcb
1033X11SRCDIR.${_lib}?=		${X11SRCDIRMIT}/lib${_lib}/dist
1034.endfor
1035
1036.for _proto in \
1037	xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
1038	xinerama dri2 render resource record video xf86dga xf86misc \
1039	xf86vidmode composite damage trap gl randr fontcache xf86dri \
1040	xcb-
1041X11SRCDIR.${_proto}proto?=		${X11SRCDIRMIT}/${_proto}proto/dist
1042.endfor
1043
1044.for _dir in \
1045	xtrans fontconfig expat freetype evieext mkfontscale bdftopcf \
1046	xkbcomp xorg-cf-files imake xorg-server xbiff xkbdata xkeyboard-config \
1047	xbitmaps appres xeyes xev xedit sessreg pixman \
1048	beforelight bitmap editres makedepend fonttosfnt fslsfonts \
1049	fstobdf MesaDemos MesaGLUT MesaLib ico iceauth lbxproxy listres lndir \
1050	luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
1051	setxkbmap smproxy twm viewres x11perf xauth xcalc xclipboard \
1052	xclock xcmsdb xconsole xcutsel xditview xdpyinfo xdriinfo xdm \
1053	xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
1054	xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
1055	xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
1056	xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
1057	xwininfo xwud xprehashprinterlist xplsprinters xkbprint xkbevd \
1058	xterm xwd xfs xfsinfo xphelloworld xtrap xkbutils xkbcomp \
1059	xkeyboard-config xinput xcb-util \
1060	font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
1061	font-adobe-utopia-75dpi font-adobe-utopia-type1 \
1062	font-alias \
1063	font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
1064	font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
1065	font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
1066	font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
1067	font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
1068	font-sony-misc font-util ttf-bitstream-vera encodings
1069X11SRCDIR.${_dir}?=		${X11SRCDIRMIT}/${_dir}/dist
1070.endfor
1071
1072.for _i in \
1073	elographics keyboard mouse synaptics vmmouse void ws
1074X11SRCDIR.xf86-input-${_i}?=	${X11SRCDIRMIT}/xf86-input-${_i}/dist
1075.endfor
1076
1077.for _v in \
1078	ag10e apm ark ast ati chips cirrus crime \
1079	geode glint i128 i740 igs imstt intel mach64 mga \
1080	neomagic newport nsc nv nvxbox openchrome pnozz \
1081	r128 radeonhd rendition \
1082	s3 s3virge savage siliconmotion sis suncg14 \
1083	suncg6 sunffb sunleo suntcx \
1084	tdfx tga trident tseng vesa vga via vmware wsfb
1085X11SRCDIR.xf86-video-${_v}?=	${X11SRCDIRMIT}/xf86-video-${_v}/dist
1086.endfor
1087
1088.if ${X11FLAVOUR} == "Xorg"
1089X11DRI?=			yes
1090.endif
1091
1092X11DRI?=			no
1093X11LOADABLE?=			yes
1094
1095
1096#
1097# Where extsrc sources are and where it is installed to.
1098#
1099.if !defined(EXTSRCSRCDIR)
1100.if exists(${NETBSDSRCDIR}/../extsrc)
1101EXTSRCSRCDIR!=		cd "${NETBSDSRCDIR}/../extsrc" && pwd
1102.else
1103EXTSRCSRCDIR=		/usr/extsrc
1104.endif
1105.endif # !defined(EXTSRCSRCDIR)
1106
1107EXTSRCROOTDIR?=		/usr/ext
1108EXTSRCBINDIR?=		${EXTSRCROOTDIR}/bin
1109EXTSRCETCDIR?=		/etc/ext
1110EXTSRCINCDIR?=		${EXTSRCROOTDIR}/include
1111EXTSRCLIBDIR?=		${EXTSRCROOTDIR}/lib/ext
1112EXTSRCMANDIR?=		${EXTSRCROOTDIR}/man
1113EXTSRCUSRLIBDIR?=	${EXTSRCROOTDIR}/lib
1114
1115#
1116# MAKEDIRTARGET dir target [extra make(1) params]
1117#	run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
1118#
1119MAKEDIRTARGETENV?=
1120MAKEDIRTARGET=\
1121	@_makedirtarget() { \
1122		dir="$$1"; shift; \
1123		target="$$1"; shift; \
1124		case "$${dir}" in \
1125		/*)	this="$${dir}/"; \
1126			real="$${dir}" ;; \
1127		.)	this="${_THISDIR_}"; \
1128			real="${.CURDIR}" ;; \
1129		*)	this="${_THISDIR_}$${dir}/"; \
1130			real="${.CURDIR}/$${dir}" ;; \
1131		esac; \
1132		show=$${this:-.}; \
1133		echo "$${target} ===> $${show%/}$${1:+	(with: $$@)}"; \
1134		cd "$${real}" \
1135		&& ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
1136	}; \
1137	_makedirtarget
1138
1139#
1140# MAKEVERBOSE support.  Levels are:
1141#	0	Minimal output ("quiet")
1142#	1	Describe what is occurring
1143#	2	Describe what is occurring and echo the actual command
1144#	3	Ignore the effect of the "@" prefix in make commands
1145#	4	Trace shell commands using the shell's -x flag
1146#		
1147MAKEVERBOSE?=		2
1148
1149.if ${MAKEVERBOSE} == 0
1150_MKMSG?=	@\#
1151_MKSHMSG?=	: echo
1152_MKSHECHO?=	: echo
1153.SILENT:
1154.elif ${MAKEVERBOSE} == 1
1155_MKMSG?=	@echo '   '
1156_MKSHMSG?=	echo '   '
1157_MKSHECHO?=	: echo
1158.SILENT:
1159.else	# MAKEVERBOSE >= 2
1160_MKMSG?=	@echo '\#  '
1161_MKSHMSG?=	echo '\#  '
1162_MKSHECHO?=	echo
1163.SILENT: __makeverbose_dummy_target__
1164.endif	# MAKEVERBOSE >= 2
1165.if ${MAKEVERBOSE} >= 3
1166.MAKEFLAGS:	-dl
1167.endif	# ${MAKEVERBOSE} >= 3
1168.if ${MAKEVERBOSE} >= 4
1169.MAKEFLAGS:	-dx
1170.endif	# ${MAKEVERBOSE} >= 4
1171
1172_MKMSG_BUILD?=		${_MKMSG} "  build "
1173_MKMSG_CREATE?=		${_MKMSG} " create "
1174_MKMSG_COMPILE?=	${_MKMSG} "compile "
1175_MKMSG_FORMAT?=		${_MKMSG} " format "
1176_MKMSG_INSTALL?=	${_MKMSG} "install "
1177_MKMSG_LINK?=		${_MKMSG} "   link "
1178_MKMSG_LEX?=		${_MKMSG} "    lex "
1179_MKMSG_REMOVE?=		${_MKMSG} " remove "
1180_MKMSG_YACC?=		${_MKMSG} "   yacc "
1181
1182_MKSHMSG_CREATE?=	${_MKSHMSG} " create "
1183_MKSHMSG_INSTALL?=	${_MKSHMSG} "install "
1184
1185_MKTARGET_BUILD?=	${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET}
1186_MKTARGET_CREATE?=	${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET}
1187_MKTARGET_COMPILE?=	${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET}
1188_MKTARGET_FORMAT?=	${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET}
1189_MKTARGET_INSTALL?=	${_MKMSG_INSTALL} ${.TARGET}
1190_MKTARGET_LINK?=	${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET}
1191_MKTARGET_LEX?=		${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET}
1192_MKTARGET_REMOVE?=	${_MKMSG_REMOVE} ${.TARGET}
1193_MKTARGET_YACC?=	${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET}
1194
1195.if ${MKMANDOC} == "yes"
1196TARGETS+=	lintmanpages
1197.endif
1198
1199TESTSBASE=	/usr/tests
1200
1201.endif	# !defined(_BSD_OWN_MK_)
1202