Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.146
      1 #	$NetBSD: Makefile,v 1.146 2011/06/21 02:15:41 mrg Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 .if defined(HAVE_GCC)
      6 TOOLCHAIN_BITS= gmake .WAIT
      7 .if ${TOOLCHAIN_MISSING} == "no"
      8 .if ${HAVE_GCC} >= 45
      9 TOOLCHAIN_BITS+= gmp .WAIT
     10 TOOLCHAIN_BITS+= mpfr .WAIT
     11 TOOLCHAIN_BITS+= mpc .WAIT
     12 .endif
     13 TOOLCHAIN_BITS+= binutils .WAIT
     14 TOOLCHAIN_BITS+= gcc
     15 .  if ${MKCROSSGDB:Uno} != "no"
     16 TOOLCHAIN_BITS+= gdb
     17 .  endif
     18 TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
     19 # XXX Eventually, we want to be able to build dbsym and mdsetimage
     20 # XXX if EXTERNAL_TOOLCHAIN is set.
     21 .endif
     22 .endif
     23 
     24 .if defined(HAVE_PCC)
     25 TOOLCHAIN_BITS= gmake .WAIT
     26 .if ${TOOLCHAIN_MISSING} == "no"
     27 TOOLCHAIN_BITS+= binutils .WAIT
     28 TOOLCHAIN_BITS+= pcc
     29 .endif
     30 TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
     31 .endif
     32 
     33 DTRACE_BITS=
     34 .if ${MKDTRACE} != "no"
     35 DTRACE_BITS+= .WAIT libelf
     36 DTRACE_BITS+= .WAIT libdwarf
     37 DTRACE_BITS+= .WAIT libctf 
     38 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     39 .endif
     40 
     41 LINT_BITS=
     42 .if ${MKLINT} != "no"
     43 LINT_BITS= lint lint2
     44 .endif
     45 
     46 # Dependencies in SUBDIR below ordered to maximize parallel ability.
     47 SUBDIR=	host-mkdep .WAIT compat .WAIT \
     48 	binstall .WAIT mktemp .WAIT sed .WAIT \
     49 		cap_mkdb crunchgen ctags genassym gencat hexdump join \
     50 		${LINT_BITS} \
     51 		lorder makewhatis mkdep mtree rpcgen tic tsort \
     52 		uudecode m4 \
     53 	.WAIT texinfo \
     54 	.WAIT yacc \
     55 	.WAIT awk \
     56 	.WAIT lex \
     57 	.WAIT pax \
     58 	.WAIT ${TOOLCHAIN_BITS} \
     59 	${DTRACE_BITS} \
     60 		asn1_compile cat cksum compile_et config db \
     61 		file lint1 slc \
     62 		makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
     63 		.WAIT disklabel \
     64 		.WAIT paxctl \
     65 		.WAIT fdisk \
     66 		.WAIT installboot \
     67 		pwd_mkdb stat strfile sunlabel zic
     68 
     69 .if ${MKLLVM} != "no"
     70 SUBDIR+= \
     71 	llvm .WAIT \
     72 	llvm-lib/libLLVMSupport .WAIT \
     73 	llvm-tblgen .WAIT \
     74 	llvm-include .WAIT \
     75 	llvm-lib .WAIT \
     76 	llvm-clang
     77 .endif
     78 
     79 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
     80 .  if ${MKGROFF} != "no"
     81 SUBDIR+=	groff
     82 .  endif
     83 SUBDIR+=	mandoc
     84 .endif
     85 
     86 .if ${MKMAINTAINERTOOLS:Uno} != "no"
     87 SUBDIR+=	autoconf .WAIT gettext
     88 .endif
     89 
     90 .if ${USE_PIGZGZIP} != "no"
     91 SUBDIR+=	pigz
     92 .endif
     93 
     94 .if ${MACHINE} == "hp700"
     95 SUBDIR+=	hp700-mkboot
     96 .endif
     97 
     98 .if ${MACHINE} == "ibmnws"
     99 SUBDIR+=	ibmnws-ncdcs
    100 .endif
    101 
    102 .if ${MACHINE} == "macppc"
    103 SUBDIR+=	macppc-fixcoff
    104 .endif
    105 
    106 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    107 SUBDIR+=	powerpc-mkbootimage
    108 .endif
    109 
    110 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
    111 SUBDIR+=	mips-elf2ecoff
    112 .endif
    113 
    114 .if (${MACHINE} == "sgimips")
    115 SUBDIR+=	sgivol
    116 .endif
    117 
    118 .if ${MACHINE} == "acorn32"
    119 SUBDIR+=	sparkcrc
    120 .endif
    121 
    122 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    123 SUBDIR+=	fgen
    124 .endif
    125 
    126 .if ${MACHINE} == "amiga"
    127 SUBDIR+=	amiga-elf2bb
    128 SUBDIR+=	amiga-txlt
    129 .endif
    130 
    131 .if ${MACHINE} == "hp300"
    132 SUBDIR+=	hp300-mkboot
    133 .endif
    134 
    135 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    136     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    137 SUBDIR+=	mkubootimage
    138 .endif
    139 
    140 check_MKTOOLS: .PHONY .NOTMAIN
    141 .if ${MKTOOLS:Uyes} == "no"
    142 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    143 	@echo '*** updating your host toolchain.  This should be used only as a'
    144 	@echo '*** temporary workaround for toolchain problems, as it will result'
    145 	@echo '*** in version skew and build errors over time!'
    146 .endif
    147 
    148 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    149 realall realdepend install: check_MKTOOLS
    150 
    151 .for dir in ${SUBDIR:N.WAIT}
    152 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
    153 	@true
    154 .endfor
    155 .endif							# }
    156 
    157 .include <bsd.subdir.mk>
    158 .include <bsd.obj.mk>
    159 
    160 .if !defined(PREVIOUSTOOLDIR)
    161 .  if exists(PREVIOUSTOOLDIR)
    162 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    163 .  else
    164 PREVIOUSTOOLDIR=	
    165 .  endif
    166 .endif
    167 
    168 CLEANFILES+=	PREVIOUSTOOLDIR
    169 
    170 realall realdepend: .MAKE
    171 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    172 	@echo "*** WARNING: TOOLDIR has moved?"
    173 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    174 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    175 	@echo "*** Cleaning mis-matched tools"
    176 	rm -f PREVIOUSTOOLDIR
    177 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    178 .endif
    179 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    180 
    181 # For each .WAIT point, make sure the immediately preceding target is
    182 # installed before building anything after that point.
    183 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
    184 # install of 'b', but not the install of 'a'.)
    185 #
    186 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
    187 # to achieve this. These targets look like:
    188 #	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
    189 #	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
    190 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
    191 # places corresponding to the .WAITs in our $SUBDIR variable.
    192 #
    193 # Also, since we're now mixing `install' with `all' and `depend' targets
    194 # an order relationship between those in each individual subdirectory
    195 # must be established.
    196 #
    197 _deps:=
    198 _prev:=
    199 
    200 .for d in ${SUBDIR}				# {
    201 _this:=		${d}
    202 
    203 .if ${_this} == ".WAIT"				# {
    204 
    205 # setup dependency to apply to all/depend targets in the next group
    206 _deps:=		${_deps} ${_prev:S/^/install-/}
    207 
    208 # if we're building *only* individual targets (i.e. "dependall-yacc"),
    209 # make sure prerequisite tools build before installing
    210 # XXX: dsl: this is likely to generate a dependency loop since there is
    211 # a .ORDER releation between the nodes as well.
    212 .if !make(all) && !make(dependall) && !make(install)
    213 install-${_prev}: dependall-${_prev}
    214 .endif
    215 
    216 .else # ${_this} != ".WAIT"			# } {
    217 
    218 # order depend/all/install targets for ${d} subdir.
    219 .ORDER: depend-${d} all-${d} dependall-${d} install-${d}
    220 
    221 # prevent cleandir in real{all,depend} from interfering with subdir makes
    222 .ORDER: realdepend dependall-${d}
    223 .ORDER: realdepend depend-${d}
    224 .ORDER: realall all-${d}
    225 
    226 # make all/depend-${d} dependent on list of install targets
    227 depend-${d} all-${d} dependall-${d}: ${_deps}
    228 
    229 .endif # ${_this} != ".WAIT"			# }
    230 
    231 # stash current name in case the next entry is .WAIT
    232 _prev:=		${d}
    233 .endfor						# }
    234 
    235 cleandir:
    236 	rm -f ${CLEANFILES}
    237