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