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