Makefile revision 1.184
1# $NetBSD: Makefile,v 1.184 2015/12/19 01:10:31 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 106 107.if ${TOOLS_BUILDRUMP} == "no" 108SUBDIR += .WAIT texinfo \ 109 .WAIT tic \ 110 .WAIT pax \ 111 .WAIT ${TOOLCHAIN_BITS} \ 112 ${DTRACE_BITS} \ 113 asn1_compile cksum compile_et db \ 114 file lint1 slc \ 115 makefs sortinfo \ 116 .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 117 .WAIT disklabel gpt \ 118 .WAIT paxctl \ 119 .WAIT fdisk \ 120 .WAIT installboot \ 121 pwd_mkdb strfile sunlabel vgrind zic 122.endif 123SUBDIR+= stat .WAIT config 124 125.if ${MKLLVM} != "no" 126SUBDIR+= \ 127 llvm .WAIT \ 128 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 129 llvm-tblgen llvm-clang-tblgen .WAIT \ 130 llvm-include .WAIT \ 131 llvm-lib .WAIT \ 132 llvm-clang 133. if ${MKLLD} != "no" 134SUBDIR+= llvm-lld 135. endif 136. if ${MKMCLINKER} != "no" 137SUBDIR+= llvm-mcld 138. endif 139.endif 140 141.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 142. if ${MKGROFF} != "no" 143SUBDIR+= groff 144. endif 145SUBDIR+= mandoc 146.endif 147 148.if ${TOOLS_BUILDRUMP} == "no" 149 150.if ${MKMAINTAINERTOOLS:Uno} != "no" 151SUBDIR+= autoconf .WAIT gettext 152.endif 153 154.if ${USE_PIGZGZIP} != "no" 155SUBDIR+= pigz 156.endif 157 158.if ${MACHINE} == "hppa" 159SUBDIR+= hppa-mkboot 160.endif 161 162.if ${MACHINE} == "ibmnws" 163SUBDIR+= ibmnws-ncdcs 164.endif 165 166.if ${MACHINE} == "macppc" 167SUBDIR+= macppc-fixcoff 168.endif 169 170.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 171SUBDIR+= powerpc-mkbootimage 172.endif 173 174.if ${MACHINE_ARCH} == "m68k" 175SUBDIR+= m68k-elf2aout 176.endif 177 178.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 179 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 180SUBDIR+= mips-elf2ecoff 181.endif 182 183.if (${MACHINE} == "sgimips") 184SUBDIR+= sgivol 185.endif 186 187.if ${MACHINE} == "acorn32" 188SUBDIR+= sparkcrc 189.endif 190 191.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 192SUBDIR+= fgen 193.endif 194 195.if ${MACHINE} == "amiga" 196SUBDIR+= amiga-elf2bb 197SUBDIR+= amiga-txlt 198.endif 199 200.if ${MACHINE} == "hp300" 201SUBDIR+= hp300-mkboot 202.endif 203 204.if ${MACHINE} == "evbarm" \ 205 && ${MACHINE_CPU} == "arm" \ 206 && ${TARGET_ENDIANNESS} == "1234" 207SUBDIR+= elftosb 208.endif 209 210.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 211 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 212SUBDIR+= mkubootimage 213.endif 214 215.if ${MKX11} != "no" 216SUBDIR+= makestrs 217SUBDIR+= makekeys 218.endif 219 220.endif # TOOLCHAIN_BUILDRUMP 221 222check_MKTOOLS: .PHONY .NOTMAIN 223.if ${MKTOOLS:Uyes} == "no" 224 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 225 @echo '*** updating your host toolchain. This should be used only as a' 226 @echo '*** temporary workaround for toolchain problems, as it will result' 227 @echo '*** in version skew and build errors over time!' 228.endif 229 230.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 231SUBDIR= # empty 232realall realdepend install: check_MKTOOLS 233.endif # } 234 235.include <bsd.subdir.mk> 236.include <bsd.buildinstall.mk> 237.include <bsd.obj.mk> 238 239.if !defined(PREVIOUSTOOLDIR) 240. if exists(PREVIOUSTOOLDIR) 241PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 242. else 243PREVIOUSTOOLDIR= 244. endif 245.endif 246 247CLEANFILES+= PREVIOUSTOOLDIR 248 249realall realdepend: .MAKE 250.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 251 @echo "*** WARNING: TOOLDIR has moved?" 252 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 253 @echo "*** != TOOLDIR '${TOOLDIR}'" 254 @echo "*** Cleaning mis-matched tools" 255 rm -f PREVIOUSTOOLDIR 256 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 257.endif 258 echo ${TOOLDIR} >PREVIOUSTOOLDIR 259 260cleandir: 261 rm -f ${CLEANFILES} 262