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