Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.182
      1 #	$NetBSD: Makefile,v 1.182 2015/07/23 08:03:26 mrg 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".
     25 TOOLS_BUILDRUMP?=no
     26 
     27 .if ${TOOLCHAIN_MISSING} == "no"
     28 . if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     29 TOOLCHAIN_BITS= gmake .WAIT
     30 TOOLCHAIN_BITS+= gmp .WAIT
     31 TOOLCHAIN_BITS+= mpfr .WAIT
     32 TOOLCHAIN_BITS+= mpc .WAIT
     33 . endif
     34 .endif
     35 
     36 .if ${TOOLCHAIN_MISSING} == "no"
     37 TOOLCHAIN_BITS+= binutils .WAIT
     38 .endif
     39 
     40 .if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     41 . if ${TOOLCHAIN_MISSING} == "no"
     42 TOOLCHAIN_BITS+= gcc
     43 .  if ${MKCROSSGDB:Uno} != "no" || make(obj)
     44 TOOLCHAIN_BITS+= gdb
     45 .  endif
     46 TOOLCHAIN_BITS+= .WAIT
     47 . endif
     48 .endif
     49 
     50 .if defined(HAVE_PCC)
     51 . if ${TOOLCHAIN_MISSING} == "no"
     52 TOOLCHAIN_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.
     59 TOOLCHAIN_BITS+= dbsym mdsetimage
     60 .endif
     61 
     62 DTRACE_BITS=
     63 .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
     64 DTRACE_BITS+= .WAIT libelf
     65 DTRACE_BITS+= .WAIT libdwarf
     66 DTRACE_BITS+= .WAIT libctf
     67 .endif
     68 .if ${MKCTF} != "no"
     69 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     70 .endif
     71 
     72 LINT_BITS=
     73 .if ${MKLINT} != "no"
     74 LINT_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)
     88 dependall-compat: dependall-host-mkdep
     89 .endif
     90 .if make(dependall-compat) && make(dependall-binstall)
     91 dependall-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 #
     97 SUBDIR=	host-mkdep compat binstall \
     98 	.WAIT mktemp .WAIT sed .WAIT genassym
     99 .if ${TOOLS_BUILDRUMP} == "no"
    100 SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \
    101 		${LINT_BITS} \
    102 		makewhatis mtree nbperf .WAIT uudecode
    103 .endif
    104 
    105 SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
    106 
    107 .if ${TOOLS_BUILDRUMP} == "no"
    108 SUBDIR += .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 gpt \
    117 		.WAIT paxctl \
    118 		.WAIT fdisk \
    119 		.WAIT installboot \
    120 		pwd_mkdb strfile sunlabel vgrind zic
    121 .endif
    122 SUBDIR+= stat .WAIT config
    123 
    124 .if ${MKLLVM} != "no"
    125 SUBDIR+= \
    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"
    133 SUBDIR+=	llvm-lld
    134 . endif
    135 . if ${MKMCLINKER} != "no"
    136 SUBDIR+=	llvm-mcld
    137 . endif
    138 .endif
    139 
    140 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    141 . if ${MKGROFF} != "no"
    142 SUBDIR+=	groff
    143 . endif
    144 SUBDIR+=	mandoc
    145 .endif
    146 
    147 .if ${TOOLS_BUILDRUMP} == "no"
    148 
    149 .if ${MKMAINTAINERTOOLS:Uno} != "no"
    150 SUBDIR+=	autoconf .WAIT gettext
    151 .endif
    152 
    153 .if ${USE_PIGZGZIP} != "no"
    154 SUBDIR+=	pigz
    155 .endif
    156 
    157 .if ${MACHINE} == "hppa"
    158 SUBDIR+=	hppa-mkboot
    159 .endif
    160 
    161 .if ${MACHINE} == "ibmnws"
    162 SUBDIR+=	ibmnws-ncdcs
    163 .endif
    164 
    165 .if ${MACHINE} == "macppc"
    166 SUBDIR+=	macppc-fixcoff
    167 .endif
    168 
    169 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    170 SUBDIR+=	powerpc-mkbootimage
    171 .endif
    172 
    173 .if ${MACHINE_ARCH} == "m68k"
    174 SUBDIR+=	m68k-elf2aout
    175 .endif
    176 
    177 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    178      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
    179 SUBDIR+=	mips-elf2ecoff
    180 .endif
    181 
    182 .if (${MACHINE} == "sgimips")
    183 SUBDIR+=	sgivol
    184 .endif
    185 
    186 .if ${MACHINE} == "acorn32"
    187 SUBDIR+=	sparkcrc
    188 .endif
    189 
    190 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    191 SUBDIR+=	fgen
    192 .endif
    193 
    194 .if ${MACHINE} == "amiga"
    195 SUBDIR+=	amiga-elf2bb
    196 SUBDIR+=	amiga-txlt
    197 .endif
    198 
    199 .if ${MACHINE} == "hp300"
    200 SUBDIR+=	hp300-mkboot
    201 .endif
    202 
    203 .if ${MACHINE} == "evbarm" \
    204     && ${MACHINE_CPU} == "arm" \
    205     && ${TARGET_ENDIANNESS} == "1234"
    206 SUBDIR+=	elftosb
    207 .endif
    208 
    209 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    210     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    211 SUBDIR+=	mkubootimage
    212 .endif
    213 
    214 .if ${MKX11} != "no"
    215 SUBDIR+=	makestrs
    216 SUBDIR+=	makekeys
    217 .endif
    218 
    219 .endif # TOOLCHAIN_BUILDRUMP
    220 
    221 check_MKTOOLS: .PHONY .NOTMAIN
    222 .if ${MKTOOLS:Uyes} == "no"
    223 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    224 	@echo '*** updating your host toolchain.  This should be used only as a'
    225 	@echo '*** temporary workaround for toolchain problems, as it will result'
    226 	@echo '*** in version skew and build errors over time!'
    227 .endif
    228 
    229 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    230 SUBDIR= # empty
    231 realall realdepend install: check_MKTOOLS
    232 .endif							# }
    233 
    234 .include <bsd.subdir.mk>
    235 .include <bsd.buildinstall.mk>
    236 .include <bsd.obj.mk>
    237 
    238 .if !defined(PREVIOUSTOOLDIR)
    239 .  if exists(PREVIOUSTOOLDIR)
    240 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    241 .  else
    242 PREVIOUSTOOLDIR=
    243 .  endif
    244 .endif
    245 
    246 CLEANFILES+=	PREVIOUSTOOLDIR
    247 
    248 realall realdepend: .MAKE
    249 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    250 	@echo "*** WARNING: TOOLDIR has moved?"
    251 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    252 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    253 	@echo "*** Cleaning mis-matched tools"
    254 	rm -f PREVIOUSTOOLDIR
    255 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    256 .endif
    257 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    258 
    259 cleandir:
    260 	rm -f ${CLEANFILES}
    261