Fix markup. Fix backslashes to surive roff.
[netbsd-mini2440.git] / tools / Makefile
blobd834afcc5631992bdd7b8e9841389627b1be33b6
1 # $NetBSD: Makefile,v 1.128 2009/10/23 22:14:37 joerg Exp $
3 .include <bsd.own.mk>
5 .if defined(HAVE_GCC)
6 .if ${HAVE_GCC} == "4"
7 TOOLCHAIN_BITS= gmake .WAIT
8 .endif
9 .if ${TOOLCHAIN_MISSING} == "no"
10 TOOLCHAIN_BITS+= binutils .WAIT
11 TOOLCHAIN_BITS+= gcc
12 . if ${MKCROSSGDB:Uno} != "no"
13 TOOLCHAIN_BITS+= gdb
14 . endif
15 TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
16 # XXX Eventually, we want to be able to build dbsym and mdsetimage
17 # XXX if EXTERNAL_TOOLCHAIN is set.
18 .endif
19 .endif
21 .if defined(HAVE_PCC)
22 TOOLCHAIN_BITS= gmake .WAIT
23 .if ${TOOLCHAIN_MISSING} == "no"
24 TOOLCHAIN_BITS+= binutils .WAIT
25 TOOLCHAIN_BITS+= pcc
26 .endif
27 TOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
28 .endif
30 LINT_BITS=
31 .if ${MKLINT} != "no"
32 LINT_BITS= lint lint2
33 .endif
35 # Dependencies in SUBDIR below ordered to maximize parallel ability.
36 SUBDIR= host-mkdep .WAIT compat .WAIT \
37 binstall .WAIT mktemp .WAIT sed .WAIT \
38 cap_mkdb crunchgen ctags genassym gencat hexdump join \
39 ${LINT_BITS} \
40 lorder makewhatis mkdep mtree rpcgen tsort uudecode \
41 m4 .WAIT \
42 texinfo .WAIT \
43 yacc .WAIT \
44 awk .WAIT \
45 lex .WAIT \
46 ${TOOLCHAIN_BITS} \
47 asn1_compile atf-compile cat cksum compile_et config db \
48 file lint1 \
49 makefs menuc mkcsmapper mkesdb mklocale mknod msgc \
50 pax .WAIT \
51 disklabel .WAIT \
52 paxctl .WAIT \
53 fdisk .WAIT \
54 installboot .WAIT \
55 pwd_mkdb stat strfile sunlabel zic
57 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
58 SUBDIR+= groff
59 . if ${MKMANDOC} == "yes"
60 SUBDIR+= mandoc
61 . endif
62 .endif
64 .if ${MKMAINTAINERTOOLS:Uno} != "no"
65 SUBDIR+= autoconf .WAIT gettext
66 .endif
68 .if ${MACHINE} == "hp700"
69 SUBDIR+= hp700-mkboot
70 .endif
72 .if ${MACHINE} == "ibmnws"
73 SUBDIR+= ibmnws-ncdcs
74 .endif
76 .if ${MACHINE} == "macppc"
77 SUBDIR+= macppc-fixcoff
78 .endif
80 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
81 SUBDIR+= powerpc-mkbootimage
82 .endif
84 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
85 SUBDIR+= mips-elf2ecoff
86 .endif
88 .if (${MACHINE} == "sgimips")
89 SUBDIR+= sgivol
90 .endif
92 .if ${MACHINE} == "acorn32"
93 SUBDIR+= sparkcrc
94 .endif
96 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
97 SUBDIR+= fgen
98 .endif
100 .if ${MACHINE} == "amiga"
101 SUBDIR+= amiga-elf2bb
102 SUBDIR+= amiga-txlt
103 .endif
105 .if ${MACHINE} == "hp300"
106 SUBDIR+= hp300-mkboot
107 .endif
109 check_MKTOOLS: .PHONY .NOTMAIN
110 .if ${MKTOOLS:Uyes} == "no"
111 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
112 @echo '*** updating your host toolchain. This should be used only as a'
113 @echo '*** temporary workaround for toolchain problems, as it will result'
114 @echo '*** in version skew and build errors over time!'
115 .endif
117 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
118 realall realdepend install: check_MKTOOLS
120 .for dir in ${SUBDIR:N.WAIT}
121 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
122 @true
123 .endfor
124 .endif # }
126 .include <bsd.subdir.mk>
127 .include <bsd.obj.mk>
129 .if !defined(PREVIOUSTOOLDIR)
130 . if exists(PREVIOUSTOOLDIR)
131 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
132 . else
133 PREVIOUSTOOLDIR=
134 . endif
135 .endif
137 CLEANFILES+= PREVIOUSTOOLDIR
139 realall realdepend: .MAKE
140 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
141 @echo "*** WARNING: TOOLDIR has moved?"
142 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
143 @echo "*** != TOOLDIR '${TOOLDIR}'"
144 @echo "*** Cleaning mis-matched tools"
145 rm -f PREVIOUSTOOLDIR
146 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
147 .endif
148 echo ${TOOLDIR} >PREVIOUSTOOLDIR
150 # For each .WAIT point, make sure the immediately preceding target is
151 # installed before building anything after that point.
152 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
153 # install of 'b', but not the install of 'a'.)
155 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
156 # to achieve this. These targets look like:
157 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
158 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
159 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
160 # places corresponding to the .WAITs in our $SUBDIR variable.
162 # Also, since we're now mixing `install' with `all' and `depend' targets
163 # an order relationship between those in each individual subdirectory
164 # must be established.
166 _deps:=
167 _prev:=
169 .for d in ${SUBDIR} # {
170 _this:= ${d}
172 .if ${_this} == ".WAIT" # {
174 # setup dependency to apply to all/depend targets in the next group
175 _deps:= ${_deps} ${_prev:S/^/install-/}
177 # if we're building *only* individual targets (i.e. "dependall-yacc"),
178 # make sure prerequisite tools build before installing
179 # XXX: dsl: this is likely to generate a dependency loop since there is
180 # a .ORDER releation between the nodes as well.
181 .if !make(all) && !make(dependall) && !make(install)
182 install-${_prev}: dependall-${_prev}
183 .endif
185 .else # ${_this} != ".WAIT" # } {
187 # order depend/all/install targets for ${d} subdir.
188 .ORDER: depend-${d} all-${d} dependall-${d} install-${d}
190 # prevent cleandir in real{all,depend} from interfering with subdir makes
191 .ORDER: realdepend dependall-${d}
192 .ORDER: realdepend depend-${d}
193 .ORDER: realall all-${d}
195 # make all/depend-${d} dependent on list of install targets
196 depend-${d} all-${d} dependall-${d}: ${_deps}
198 .endif # ${_this} != ".WAIT" # }
200 # stash current name in case the next entry is .WAIT
201 _prev:= ${d}
202 .endfor # }
204 cleandir:
205 rm -f ${CLEANFILES}