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