Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.166
      1 #	$NetBSD: Makefile,v 1.166 2013/01/31 15:22:50 pooka 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 # TOOLDIR must be valid, unless MKTOOLS=no
     10 .if ${MKTOOLS:Uyes} != "no"
     11 .if "${TOOLDIR}" == ""
     12 .error "TOOLDIR is undefined or empty"
     13 .elif "${TOOLDIR:tW:M/*}" == ""
     14 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
     15 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
     16 #.error "TOOLDIR does not exist: ${TOOLDIR}"
     17 .endif
     18 .endif # MKTOOLS != no
     19 
     20 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
     21 # for building rump kernels and the hypervisor.  It is typically used
     22 # when building rump kernels targeted for non-NetBSD systems (via
     23 # buildrump.sh), and should not be set for a regular "make build".
     24 TOOLS_BUILDRUMP?=no
     25 
     26 .if ${TOOLCHAIN_MISSING} == "no"
     27 .if defined(HAVE_GCC)
     28 TOOLCHAIN_BITS= gmake .WAIT
     29 .endif
     30 
     31 .if defined(HAVE_GCC)
     32 .if ${HAVE_GCC} >= 45
     33 TOOLCHAIN_BITS+= gmp .WAIT
     34 TOOLCHAIN_BITS+= mpfr .WAIT
     35 TOOLCHAIN_BITS+= mpc .WAIT
     36 .endif
     37 .endif
     38 .endif
     39 
     40 .if ${TOOLCHAIN_MISSING} == "no"
     41 TOOLCHAIN_BITS+= binutils .WAIT
     42 .endif
     43 
     44 .if defined(HAVE_GCC)
     45 .if ${TOOLCHAIN_MISSING} == "no"
     46 TOOLCHAIN_BITS+= gcc
     47 .  if ${MKCROSSGDB:Uno} != "no"
     48 TOOLCHAIN_BITS+= gdb
     49 .  endif
     50 TOOLCHAIN_BITS+= .WAIT
     51 .endif
     52 .endif
     53 
     54 .if defined(HAVE_PCC)
     55 .if ${TOOLCHAIN_MISSING} == "no"
     56 TOOLCHAIN_BITS+= pcc
     57 .endif
     58 .endif
     59 
     60 .if ${TOOLCHAIN_MISSING} == "no"
     61 # XXX Eventually, we want to be able to build dbsym and mdsetimage
     62 # XXX if EXTERNAL_TOOLCHAIN is set.
     63 TOOLCHAIN_BITS+= dbsym mdsetimage
     64 .endif
     65 
     66 DTRACE_BITS=
     67 .if ${MKDTRACE} != "no"
     68 DTRACE_BITS+= .WAIT libelf
     69 DTRACE_BITS+= .WAIT libdwarf
     70 DTRACE_BITS+= .WAIT libctf
     71 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     72 .endif
     73 
     74 LINT_BITS=
     75 .if ${MKLINT} != "no"
     76 LINT_BITS= lint lint2
     77 .endif
     78 
     79 # All of host-mkdep, compat, and binstall are needed before anything
     80 # else.  Within this group, they must be built in a specific order, and
     81 # all of them must be built before any of them is installed.  They may
     82 # be installed in any order.  This can't be expressed using the .WAIT
     83 # notation inside the SUBDIR list.
     84 #
     85 # XXX .ORDER does not work when multiple targets are passed on the
     86 # make command line without "-j", so use dependencies in addition to .ORDER.
     87 #
     88 .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
     89 .if make(dependall-host-mkdep) && make(dependall-compat)
     90 dependall-compat: dependall-host-mkdep
     91 .endif
     92 .if make(dependall-compat) && make(dependall-binstall)
     93 dependall-binstall: dependall-compat
     94 .endif
     95 
     96 # Dependencies in SUBDIR below ordered to maximize parallel ability.
     97 # See above for special treatment for host-mkdep, compat, and binstall.
     98 #
     99 SUBDIR=	host-mkdep compat binstall \
    100 	.WAIT mktemp .WAIT sed .WAIT
    101 .if ${TOOLS_BUILDRUMP} == "no"
    102 SUBDIR+= cap_mkdb crunchgen ctags genassym gencat hexdump \
    103 		${LINT_BITS} \
    104 		makewhatis mtree nbperf .WAIT rpcgen uudecode
    105 .endif
    106 
    107 SUBDIR+= join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
    108 
    109 .if ${TOOLS_BUILDRUMP} == "no"
    110 SUBDIR += .WAIT texinfo \
    111 	.WAIT tic \
    112 	.WAIT pax \
    113 	.WAIT ${TOOLCHAIN_BITS} \
    114 	${DTRACE_BITS} \
    115 		asn1_compile cat cksum compile_et db \
    116 		file lint1 slc \
    117 		makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
    118 		.WAIT disklabel \
    119 		.WAIT paxctl \
    120 		.WAIT fdisk \
    121 		.WAIT installboot \
    122 		pwd_mkdb stat strfile sunlabel zic
    123 .endif
    124 SUBDIR+= .WAIT config
    125 
    126 .if ${MKLLVM} != "no"
    127 SUBDIR+= \
    128 	llvm .WAIT \
    129 	llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
    130 	llvm-tblgen llvm-clang-tblgen .WAIT \
    131 	llvm-include .WAIT \
    132 	llvm-lib .WAIT \
    133 	llvm-clang
    134 .endif
    135 
    136 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    137 .  if ${MKGROFF} != "no"
    138 SUBDIR+=	groff
    139 .  endif
    140 SUBDIR+=	mandoc
    141 .endif
    142 
    143 .if ${TOOLS_BUILDRUMP} == "no"
    144 
    145 .if ${MKMAINTAINERTOOLS:Uno} != "no"
    146 SUBDIR+=	autoconf .WAIT gettext
    147 .endif
    148 
    149 .if ${USE_PIGZGZIP} != "no"
    150 SUBDIR+=	pigz
    151 .endif
    152 
    153 .if ${MACHINE} == "hp700"
    154 SUBDIR+=	hp700-mkboot
    155 .endif
    156 
    157 .if ${MACHINE} == "ibmnws"
    158 SUBDIR+=	ibmnws-ncdcs
    159 .endif
    160 
    161 .if ${MACHINE} == "macppc"
    162 SUBDIR+=	macppc-fixcoff
    163 .endif
    164 
    165 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    166 SUBDIR+=	powerpc-mkbootimage
    167 .endif
    168 
    169 .if ${MACHINE_ARCH} == "m68k"
    170 SUBDIR+=	m68k-elf2aout
    171 .endif
    172 
    173 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    174      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
    175 SUBDIR+=	mips-elf2ecoff
    176 .endif
    177 
    178 .if (${MACHINE} == "sgimips")
    179 SUBDIR+=	sgivol
    180 .endif
    181 
    182 .if ${MACHINE} == "acorn32"
    183 SUBDIR+=	sparkcrc
    184 .endif
    185 
    186 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    187 SUBDIR+=	fgen
    188 .endif
    189 
    190 .if ${MACHINE} == "amiga"
    191 SUBDIR+=	amiga-elf2bb
    192 SUBDIR+=	amiga-txlt
    193 .endif
    194 
    195 .if ${MACHINE} == "hp300"
    196 SUBDIR+=	hp300-mkboot
    197 .endif
    198 
    199 .if ${MACHINE} == "evbarm" && ${MACHINE_ARCH} == "arm"
    200 SUBDIR+=	elftosb
    201 .endif
    202 
    203 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    204     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    205 SUBDIR+=	mkubootimage
    206 .endif
    207 
    208 .endif # TOOLCHAIN_BUILDRUMP
    209 
    210 check_MKTOOLS: .PHONY .NOTMAIN
    211 .if ${MKTOOLS:Uyes} == "no"
    212 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    213 	@echo '*** updating your host toolchain.  This should be used only as a'
    214 	@echo '*** temporary workaround for toolchain problems, as it will result'
    215 	@echo '*** in version skew and build errors over time!'
    216 .endif
    217 
    218 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    219 SUBDIR= # empty
    220 realall realdepend install: check_MKTOOLS
    221 .endif							# }
    222 
    223 .include <bsd.subdir.mk>
    224 .include <bsd.buildinstall.mk>
    225 .include <bsd.obj.mk>
    226 
    227 .if !defined(PREVIOUSTOOLDIR)
    228 .  if exists(PREVIOUSTOOLDIR)
    229 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    230 .  else
    231 PREVIOUSTOOLDIR=
    232 .  endif
    233 .endif
    234 
    235 CLEANFILES+=	PREVIOUSTOOLDIR
    236 
    237 realall realdepend: .MAKE
    238 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    239 	@echo "*** WARNING: TOOLDIR has moved?"
    240 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    241 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    242 	@echo "*** Cleaning mis-matched tools"
    243 	rm -f PREVIOUSTOOLDIR
    244 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    245 .endif
    246 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    247 
    248 cleandir:
    249 	rm -f ${CLEANFILES}
    250