Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.66
      1  1.66     lukem #	$NetBSD: Makefile,v 1.66 2003/07/16 12:57:57 lukem Exp $
      2   1.1        tv 
      3   1.3        tv .include <bsd.own.mk>
      4   1.3        tv 
      5  1.60   thorpej .if ${TOOLCHAIN_MISSING} != "yes"
      6  1.45   thorpej TOOLCHAIN_BITS= toolchain .WAIT dbsym mdsetimage
      7  1.58   thorpej # XXX Eventually, we want to be able to build dbsym and mdsetimage
      8  1.58   thorpej # XXX if EXTERNAL_TOOLCHAIN is set.
      9  1.31        tv .endif
     10  1.31        tv 
     11  1.16        tv # Dependencies in SUBDIR below ordered to maximize parallel ability.
     12  1.50     lukem .if !defined(NOSUBDIR)					# {
     13  1.50     lukem 
     14  1.29        tv SUBDIR=	host-mkdep .WAIT compat .WAIT \
     15  1.57     chris 	binstall .WAIT mktemp .WAIT \
     16  1.62   thorpej 		cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \
     17  1.32        tv 		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
     18  1.32        tv 	texinfo .WAIT \
     19  1.16        tv 	yacc .WAIT \
     20  1.16        tv 	lex .WAIT \
     21  1.32        tv 	${TOOLCHAIN_BITS} \
     22  1.64     lukem 		asn1_compile cat cksum compile_et config db file installboot \
     23  1.65  tshiozak 		lint1 makefs menuc mklocale mkcsmapper mkesdb msgc pax \
     24  1.65  tshiozak 		pwd_mkdb sunlabel zic
     25  1.39        tv 
     26  1.39        tv .if ${MKMAN} != "no"
     27  1.39        tv SUBDIR+=	groff
     28  1.39        tv .endif
     29  1.22        tv 
     30  1.22        tv .if ${MKMAINTAINERTOOLS:Uno} != "no"
     31  1.38        tv SUBDIR+=	autoconf gettext
     32  1.48    kleink .endif
     33  1.48    kleink 
     34  1.48    kleink .if ${MACHINE} == prep
     35  1.48    kleink SUBDIR+=	prep-mkbootimage
     36  1.22        tv .endif
     37  1.37  gmcgarry 
     38  1.37  gmcgarry .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
     39  1.37  gmcgarry SUBDIR+=	mips-elf2ecoff
     40  1.51     bjh21 .endif
     41  1.51     bjh21 
     42  1.51     bjh21 .if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
     43  1.51     bjh21 SUBDIR+=	fgen
     44  1.37  gmcgarry .endif
     45  1.37  gmcgarry 
     46  1.50     lukem .endif	# ! NOSUBDIR					# }
     47  1.17        tv 
     48  1.66     lukem check_MKTOOLS: .PHONY .NOTMAIN
     49  1.19       jmc .if ${MKTOOLS:Uyes} == "no"
     50  1.17        tv 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
     51  1.17        tv 	@echo '*** updating your host toolchain.  This should be used only as a'
     52  1.17        tv 	@echo '*** temporary workaround for toolchain problems, as it will result'
     53  1.23       wiz 	@echo '*** in version skew and build errors over time!'
     54  1.18       jmc .endif
     55  1.17        tv 
     56  1.66     lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
     57  1.66     lukem realall install: check_MKTOOLS
     58  1.66     lukem 
     59  1.17        tv .for dir in ${SUBDIR:N.WAIT}
     60  1.17        tv all-${dir} depend-${dir} dependall-${dir} install-${dir}:
     61  1.17        tv 	@true
     62  1.17        tv .endfor
     63  1.66     lukem .endif							# }
     64   1.1        tv 
     65   1.1        tv .include <bsd.subdir.mk>
     66  1.11        tv .include <bsd.obj.mk>
     67  1.16        tv 
     68  1.66     lukem .if exists(PREVIOUSTOOLDIR)
     69  1.66     lukem PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
     70  1.66     lukem .else
     71  1.66     lukem PREVIOUSTOOLDIR=	
     72  1.66     lukem .endif
     73  1.66     lukem 
     74  1.66     lukem CLEANFILES+=	PREVIOUSTOOLDIR
     75  1.66     lukem 
     76  1.66     lukem realall:
     77  1.66     lukem .if (${PREVIOUSTOOLDIR} != ${TOOLDIR})
     78  1.66     lukem 	@echo "*** WARNING: TOOLDIR has moved?"
     79  1.66     lukem 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
     80  1.66     lukem 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
     81  1.66     lukem 	@echo "*** Cleaning mis-matched tools"
     82  1.66     lukem 	rm -f PREVIOUSTOOLDIR
     83  1.66     lukem 	${MAKE} cleandir
     84  1.66     lukem .endif
     85  1.66     lukem 	echo ${TOOLDIR} > PREVIOUSTOOLDIR
     86  1.66     lukem 
     87  1.40        tv # For each .WAIT point, make sure the immediately preceding target is
     88  1.40        tv # installed before building anything after that point.
     89  1.36        pk #
     90  1.36        pk # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
     91  1.36        pk # to achieve this. These targets look like:
     92  1.36        pk #	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
     93  1.36        pk #	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
     94  1.36        pk # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
     95  1.36        pk # places corresponding to the .WAITs in our $SUBDIR variable.
     96  1.36        pk #
     97  1.36        pk # Also, since we're now mixing `install' with `all' and `depend' targets
     98  1.36        pk # an order relationship between those in each individual subdirectory
     99  1.36        pk # must be established.
    100  1.36        pk #
    101  1.40        tv _deps:=
    102  1.40        tv _prev:=
    103  1.40        tv 
    104  1.16        tv .for d in ${SUBDIR}
    105  1.16        tv _this:=		${d}
    106  1.40        tv 
    107  1.16        tv .if ${_this} == ".WAIT"
    108  1.36        pk 
    109  1.36        pk # setup dependency to apply to all/depend targets in the next group
    110  1.40        tv _deps:=		${_deps} ${_prev:S/^/install-/}
    111  1.40        tv 
    112  1.40        tv # if we're building *only* individual targets (i.e. "dependall-yacc"),
    113  1.40        tv # make sure prerequisite tools build before installing
    114  1.40        tv .if !make(all) && !make(dependall)
    115  1.40        tv install-${_prev}: dependall-${_prev}
    116  1.40        tv .endif
    117  1.36        pk 
    118  1.16        tv .else
    119  1.36        pk 
    120  1.36        pk # order depend/all/install targets for ${d} subdir.  Note the additional
    121  1.36        pk # .WAIT to achieve "closure" of the predecessor/successor relationships.
    122  1.36        pk .ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
    123  1.40        tv 
    124  1.40        tv # make all/depend-${d} dependent on list of install targets
    125  1.40        tv depend-${d} all-${d} dependall-${d}: ${_deps}
    126  1.36        pk 
    127  1.16        tv .endif
    128  1.40        tv 
    129  1.40        tv # stash current name in case the next entry is .WAIT
    130  1.40        tv _prev:=		${d}
    131  1.16        tv .endfor
    132