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