Makefile revision 1.185
1# $NetBSD: Makefile,v 1.185 2016/01/24 20:14:17 christos Exp $ 2 3.include <bsd.own.mk> 4.include <bsd.endian.mk> 5 6# Make sure that the ordered build/install processing applies when using 7# plain make. 8.MAIN: build_install 9 10# TOOLDIR must be valid, unless MKTOOLS=no 11.if ${MKTOOLS:Uyes} != "no" 12.if "${TOOLDIR}" == "" 13.error "TOOLDIR is undefined or empty" 14.elif "${TOOLDIR:tW:M/*}" == "" 15.error "TOOLDIR is not an absolute path: ${TOOLDIR}" 16#.elif !exists(TOOLDIR) # XXX .exists fails for directories 17#.error "TOOLDIR does not exist: ${TOOLDIR}" 18.endif 19.endif # MKTOOLS != no 20 21# TOOLS_BUILDRUMP == yes builds only the subset of the tools required 22# for building rump kernels and the hypervisor. It is typically used 23# when building rump kernels targeted for non-NetBSD systems (via 24# buildrump.sh), and should not be set for a regular "make build". 25TOOLS_BUILDRUMP?=no 26 27.if ${TOOLCHAIN_MISSING} == "no" 28. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 29TOOLCHAIN_BITS= gmake .WAIT 30TOOLCHAIN_BITS+= gmp .WAIT 31TOOLCHAIN_BITS+= mpfr .WAIT 32TOOLCHAIN_BITS+= mpc .WAIT 33. endif 34.endif 35 36.if ${TOOLCHAIN_MISSING} == "no" 37TOOLCHAIN_BITS+= binutils .WAIT 38.endif 39 40.if defined(HAVE_GCC) && ${HAVE_GCC} > 0 41. if ${TOOLCHAIN_MISSING} == "no" 42TOOLCHAIN_BITS+= gcc 43. if ${MKCROSSGDB:Uno} != "no" || make(obj) 44TOOLCHAIN_BITS+= gdb 45. endif 46TOOLCHAIN_BITS+= .WAIT 47. endif 48.endif 49 50.if defined(HAVE_PCC) 51. if ${TOOLCHAIN_MISSING} == "no" 52TOOLCHAIN_BITS+= pcc 53. endif 54.endif 55 56.if ${TOOLCHAIN_MISSING} == "no" 57# XXX Eventually, we want to be able to build dbsym and mdsetimage 58# XXX if EXTERNAL_TOOLCHAIN is set. 59TOOLCHAIN_BITS+= dbsym mdsetimage 60.endif 61 62DTRACE_BITS= 63.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 64DTRACE_BITS+= .WAIT libelf 65DTRACE_BITS+= .WAIT libdwarf 66DTRACE_BITS+= .WAIT libctf 67.endif 68.if ${MKCTF} != "no" 69DTRACE_BITS+= .WAIT ctfconvert ctfmerge 70.endif 71 72LINT_BITS= 73.if ${MKLINT} != "no" 74LINT_BITS= lint lint2 75.endif 76 77# All of host-mkdep, compat, and binstall are needed before anything 78# else. Within this group, they must be built in a specific order, and 79# all of them must be built before any of them is installed. They may 80# be installed in any order. This can't be expressed using the .WAIT 81# notation inside the SUBDIR list. 82# 83# XXX .ORDER does not work when multiple targets are passed on the 84# make command line without "-j", so use dependencies in addition to .ORDER. 85# 86.ORDER: dependall-host-mkdep dependall-compat dependall-binstall 87.if make(dependall-host-mkdep) && make(dependall-compat) 88dependall-compat: dependall-host-mkdep 89.endif 90.if make(dependall-compat) && make(dependall-binstall) 91dependall-binstall: dependall-compat 92.endif 93 94# Dependencies in SUBDIR below ordered to maximize parallel ability. 95# See above for special treatment for host-mkdep, compat, and binstall. 96# 97SUBDIR= host-mkdep compat binstall \ 98 .WAIT mktemp .WAIT sed .WAIT genassym 99.if ${TOOLS_BUILDRUMP} == "no" 100SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \ 101 ${LINT_BITS} \ 102 makewhatis mtree nbperf .WAIT uudecode 103.endif 104 105SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 106SUBDIR+= cvslatest 107 108.if ${TOOLS_BUILDRUMP} == "no" 109SUBDIR += .WAIT texinfo \ 110 .WAIT tic \ 111 .WAIT pax \ 112 .WAIT ${TOOLCHAIN_BITS} \ 113 ${DTRACE_BITS} \ 114 asn1_compile cksum compile_et db \ 115 file lint1 slc \ 116 makefs sortinfo \ 117 .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 118 .WAIT disklabel gpt \ 119 .WAIT paxctl \ 120 .WAIT fdisk \ 121 .WAIT installboot \ 122 pwd_mkdb strfile sunlabel vgrind zic 123.endif 124SUBDIR+= stat .WAIT config 125 126.if ${MKLLVM} != "no" 127SUBDIR+= \ 128 llvm .WAIT \ 129 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 130 llvm-tblgen llvm-clang-tblgen .WAIT \ 131 llvm-include .WAIT \ 132 llvm-lib .WAIT \ 133 llvm-clang 134. if ${MKLLD} != "no" 135SUBDIR+= llvm-lld 136. endif 137. if ${MKMCLINKER} != "no" 138SUBDIR+= llvm-mcld 139. endif 140.endif 141 142.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 143. if ${MKGROFF} != "no" 144SUBDIR+= groff 145. endif 146SUBDIR+= mandoc 147.endif 148 149.if ${TOOLS_BUILDRUMP} == "no" 150 151.if ${MKMAINTAINERTOOLS:Uno} != "no" 152SUBDIR+= autoconf .WAIT gettext 153.endif 154 155.if ${USE_PIGZGZIP} != "no" 156SUBDIR+= pigz 157.endif 158 159.if ${MACHINE} == "hppa" 160SUBDIR+= hppa-mkboot 161.endif 162 163.if ${MACHINE} == "ibmnws" 164SUBDIR+= ibmnws-ncdcs 165.endif 166 167.if ${MACHINE} == "macppc" 168SUBDIR+= macppc-fixcoff 169.endif 170 171.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 172SUBDIR+= powerpc-mkbootimage 173.endif 174 175.if ${MACHINE_ARCH} == "m68k" 176SUBDIR+= m68k-elf2aout 177.endif 178 179.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 180 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 181SUBDIR+= mips-elf2ecoff 182.endif 183 184.if (${MACHINE} == "sgimips") 185SUBDIR+= sgivol 186.endif 187 188.if ${MACHINE} == "acorn32" 189SUBDIR+= sparkcrc 190.endif 191 192.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 193SUBDIR+= fgen 194.endif 195 196.if ${MACHINE} == "amiga" 197SUBDIR+= amiga-elf2bb 198SUBDIR+= amiga-txlt 199.endif 200 201.if ${MACHINE} == "hp300" 202SUBDIR+= hp300-mkboot 203.endif 204 205.if ${MACHINE} == "evbarm" \ 206 && ${MACHINE_CPU} == "arm" \ 207 && ${TARGET_ENDIANNESS} == "1234" 208SUBDIR+= elftosb 209.endif 210 211.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 212 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 213SUBDIR+= mkubootimage 214.endif 215 216.if ${MKX11} != "no" 217SUBDIR+= makestrs 218SUBDIR+= makekeys 219.endif 220 221.endif # TOOLCHAIN_BUILDRUMP 222 223check_MKTOOLS: .PHONY .NOTMAIN 224.if ${MKTOOLS:Uyes} == "no" 225 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 226 @echo '*** updating your host toolchain. This should be used only as a' 227 @echo '*** temporary workaround for toolchain problems, as it will result' 228 @echo '*** in version skew and build errors over time!' 229.endif 230 231.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 232SUBDIR= # empty 233realall realdepend install: check_MKTOOLS 234.endif # } 235 236.include <bsd.subdir.mk> 237.include <bsd.buildinstall.mk> 238.include <bsd.obj.mk> 239 240.if !defined(PREVIOUSTOOLDIR) 241. if exists(PREVIOUSTOOLDIR) 242PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 243. else 244PREVIOUSTOOLDIR= 245. endif 246.endif 247 248CLEANFILES+= PREVIOUSTOOLDIR 249 250realall realdepend: .MAKE 251.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 252 @echo "*** WARNING: TOOLDIR has moved?" 253 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 254 @echo "*** != TOOLDIR '${TOOLDIR}'" 255 @echo "*** Cleaning mis-matched tools" 256 rm -f PREVIOUSTOOLDIR 257 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 258.endif 259 echo ${TOOLDIR} >PREVIOUSTOOLDIR 260 261cleandir: 262 rm -f ${CLEANFILES} 263