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