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