1 1.164 apb # $NetBSD: Makefile,v 1.164 2012/12/02 12:10:43 apb Exp $ 2 1.1 tv 3 1.3 tv .include <bsd.own.mk> 4 1.3 tv 5 1.159 joerg # Make sure that the ordered build/install processing applies when using 6 1.159 joerg # plain make. 7 1.159 joerg .MAIN: build_install 8 1.159 joerg 9 1.164 apb # TOOLDIR must be valid, unless MKTOOLS=no 10 1.164 apb .if ${MKTOOLS:Uyes} != "no" 11 1.164 apb .if "${TOOLDIR}" == "" 12 1.164 apb .error "TOOLDIR is undefined or empty" 13 1.164 apb .elif "${TOOLDIR:tW:M/*}" == "" 14 1.164 apb .error "TOOLDIR is not an absolute path: ${TOOLDIR}" 15 1.164 apb #.elif !exists(TOOLDIR) # XXX .exists fails for directories 16 1.164 apb #.error "TOOLDIR does not exist: ${TOOLDIR}" 17 1.164 apb .endif 18 1.164 apb .endif # MKTOOLS != no 19 1.164 apb 20 1.160 pooka .if ${TOOLCHAIN_MISSING} == "no" 21 1.160 pooka .if defined(HAVE_GCC) 22 1.94 jmc TOOLCHAIN_BITS= gmake .WAIT 23 1.156 joerg .endif 24 1.156 joerg 25 1.156 joerg .if defined(HAVE_GCC) 26 1.146 mrg .if ${HAVE_GCC} >= 45 27 1.146 mrg TOOLCHAIN_BITS+= gmp .WAIT 28 1.146 mrg TOOLCHAIN_BITS+= mpfr .WAIT 29 1.146 mrg TOOLCHAIN_BITS+= mpc .WAIT 30 1.94 jmc .endif 31 1.156 joerg .endif 32 1.156 joerg .endif 33 1.156 joerg 34 1.156 joerg .if ${TOOLCHAIN_MISSING} == "no" 35 1.94 jmc TOOLCHAIN_BITS+= binutils .WAIT 36 1.156 joerg .endif 37 1.156 joerg 38 1.156 joerg .if defined(HAVE_GCC) 39 1.156 joerg .if ${TOOLCHAIN_MISSING} == "no" 40 1.77 mrg TOOLCHAIN_BITS+= gcc 41 1.97 mrg . if ${MKCROSSGDB:Uno} != "no" 42 1.74 cl TOOLCHAIN_BITS+= gdb 43 1.70 mrg . endif 44 1.156 joerg TOOLCHAIN_BITS+= .WAIT 45 1.31 tv .endif 46 1.118 gmcgarry .endif 47 1.118 gmcgarry 48 1.118 gmcgarry .if defined(HAVE_PCC) 49 1.118 gmcgarry .if ${TOOLCHAIN_MISSING} == "no" 50 1.118 gmcgarry TOOLCHAIN_BITS+= pcc 51 1.118 gmcgarry .endif 52 1.118 gmcgarry .endif 53 1.31 tv 54 1.157 pooka .if ${TOOLCHAIN_MISSING} == "no" 55 1.157 pooka # XXX Eventually, we want to be able to build dbsym and mdsetimage 56 1.157 pooka # XXX if EXTERNAL_TOOLCHAIN is set. 57 1.156 joerg TOOLCHAIN_BITS+= dbsym mdsetimage 58 1.157 pooka .endif 59 1.156 joerg 60 1.137 darran DTRACE_BITS= 61 1.137 darran .if ${MKDTRACE} != "no" 62 1.137 darran DTRACE_BITS+= .WAIT libelf 63 1.137 darran DTRACE_BITS+= .WAIT libdwarf 64 1.162 apb DTRACE_BITS+= .WAIT libctf 65 1.137 darran DTRACE_BITS+= .WAIT ctfconvert ctfmerge 66 1.137 darran .endif 67 1.137 darran 68 1.99 mrg LINT_BITS= 69 1.99 mrg .if ${MKLINT} != "no" 70 1.99 mrg LINT_BITS= lint lint2 71 1.99 mrg .endif 72 1.99 mrg 73 1.16 tv # Dependencies in SUBDIR below ordered to maximize parallel ability. 74 1.29 tv SUBDIR= host-mkdep .WAIT compat .WAIT \ 75 1.124 apb binstall .WAIT mktemp .WAIT sed .WAIT \ 76 1.113 apb cap_mkdb crunchgen ctags genassym gencat hexdump join \ 77 1.99 mrg ${LINT_BITS} \ 78 1.152 yamt lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \ 79 1.134 roy uudecode m4 \ 80 1.132 mrg .WAIT texinfo \ 81 1.132 mrg .WAIT yacc \ 82 1.132 mrg .WAIT awk \ 83 1.153 christos .WAIT tic \ 84 1.132 mrg .WAIT lex \ 85 1.132 mrg .WAIT pax \ 86 1.132 mrg .WAIT ${TOOLCHAIN_BITS} \ 87 1.137 darran ${DTRACE_BITS} \ 88 1.138 jmmv asn1_compile cat cksum compile_et config db \ 89 1.145 elric file lint1 slc \ 90 1.144 riz makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 91 1.132 mrg .WAIT disklabel \ 92 1.132 mrg .WAIT paxctl \ 93 1.132 mrg .WAIT fdisk \ 94 1.132 mrg .WAIT installboot \ 95 1.154 njoly pwd_mkdb stat strfile sunlabel zic 96 1.39 tv 97 1.142 joerg .if ${MKLLVM} != "no" 98 1.142 joerg SUBDIR+= \ 99 1.142 joerg llvm .WAIT \ 100 1.149 joerg llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 101 1.159 joerg llvm-tblgen llvm-clang-tblgen .WAIT \ 102 1.142 joerg llvm-include .WAIT \ 103 1.142 joerg llvm-lib .WAIT \ 104 1.142 joerg llvm-clang 105 1.142 joerg .endif 106 1.142 joerg 107 1.121 dyoung .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 108 1.136 joerg . if ${MKGROFF} != "no" 109 1.39 tv SUBDIR+= groff 110 1.136 joerg . endif 111 1.128 joerg SUBDIR+= mandoc 112 1.39 tv .endif 113 1.22 tv 114 1.22 tv .if ${MKMAINTAINERTOOLS:Uno} != "no" 115 1.103 lukem SUBDIR+= autoconf .WAIT gettext 116 1.72 matt .endif 117 1.72 matt 118 1.140 mrg .if ${USE_PIGZGZIP} != "no" 119 1.140 mrg SUBDIR+= pigz 120 1.140 mrg .endif 121 1.140 mrg 122 1.86 jmc .if ${MACHINE} == "hp700" 123 1.83 skrll SUBDIR+= hp700-mkboot 124 1.83 skrll .endif 125 1.83 skrll 126 1.86 jmc .if ${MACHINE} == "ibmnws" 127 1.72 matt SUBDIR+= ibmnws-ncdcs 128 1.79 matt .endif 129 1.79 matt 130 1.86 jmc .if ${MACHINE} == "macppc" 131 1.79 matt SUBDIR+= macppc-fixcoff 132 1.48 kleink .endif 133 1.48 kleink 134 1.116 garbled .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 135 1.115 garbled SUBDIR+= powerpc-mkbootimage 136 1.22 tv .endif 137 1.37 gmcgarry 138 1.148 tsutsui .if ${MACHINE_ARCH} == "m68k" 139 1.148 tsutsui SUBDIR+= m68k-elf2aout 140 1.148 tsutsui .endif 141 1.148 tsutsui 142 1.147 mrg .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 143 1.147 mrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 144 1.37 gmcgarry SUBDIR+= mips-elf2ecoff 145 1.76 sekiya .endif 146 1.76 sekiya 147 1.76 sekiya .if (${MACHINE} == "sgimips") 148 1.76 sekiya SUBDIR+= sgivol 149 1.51 bjh21 .endif 150 1.51 bjh21 151 1.82 abs .if ${MACHINE} == "acorn32" 152 1.82 abs SUBDIR+= sparkcrc 153 1.82 abs .endif 154 1.82 abs 155 1.125 abs .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 156 1.51 bjh21 SUBDIR+= fgen 157 1.37 gmcgarry .endif 158 1.37 gmcgarry 159 1.85 jmc .if ${MACHINE} == "amiga" 160 1.85 jmc SUBDIR+= amiga-elf2bb 161 1.85 jmc SUBDIR+= amiga-txlt 162 1.85 jmc .endif 163 1.85 jmc 164 1.86 jmc .if ${MACHINE} == "hp300" 165 1.86 jmc SUBDIR+= hp300-mkboot 166 1.86 jmc .endif 167 1.86 jmc 168 1.161 jkunz .if ${MACHINE} == "evbarm" && ${MACHINE_ARCH} == "arm" 169 1.158 jkunz SUBDIR+= elftosb 170 1.158 jkunz .endif 171 1.158 jkunz 172 1.143 phx .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 173 1.143 phx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 174 1.139 jmcneill SUBDIR+= mkubootimage 175 1.139 jmcneill .endif 176 1.139 jmcneill 177 1.66 lukem check_MKTOOLS: .PHONY .NOTMAIN 178 1.19 jmc .if ${MKTOOLS:Uyes} == "no" 179 1.17 tv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 180 1.17 tv @echo '*** updating your host toolchain. This should be used only as a' 181 1.17 tv @echo '*** temporary workaround for toolchain problems, as it will result' 182 1.23 wiz @echo '*** in version skew and build errors over time!' 183 1.18 jmc .endif 184 1.17 tv 185 1.66 lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 186 1.163 apb SUBDIR= # empty 187 1.67 lukem realall realdepend install: check_MKTOOLS 188 1.66 lukem .endif # } 189 1.1 tv 190 1.1 tv .include <bsd.subdir.mk> 191 1.159 joerg .include <bsd.buildinstall.mk> 192 1.11 tv .include <bsd.obj.mk> 193 1.16 tv 194 1.102 tron .if !defined(PREVIOUSTOOLDIR) 195 1.102 tron . if exists(PREVIOUSTOOLDIR) 196 1.66 lukem PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 197 1.102 tron . else 198 1.162 apb PREVIOUSTOOLDIR= 199 1.102 tron . endif 200 1.66 lukem .endif 201 1.66 lukem 202 1.66 lukem CLEANFILES+= PREVIOUSTOOLDIR 203 1.66 lukem 204 1.101 tron realall realdepend: .MAKE 205 1.107 apb .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 206 1.66 lukem @echo "*** WARNING: TOOLDIR has moved?" 207 1.66 lukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 208 1.66 lukem @echo "*** != TOOLDIR '${TOOLDIR}'" 209 1.66 lukem @echo "*** Cleaning mis-matched tools" 210 1.66 lukem rm -f PREVIOUSTOOLDIR 211 1.106 freza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 212 1.66 lukem .endif 213 1.102 tron echo ${TOOLDIR} >PREVIOUSTOOLDIR 214 1.66 lukem 215 1.69 tron cleandir: 216 1.69 tron rm -f ${CLEANFILES} 217