1 # $NetBSD: Makefile,v 1.159 2012/11/15 23:51:54 joerg Exp $ 2 3 .include <bsd.own.mk> 4 5 # Make sure that the ordered build/install processing applies when using 6 # plain make. 7 .MAIN: build_install 8 9 .if defined(HAVE_GCC) || defined(HAVE_PCC) 10 TOOLCHAIN_BITS= gmake .WAIT 11 .endif 12 13 .if ${TOOLCHAIN_MISSING} == "no" 14 .if defined(HAVE_GCC) 15 .if ${HAVE_GCC} >= 45 16 TOOLCHAIN_BITS+= gmp .WAIT 17 TOOLCHAIN_BITS+= mpfr .WAIT 18 TOOLCHAIN_BITS+= mpc .WAIT 19 .endif 20 .endif 21 .endif 22 23 .if ${TOOLCHAIN_MISSING} == "no" 24 TOOLCHAIN_BITS+= binutils .WAIT 25 .endif 26 27 .if defined(HAVE_GCC) 28 .if ${TOOLCHAIN_MISSING} == "no" 29 TOOLCHAIN_BITS+= gcc 30 . if ${MKCROSSGDB:Uno} != "no" 31 TOOLCHAIN_BITS+= gdb 32 . endif 33 TOOLCHAIN_BITS+= .WAIT 34 .endif 35 .endif 36 37 .if defined(HAVE_PCC) 38 .if ${TOOLCHAIN_MISSING} == "no" 39 TOOLCHAIN_BITS+= pcc 40 .endif 41 .endif 42 43 .if ${TOOLCHAIN_MISSING} == "no" 44 # XXX Eventually, we want to be able to build dbsym and mdsetimage 45 # XXX if EXTERNAL_TOOLCHAIN is set. 46 TOOLCHAIN_BITS+= dbsym mdsetimage 47 .endif 48 49 DTRACE_BITS= 50 .if ${MKDTRACE} != "no" 51 DTRACE_BITS+= .WAIT libelf 52 DTRACE_BITS+= .WAIT libdwarf 53 DTRACE_BITS+= .WAIT libctf 54 DTRACE_BITS+= .WAIT ctfconvert ctfmerge 55 .endif 56 57 LINT_BITS= 58 .if ${MKLINT} != "no" 59 LINT_BITS= lint lint2 60 .endif 61 62 # Dependencies in SUBDIR below ordered to maximize parallel ability. 63 SUBDIR= host-mkdep .WAIT compat .WAIT \ 64 binstall .WAIT mktemp .WAIT sed .WAIT \ 65 cap_mkdb crunchgen ctags genassym gencat hexdump join \ 66 ${LINT_BITS} \ 67 lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \ 68 uudecode m4 \ 69 .WAIT texinfo \ 70 .WAIT yacc \ 71 .WAIT awk \ 72 .WAIT tic \ 73 .WAIT lex \ 74 .WAIT pax \ 75 .WAIT ${TOOLCHAIN_BITS} \ 76 ${DTRACE_BITS} \ 77 asn1_compile cat cksum compile_et config db \ 78 file lint1 slc \ 79 makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 80 .WAIT disklabel \ 81 .WAIT paxctl \ 82 .WAIT fdisk \ 83 .WAIT installboot \ 84 pwd_mkdb stat strfile sunlabel zic 85 86 .if ${MKLLVM} != "no" 87 SUBDIR+= \ 88 llvm .WAIT \ 89 llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 90 llvm-tblgen llvm-clang-tblgen .WAIT \ 91 llvm-include .WAIT \ 92 llvm-lib .WAIT \ 93 llvm-clang 94 .endif 95 96 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 97 . if ${MKGROFF} != "no" 98 SUBDIR+= groff 99 . endif 100 SUBDIR+= mandoc 101 .endif 102 103 .if ${MKMAINTAINERTOOLS:Uno} != "no" 104 SUBDIR+= autoconf .WAIT gettext 105 .endif 106 107 .if ${USE_PIGZGZIP} != "no" 108 SUBDIR+= pigz 109 .endif 110 111 .if ${MACHINE} == "hp700" 112 SUBDIR+= hp700-mkboot 113 .endif 114 115 .if ${MACHINE} == "ibmnws" 116 SUBDIR+= ibmnws-ncdcs 117 .endif 118 119 .if ${MACHINE} == "macppc" 120 SUBDIR+= macppc-fixcoff 121 .endif 122 123 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 124 SUBDIR+= powerpc-mkbootimage 125 .endif 126 127 .if ${MACHINE_ARCH} == "m68k" 128 SUBDIR+= m68k-elf2aout 129 .endif 130 131 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 132 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 133 SUBDIR+= mips-elf2ecoff 134 .endif 135 136 .if (${MACHINE} == "sgimips") 137 SUBDIR+= sgivol 138 .endif 139 140 .if ${MACHINE} == "acorn32" 141 SUBDIR+= sparkcrc 142 .endif 143 144 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 145 SUBDIR+= fgen 146 .endif 147 148 .if ${MACHINE} == "amiga" 149 SUBDIR+= amiga-elf2bb 150 SUBDIR+= amiga-txlt 151 .endif 152 153 .if ${MACHINE} == "hp300" 154 SUBDIR+= hp300-mkboot 155 .endif 156 157 .if ${MACHINE} == "evbarm" 158 SUBDIR+= elftosb 159 .endif 160 161 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 162 ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 163 SUBDIR+= mkubootimage 164 .endif 165 166 check_MKTOOLS: .PHONY .NOTMAIN 167 .if ${MKTOOLS:Uyes} == "no" 168 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 169 @echo '*** updating your host toolchain. This should be used only as a' 170 @echo '*** temporary workaround for toolchain problems, as it will result' 171 @echo '*** in version skew and build errors over time!' 172 .endif 173 174 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 175 realall realdepend install: check_MKTOOLS 176 177 .for dir in ${SUBDIR:N.WAIT} 178 all-${dir} depend-${dir} dependall-${dir} install-${dir}: 179 @true 180 .endfor 181 .endif # } 182 183 .include <bsd.subdir.mk> 184 .include <bsd.buildinstall.mk> 185 .include <bsd.obj.mk> 186 187 .if !defined(PREVIOUSTOOLDIR) 188 . if exists(PREVIOUSTOOLDIR) 189 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 190 . else 191 PREVIOUSTOOLDIR= 192 . endif 193 .endif 194 195 CLEANFILES+= PREVIOUSTOOLDIR 196 197 realall realdepend: .MAKE 198 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 199 @echo "*** WARNING: TOOLDIR has moved?" 200 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 201 @echo "*** != TOOLDIR '${TOOLDIR}'" 202 @echo "*** Cleaning mis-matched tools" 203 rm -f PREVIOUSTOOLDIR 204 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 205 .endif 206 echo ${TOOLDIR} >PREVIOUSTOOLDIR 207 208 cleandir: 209 rm -f ${CLEANFILES} 210