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