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