1 # $NetBSD: bsd.own.mk,v 1.613 2009/12/14 01:00:46 matt Exp $
3 # This needs to be before bsd.init.mk
4 .if defined
(BSD_MK_COMPAT_FILE
)
5 .
include <${BSD_MK_COMPAT_FILE}>
8 .if
!defined
(_BSD_OWN_MK_
)
11 MAKECONF?
= /etc
/mk.conf
12 .
-include "${MAKECONF}"
15 # CPU model, derived from MACHINE_ARCH
17 MACHINE_CPU
= ${MACHINE_ARCH
:C
/mipse
[bl
]/mips
/:C
/mips64e
[bl
]/mips
/:C
/sh3e
[bl
]/sh3
/:S
/m68000
/m68k
/:S
/armeb
/arm
/}
20 # Subdirectory used below ${RELEASEDIR} when building a release
22 RELEASEMACHINEDIR?
= ${MACHINE}
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.
31 RELEASEMACHINE?
= ${MACHINE}
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.
38 NEED_OWN_INSTALL_TARGET?
= yes
41 # This lists the platforms which do not have working in-tree toolchains.
42 # For the in-tree gcc 3.3.2 toolchain, this list is empty.
43 # If some future port is not supported by the in-tree toolchain, this
44 # should be set to "yes" for that port only.
46 TOOLCHAIN_MISSING?
= no
49 .if
!defined
(HAVE_GCC
) && !defined
(HAVE_PCC
)
56 # default to binutils 2.19
59 CPPFLAG_ISYSTEM
= -isystem
62 CPPFLAG_ISYSTEMXX
= -isystem-cxx
64 CPPFLAG_ISYSTEMXX
= -cxx-isystem
68 .if empty
(.MAKEFLAGS
:M-V
*)
69 .if defined
(MAKEOBJDIRPREFIX
) || defined
(MAKEOBJDIR
)
70 PRINTOBJDIR
= ${MAKE} -r
-V .OBJDIR
-f
/dev
/null xxx
72 PRINTOBJDIR
= ${MAKE} -V .OBJDIR
75 PRINTOBJDIR
= echo
# prevent infinite recursion
79 # Determine if running in the NetBSD source tree by checking for the
80 # existence of build.sh and tools/ in the current or a parent directory,
81 # and setting _SRC_TOP_ to the result.
83 .if
!defined
(_SRC_TOP_
) # {
84 _SRC_TOP_
!= cd
${.CURDIR
}; while
:; do \
86 [ -f build.sh
] && [ -d tools
] && { echo
$$here; break
; }; \
87 case
$$here in
/) echo
""; break
;; esac
; \
90 .MAKEOVERRIDES
+= _SRC_TOP_
95 # If _SRC_TOP_ != "", we're within the NetBSD source tree, so set
96 # defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
98 .if
(${_SRC_TOP_} != "") # {
100 NETBSDSRCDIR?
= ${_SRC_TOP_}
102 .if
!defined
(_SRC_TOP_OBJ_
)
103 _SRC_TOP_OBJ_
!= cd
${_SRC_TOP_} && ${PRINTOBJDIR}
104 .MAKEOVERRIDES
+= _SRC_TOP_OBJ_
107 .
endif # _SRC_TOP_ != "" # }
110 .if
(${_SRC_TOP_} != "") && \
111 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
))
117 .if
${MACHINE_ARCH} == "mips" ||
${MACHINE_ARCH} == "mips64" || \
118 ${MACHINE_ARCH} == "sh3"
120 @echo
"Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
122 .elif defined
(REQUIRETOOLS
) && \
123 (${TOOLCHAIN_MISSING} == "no" || defined
(EXTERNAL_TOOLCHAIN
)) && \
126 @echo
"USETOOLS=no, but this component requires a version-specific host toolchain"
131 # Host platform information; may be overridden
133 .if
!defined
(HOST_OSTYPE
)
134 _HOST_OSNAME
!= uname
-s
135 _HOST_OSREL
!= uname
-r
136 # For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
137 # something that does not look like an identifier, then use uname -m.
138 _HOST_ARCH
!= uname
-p
2>/dev
/null
139 _HOST_ARCH
:= ${HOST_ARCH
:tW
:C
/.
*[^
-_A-Za-z0-9
].
*//:S
/unknown
//}
140 .if empty
(_HOST_ARCH
)
141 _HOST_ARCH
!= uname
-m
143 HOST_OSTYPE
:= ${_HOST_OSNAME}-${_HOST_OSREL
:C
/\
([^\
)]*\
)//g
:[*]:C
/ /_
/g
}-${_HOST_ARCH
:C
/\
([^\
)]*\
)//g
:[*]:C
/ /_
/g
}
144 .MAKEOVERRIDES
+= HOST_OSTYPE
145 .
endif # !defined(HOST_OSTYPE)
147 .if
${USETOOLS} == "yes" # {
150 # Provide a default for TOOLDIR.
152 .if
!defined
(TOOLDIR
)
153 TOOLDIR
:= ${_SRC_TOP_OBJ_}/tooldir.
${HOST_OSTYPE}
154 .MAKEOVERRIDES
+= TOOLDIR
158 # This is the prefix used for the NetBSD-sourced tools.
163 # If an external toolchain base is specified, use it.
165 .if defined
(EXTERNAL_TOOLCHAIN
) # {
166 AR
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ar
167 AS
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-as
168 LD
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ld
169 NM
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-nm
170 OBJCOPY
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
171 OBJDUMP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-objdump
172 RANLIB
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
173 SIZE
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-size
174 STRIP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-strip
176 CC
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
177 CPP
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-cpp
178 CXX
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-c
++
179 FC
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-g77
180 OBJC
= ${EXTERNAL_TOOLCHAIN}/bin
/${MACHINE_GNU_PLATFORM}-gcc
182 # Define default locations for common tools.
183 .if
${USETOOLS_BINUTILS
:Uyes
} == "yes" # {
184 AR
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ar
185 AS
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-as
186 LD
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ld
187 NM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-nm
188 OBJCOPY
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objcopy
189 OBJDUMP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-objdump
190 RANLIB
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-ranlib
191 SIZE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-size
192 STRIP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-strip
195 .if defined
(HAVE_GCC
) && ${USETOOLS_GCC
:Uyes
} == "yes" # {
196 CC
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
197 CPP
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-cpp
198 CXX
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-c
++
199 FC
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-g77
200 OBJC
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-gcc
203 .if defined
(HAVE_PCC
) && ${USETOOLS_PCC
:Uyes
} == "yes"
204 CC
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-pcc
205 CPP
= ${TOOLDIR}/libexec
/${MACHINE_GNU_PLATFORM}-cpp
207 FC
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-f77
211 .
endif # EXTERNAL_TOOLCHAIN # }
213 HOST_MKDEP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}host-mkdep
215 DBSYM
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-dbsym
216 ELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
217 INSTALL
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-install
218 LEX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}lex
219 LINT
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-lint
220 LORDER
= NM
=${NM
:Q
} MKTEMP
=${TOOL_MKTEMP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}lorder
221 MKDEP
= CC
=${CC
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkdep
222 PAXCTL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}paxctl
223 TSORT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tsort
-q
224 YACC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}yacc
226 TOOL_AMIGAAOUT2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-aout2bb
227 TOOL_AMIGAELF2BB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-elf2bb
228 TOOL_AMIGATXLT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}amiga-txlt
229 TOOL_ASN1_COMPILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}asn1_compile
230 TOOL_ATF_COMPILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}atf-compile
231 TOOL_AWK
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}awk
232 TOOL_CAP_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cap_mkdb
233 TOOL_CAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cat
234 TOOL_CKSUM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}cksum
235 TOOL_COMPILE_ET
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}compile_et
236 TOOL_CONFIG
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}config
237 TOOL_CRUNCHGEN
= MAKE
=${.MAKE
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}crunchgen
238 TOOL_CTAGS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}ctags
239 TOOL_DB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}db
240 TOOL_DISKLABEL
= ${TOOLDIR}/bin
/nbdisklabel-
${MAKEWRAPPERMACHINE}
241 TOOL_EQN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}eqn
242 TOOL_FDISK
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-fdisk
243 TOOL_FGEN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}fgen
244 TOOL_GENASSYM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}genassym
245 TOOL_GENCAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gencat
246 TOOL_GMAKE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}gmake
247 TOOL_GREP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}grep
248 TOOL_GROFF
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}groff
249 TOOL_HEXDUMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hexdump
250 TOOL_HP300MKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hp300-mkboot
251 TOOL_HP700MKBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}hp700-mkboot
252 TOOL_INDXBIB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}indxbib
253 TOOL_INSTALLBOOT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}installboot
254 TOOL_INSTALL_INFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}install-info
255 TOOL_JOIN
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}join
256 TOOL_M4
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}m4
257 TOOL_MACPPCFIXCOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}macppc-fixcoff
258 TOOL_MAKEFS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makefs
259 TOOL_MAKEINFO
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makeinfo
260 TOOL_MAKEWHATIS
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}makewhatis
261 TOOL_MANDOC_ASCII
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tascii
262 TOOL_MANDOC_HTML
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Thtml
263 TOOL_MANDOC_LINT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mandoc
-Tlint
264 TOOL_MDSETIMAGE
= ${TOOLDIR}/bin
/${MACHINE_GNU_PLATFORM}-mdsetimage
265 TOOL_MENUC
= MENUDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}menuc
266 TOOL_MIPSELF2ECOFF
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mips-elf2ecoff
267 TOOL_MKCSMAPPER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkcsmapper
268 TOOL_MKESDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mkesdb
269 TOOL_MKLOCALE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mklocale
270 TOOL_MKMAGIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}file
271 TOOL_MKTEMP
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mktemp
272 TOOL_MSGC
= MSGDEF
=${TOOLDIR}/share
/misc
${TOOLDIR}/bin
/${_TOOL_PREFIX}msgc
273 TOOL_MTREE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}mtree
274 TOOL_PAX
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pax
275 TOOL_PIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pic
276 TOOL_PKG_CREATE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pkg_create
277 TOOL_POWERPCMKBOOTIMAGE
=${TOOLDIR}/bin
/${_TOOL_PREFIX}powerpc-mkbootimage
278 TOOL_PWD_MKDB
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}pwd_mkdb
279 TOOL_REFER
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}refer
280 TOOL_ROFF_ASCII
= PATH
=${TOOLDIR}/lib
/groff
:$${PATH} ${TOOLDIR}/bin
/${_TOOL_PREFIX}nroff
281 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
282 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
283 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
284 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
285 TOOL_RPCGEN
= RPCGEN_CPP
=${CPP
:Q
} ${TOOLDIR}/bin
/${_TOOL_PREFIX}rpcgen
286 TOOL_SED
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sed
287 TOOL_SOELIM
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}soelim
288 TOOL_SPARKCRC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sparkcrc
289 TOOL_STAT
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}stat
290 TOOL_STRFILE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}strfile
291 TOOL_SUNLABEL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}sunlabel
292 TOOL_TBL
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}tbl
293 TOOL_UUDECODE
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}uudecode
294 TOOL_VGRIND
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}vgrind
-f
295 TOOL_ZIC
= ${TOOLDIR}/bin
/${_TOOL_PREFIX}zic
297 .
else # USETOOLS != yes # } {
299 TOOL_AMIGAAOUT2BB
= amiga-aout2bb
300 TOOL_AMIGAELF2BB
= amiga-elf2bb
301 TOOL_AMIGATXLT
= amiga-txlt
302 TOOL_ASN1_COMPILE
= asn1_compile
303 TOOL_ATF_COMPILE
= atf-compile
305 TOOL_CAP_MKDB
= cap_mkdb
308 TOOL_COMPILE_ET
= compile_et
310 TOOL_CRUNCHGEN
= crunchgen
313 TOOL_DISKLABEL
= disklabel
317 TOOL_GENASSYM
= genassym
322 TOOL_HEXDUMP
= hexdump
323 TOOL_HP300MKBOOT
= hp300-mkboot
324 TOOL_HP700MKBOOT
= hp700-mkboot
325 TOOL_INDXBIB
= indxbib
326 TOOL_INSTALLBOOT
= installboot
327 TOOL_INSTALL_INFO
= install-info
330 TOOL_MACPPCFIXCOFF
= macppc-fixcoff
332 TOOL_MAKEINFO
= makeinfo
333 TOOL_MAKEWHATIS
= /usr
/libexec
/makewhatis
334 TOOL_MDSETIMAGE
= mdsetimage
336 TOOL_MIPSELF2ECOFF
= mips-elf2ecoff
337 TOOL_MKCSMAPPER
= mkcsmapper
339 TOOL_MKLOCALE
= mklocale
346 TOOL_PKG_CREATE
= pkg_create
347 TOOL_POWERPCMKBOOTIMAGE
= powerpc-mkbootimage
348 TOOL_PWD_MKDB
= pwd_mkdb
350 TOOL_ROFF_ASCII
= nroff
351 TOOL_ROFF_DVI
= ${TOOL_GROFF} -Tdvi
352 TOOL_ROFF_HTML
= ${TOOL_GROFF} -Tlatin1
-mdoc2html
353 TOOL_ROFF_PS
= ${TOOL_GROFF} -Tps
354 TOOL_ROFF_RAW
= ${TOOL_GROFF} -Z
358 TOOL_SPARKCRC
= sparkcrc
360 TOOL_STRFILE
= strfile
361 TOOL_SUNLABEL
= sunlabel
363 TOOL_UUDECODE
= uudecode
364 TOOL_VGRIND
= vgrind
-f
367 .
endif # USETOOLS != yes # }
370 # Targets to check if DESTDIR or RELEASEDIR is provided
372 .if
!target
(check_DESTDIR
)
373 check_DESTDIR
: .PHONY .NOTMAIN
374 .if
!defined
(DESTDIR
)
375 @echo
"setenv DESTDIR before doing that!"
382 .if
!target
(check_RELEASEDIR
)
383 check_RELEASEDIR
: .PHONY .NOTMAIN
384 .if
!defined
(RELEASEDIR
)
385 @echo
"setenv RELEASEDIR before doing that!"
393 .if
${USETOOLS} == "yes" # {
395 # Make sure DESTDIR is set, so that builds with these tools always
396 # get appropriate -nostdinc, -nostdlib, etc. handling. The default is
397 # <empty string>, meaning start from /, the root directory.
403 # Build a dynamically linked /bin and /sbin, with the necessary shared
404 # libraries moved from /usr/lib to /lib and the shared linker moved
405 # from /usr/libexec to /lib
407 # Note that if the BINDIR is not /bin or /sbin, then we always use the
408 # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
409 # and /sbin). See <bsd.shlib.mk>.
414 # Where the system object and source trees are kept; can be configurable
415 # by the user in case they want them in ~/foosrc and ~/fooobj (for example).
419 NETBSDSRCDIR?
= ${BSDSRCDIR}
426 MANDIR?
= /usr
/share
/man
429 MANMODE?
= ${NONBINMODE}
430 MANINSTALL?
= catinstall htmlinstall maninstall
432 INFODIR?
= /usr
/share
/info
435 INFOMODE?
= ${NONBINMODE}
439 LINTLIBDIR?
= /usr
/libdata
/lint
442 LIBMODE?
= ${NONBINMODE}
444 DOCDIR?
= /usr
/share
/doc
445 HTMLDOCDIR?
= /usr
/share
/doc
/html
448 DOCMODE?
= ${NONBINMODE}
450 NLSDIR?
= /usr
/share
/nls
453 NLSMODE?
= ${NONBINMODE}
457 KMODULEMODE?
= ${NONBINMODE}
459 LOCALEDIR?
= /usr
/share
/locale
462 LOCALEMODE?
= ${NONBINMODE}
464 FIRMWAREDIR?
= /libdata
/firmware
467 FIRMWAREMODE?
= ${NONBINMODE}
469 DEBUGDIR?
= /usr
/libdata
/debug
472 DEBUGMODE?
= ${NONBINMODE}
475 # Data-driven table using make variables to control how
476 # toolchain-dependent targets and shared libraries are built
477 # for different platforms and object formats.
479 # OBJECT_FMT: currently either "ELF" or "a.out".
481 # All platforms are ELF.
486 # If this platform's toolchain is missing, we obviously cannot build it.
488 .if
${TOOLCHAIN_MISSING} != "no"
495 # If we are using an external toolchain, we can still build the target's
496 # binutils, but we cannot build GCC's support libraries, since those are
497 # tightly-coupled to the version of GCC being used.
499 .if defined
(EXTERNAL_TOOLCHAIN
)
504 # The m68000 port is incomplete.
506 .if
${MACHINE_ARCH} == "m68000"
509 # XXX GCC 4 outputs mcount() calling sequences that try to load values
510 # from over 64KB away and this fails to assemble.
511 .if defined
(HAVE_GCC
) && (${HAVE_GCC} == 4)
517 # The ia64 port is incomplete.
519 .if
${MACHINE_ARCH} == "ia64"
525 # On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
526 # not just shared libraries, so don't build the _pic version.
528 .if
${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb" || \
529 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
534 # On VAX using ELF, all objects are PIC, not just shared libraries,
535 # so don't build the _pic version.
537 .if
${MACHINE_ARCH} == "vax"
542 # Location of the file that contains the major and minor numbers of the
543 # version of a shared library. If this file exists a shared library
544 # will be built by <bsd.lib.mk>.
546 SHLIB_VERSION_FILE?
= ${.CURDIR
}/shlib_version
549 # GNU sources and packages sometimes see architecture names differently.
551 GNU_ARCH.coldfire
=m68k
553 GCC_CONFIG_ARCH.i386
=i486
554 GCC_CONFIG_TUNE.i386
=nocona
555 GCC_CONFIG_TUNE.x86_64
=nocona
556 GNU_ARCH.m68000
=m68010
559 GNU_ARCH.mips64eb
=mips64
560 MACHINE_GNU_ARCH
=${GNU_ARCH.
${MACHINE_ARCH}:U
${MACHINE_ARCH}}
563 # In order to identify NetBSD to GNU packages, we sometimes need
564 # an "elf" tag for historically a.out platforms.
566 .if
${OBJECT_FMT} == "ELF" && \
567 (${MACHINE_GNU_ARCH} == "arm" || \
568 ${MACHINE_GNU_ARCH} == "armeb" || \
569 ${MACHINE_ARCH} == "i386" || \
570 ${MACHINE_CPU} == "m68k" || \
571 ${MACHINE_GNU_ARCH} == "sh" || \
572 ${MACHINE_GNU_ARCH} == "shle" || \
573 ${MACHINE_ARCH} == "sparc" || \
574 ${MACHINE_ARCH} == "vax")
575 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsdelf
577 MACHINE_GNU_PLATFORM?
=${MACHINE_GNU_ARCH}--netbsd
581 # Determine if arch uses native kernel modules with rump
583 .if
${MACHINE_ARCH} == "i386" || \
584 ${MACHINE_ARCH} == "x86_64"
588 TARGETS
+= all clean cleandir depend dependall includes \
589 install lint obj regress
tags html
590 PHONY_NOTMAIN
= all clean cleandir depend dependall
distclean includes \
591 install lint obj regress
tags beforedepend afterdepend \
592 beforeinstall afterinstall realinstall realdepend realall \
593 html subdir-all subdir-install subdir-depend
594 .PHONY
: ${PHONY_NOTMAIN}
595 .NOTMAIN
: ${PHONY_NOTMAIN}
597 .if
${NEED_OWN_INSTALL_TARGET} != "no"
599 install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
605 all: realall subdir-all
608 depend
: realdepend subdir-depend
614 dependall
: .NOTMAIN realdepend .MAKE
615 @cd
${.CURDIR
}; ${MAKE} realall
619 # Define MKxxx variables (which are either yes or no) for users
620 # to set in /etc/mk.conf and override in the make environment.
621 # These should be tested with `== "no"' or `!= "no"'.
622 # The NOxxx variables should only be set by Makefiles.
624 # Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
625 # with changes to the MK* variables here.
629 # Supported NO* options (if defined, MK* will be forced to "no",
630 # regardless of user's mk.conf setting).
632 # Source makefiles should set NO*, and not MK*, and must do so before
633 # including bsd.own.mk.
636 NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
637 NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
639 MK
${var
:S
/^NO
//}:= no
644 # Older-style variables that enabled behaviour when set.
646 .for var in MANZ UNPRIVED UPDATE
653 # MK* options which have variable defaults.
655 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64" || \
656 ${MACHINE_ARCH} == "mips64eb" ||
${MACHINE_ARCH} == "mips64el"
659 # Don't let this build where it really isn't supported.
664 # MK* backward compatibility.
667 MKBINUTILS?
= ${MKBFD}
671 # We want to build zfs only for i386 and amd64 by default for now.
673 .if
${MACHINE} == "amd64" ||
${MACHINE} == "i386"
678 # MK* options which default to "yes".
683 MKCATPAGES MKCRYPTO MKCOMPLEX MKCVS MKCXX \
685 MKGCC MKGCCCMDS MKGDB MKGROFF \
687 MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
690 MKLDAP MKLINKLIB MKLINT MKLVM \
696 MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
697 MKSHARE MKSKEY MKSTATICLIB \
700 .for var in
${_MKVARS.yes
}
705 # Exceptions to the above:
707 .if
${MACHINE} == "evbppc"
712 # MK* options which default to "no".
715 MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKDEBUG MKDEBUGLIB \
717 MKMANDOC MKMANZ MKOBJDIRS \
719 MKSOFTFLOAT MKSTRIPIDENT \
720 MKUNPRIVED MKUPDATE MKX11 MKZFS
721 .for var in
${_MKVARS.no
}
726 # Do we default to XFree86 or Xorg for this platform?
728 .if
${MACHINE} == "alpha" ||
${MACHINE} == "acorn32" || \
729 ${MACHINE} == "amiga" ||
${MACHINE} == "dreamcast" || \
730 ${MACHINE} == "ews4800mips" ||
${MACHINE} == "hpcarm" || \
731 ${MACHINE} == "hpcmips" ||
${MACHINE} == "hpcsh" || \
732 ${MACHINE} == "mac68k" ||
${MACHINE} == "newsmips" || \
733 ${MACHINE} == "ofppc" ||
${MACHINE} == "pmax" || \
734 ${MACHINE} == "sun3" ||
${MACHINE} == "x68k"
741 # Force some options off if their dependencies are off.
749 .if
${MKCRYPTO} == "no"
758 .if
${MKLINKLIB} == "no"
772 .if
${MKSHARE} == "no"
782 # install(1) parameters.
785 .if
${MKUPDATE} == "no"
794 METALOG?
= ${DESTDIR}/METALOG
795 METALOG.add?
= ${TOOL_CAT} -l
>> ${METALOG}
796 .if
(${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR}
797 .if
${MKUNPRIVED} != "no"
798 INSTPRIV.unpriv
=-U
-M
${METALOG} -D
${DESTDIR} -h sha256
802 INSTPRIV?
= ${INSTPRIV.unpriv
} -N
${NETBSDSRCDIR}/etc
806 .if
${NEED_OWN_INSTALL_TARGET} != "no"
807 INSTALL_DIR?
= ${INSTALL} ${INSTPRIV} -d
808 INSTALL_FILE?
= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
809 INSTALL_LINK?
= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
810 INSTALL_SYMLINK?
= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
811 HOST_INSTALL_FILE?
= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
812 HOST_INSTALL_DIR?
= ${INSTALL} -d
813 HOST_INSTALL_SYMLINK?
= ${INSTALL} ${SYMLINK} ${RENAME}
817 # Set defaults for the USE_xxx variables.
821 # USE_* options which default to "no" and will be forced to "no" if their
822 # corresponding MK* variable is set to "no".
825 .if
(${${var
:S
/USE_
/MK
/}} == "no")
833 # USE_* options which default to "yes" unless their corresponding MK*
834 # variable is set to "no".
836 .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
837 .if
(${${var
:S
/USE_
/MK
/}} == "no")
845 # USE_* options which default to "yes".
847 .for var in USE_JEMALLOC
852 # USE_* options which default to "no".
859 # Where X11 sources are and where it is installed to.
861 .if
!defined
(X11SRCDIR
)
862 .if exists
(${NETBSDSRCDIR}/..
/xsrc
)
863 X11SRCDIR
!= cd
${NETBSDSRCDIR}/..
/xsrc
&& pwd
867 .
endif # !defined(X11SRCDIR)
869 X11SRCDIR.xc?
= ${X11SRCDIR}/xfree
/xc
870 X11SRCDIR.local?
= ${X11SRCDIR}/local
871 .if
${X11FLAVOUR} == "Xorg"
872 X11ROOTDIR?
= /usr
/X11R7
874 X11ROOTDIR?
= /usr
/X11R6
876 X11BINDIR?
= ${X11ROOTDIR}/bin
878 X11FONTDIR?
= ${X11ROOTDIR}/lib
/X11
/fonts
879 X11INCDIR?
= ${X11ROOTDIR}/include
880 X11LIBDIR?
= ${X11ROOTDIR}/lib
/X11
881 X11MANDIR?
= ${X11ROOTDIR}/man
882 X11USRLIBDIR?
= ${X11ROOTDIR}/lib
885 # New modular-xorg based builds
887 X11SRCDIRMIT?
= ${X11SRCDIR}/external
/mit
889 FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
890 Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpm \
891 Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
892 fontenc xkbfile xkbui Xaw lbxutil Xfontcache pciaccess
893 X11SRCDIR.
${_lib}?
= ${X11SRCDIRMIT}/lib
${_lib}/dist
897 xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
898 xinerama dri2 render resource record video xf86dga xf86misc \
899 xf86vidmode composite damage trap gl randr fontcache xf86dri
900 X11SRCDIR.
${_proto}proto?
= ${X11SRCDIRMIT}/${_proto}proto
/dist
904 xtrans fontconfig expat freetype evieext mkfontscale bdftopcf \
905 xkbcomp xorg-cf-files imake xorg-server xbiff xkbdata xkeyboard-config \
906 xbitmaps appres xeyes xev xedit sessreg pixman \
907 beforelight bitmap editres makedepend fonttosfnt fslsfonts \
908 fstobdf MesaDemos MesaGLUT MesaLib ico iceauth lbxproxy listres lndir \
909 luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
910 setxkbmap smproxy twm viewres x11perf xauth xcalc xclipboard \
911 xclock xcmsdb xconsole xcutsel xditview xdpyinfo xdriinfo xdm \
912 xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
913 xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
914 xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
915 xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
916 xwininfo xwud xprehashprinterlist xplsprinters xkbprint xkbevd \
917 xterm xwd xfs xfsinfo xphelloworld xtrap xkbutils xkbcomp \
918 xkeyboard-config xinput \
919 font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
920 font-adobe-utopia-75dpi font-adobe-utopia-type1 \
922 font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
923 font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
924 font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
925 font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
926 font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
927 font-sony-misc font-util ttf-bitstream-vera encodings
928 X11SRCDIR.
${_dir}?
= ${X11SRCDIRMIT}/${_dir}/dist
932 elographics keyboard mouse vmmouse void ws
933 X11SRCDIR.xf86-input-
${_i}?
= ${X11SRCDIRMIT}/xf86-input-
${_i}/dist
937 ag10e apm ark ast ati chips cirrus crime cyrix glint i128 i740 igs \
938 imstt intel mach64 mga neomagic newport nsc nv nvxbox pnozz r128 \
939 radeonhd rendition s3 s3virge savage siliconmotion sis sunffb suncg6 \
940 sunleo suntcx tdfx tga trident tseng vesa vga via vmware wsfb
942 X11SRCDIR.xf86-video-
${_v}?
= ${X11SRCDIRMIT}/xf86-video-
${_v}/dist
945 .if
${X11FLAVOUR} == "Xorg"
954 # Where extsrc sources are and where it is installed to.
956 .if
!defined
(EXTSRCSRCDIR
)
957 .if exists
(${NETBSDSRCDIR}/..
/extsrc
)
958 EXTSRCSRCDIR
!= cd
${NETBSDSRCDIR}/..
/extsrc
&& pwd
960 EXTSRCSRCDIR
= /usr
/extsrc
962 .
endif # !defined(EXTSRCSRCDIR)
964 EXTSRCROOTDIR?
= /usr
/ext
965 EXTSRCBINDIR?
= ${EXTSRCROOTDIR}/bin
966 EXTSRCETCDIR?
= /etc
/ext
967 EXTSRCINCDIR?
= ${EXTSRCROOTDIR}/include
968 EXTSRCLIBDIR?
= ${EXTSRCROOTDIR}/lib
/ext
969 EXTSRCMANDIR?
= ${EXTSRCROOTDIR}/man
970 EXTSRCUSRLIBDIR?
= ${EXTSRCROOTDIR}/lib
973 # MAKEDIRTARGET dir target [extra make(1) params]
974 # run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
978 @_makedirtarget
() { \
980 target
="$$1"; shift
; \
982 /*) this
="$${dir}/"; \
984 .
) this
="${_THISDIR_}"; \
985 real
="${.CURDIR}" ;; \
986 *) this
="${_THISDIR_}$${dir}/"; \
987 real
="${.CURDIR}/$${dir}" ;; \
990 echo
"$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \
992 && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_
="$${this}" "$$@" $${target}; \
997 # MAKEVERBOSE support. Levels are:
998 # 0 Minimal output ("quiet")
999 # 1 Describe what is occurring
1000 # 2 Describe what is occurring and echo the actual command
1001 # 3 Ignore the effect of the "@" prefix in make commands
1002 # 4 Trace shell commands using the shell's -x flag
1006 .if
${MAKEVERBOSE} == 0
1011 .elif
${MAKEVERBOSE} == 1
1016 .
else # MAKEVERBOSE >= 2
1017 _MKMSG?
= @echo
'\# '
1018 _MKSHMSG?
= echo
'\# '
1020 .SILENT
: __makeverbose_dummy_target__
1021 .
endif # MAKEVERBOSE >= 2
1022 .if
${MAKEVERBOSE} >= 3
1024 .
endif # ${MAKEVERBOSE} >= 3
1025 .if
${MAKEVERBOSE} >= 4
1027 .
endif # ${MAKEVERBOSE} >= 4
1029 _MKMSG_BUILD?
= ${_MKMSG} " build "
1030 _MKMSG_CREATE?
= ${_MKMSG} " create "
1031 _MKMSG_COMPILE?
= ${_MKMSG} "compile "
1032 _MKMSG_FORMAT?
= ${_MKMSG} " format "
1033 _MKMSG_INSTALL?
= ${_MKMSG} "install "
1034 _MKMSG_LINK?
= ${_MKMSG} " link "
1035 _MKMSG_LEX?
= ${_MKMSG} " lex "
1036 _MKMSG_REMOVE?
= ${_MKMSG} " remove "
1037 _MKMSG_YACC?
= ${_MKMSG} " yacc "
1039 _MKSHMSG_CREATE?
= ${_MKSHMSG} " create "
1040 _MKSHMSG_INSTALL?
= ${_MKSHMSG} "install "
1042 _MKTARGET_BUILD?
= ${_MKMSG_BUILD} ${.CURDIR
:T
}/${.TARGET
}
1043 _MKTARGET_CREATE?
= ${_MKMSG_CREATE} ${.CURDIR
:T
}/${.TARGET
}
1044 _MKTARGET_COMPILE?
= ${_MKMSG_COMPILE} ${.CURDIR
:T
}/${.TARGET
}
1045 _MKTARGET_FORMAT?
= ${_MKMSG_FORMAT} ${.CURDIR
:T
}/${.TARGET
}
1046 _MKTARGET_INSTALL?
= ${_MKMSG_INSTALL} ${.TARGET
}
1047 _MKTARGET_LINK?
= ${_MKMSG_LINK} ${.CURDIR
:T
}/${.TARGET
}
1048 _MKTARGET_LEX?
= ${_MKMSG_LEX} ${.CURDIR
:T
}/${.TARGET
}
1049 _MKTARGET_REMOVE?
= ${_MKMSG_REMOVE} ${.TARGET
}
1050 _MKTARGET_YACC?
= ${_MKMSG_YACC} ${.CURDIR
:T
}/${.TARGET
}
1052 .if
${MKMANDOC} == "yes"
1053 TARGETS
+= lintmanpages
1056 .
endif # !defined(_BSD_OWN_MK_)