1 # $NetBSD: Makefile,v 1.132 2009/12/23 20:15:21 mrg Exp $
7 TOOLCHAIN_BITS
= gmake .WAIT
9 .if
${TOOLCHAIN_MISSING} == "no"
10 TOOLCHAIN_BITS
+= binutils .WAIT
12 . if
${MKCROSSGDB
:Uno
} != "no"
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.
22 TOOLCHAIN_BITS
= gmake .WAIT
23 .if
${TOOLCHAIN_MISSING} == "no"
24 TOOLCHAIN_BITS
+= binutils .WAIT
27 TOOLCHAIN_BITS
+= .WAIT dbsym mdsetimage
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 \
40 lorder makewhatis mkdep mtree rpcgen tsort uudecode m4 \
46 .WAIT
${TOOLCHAIN_BITS} \
47 asn1_compile atf-compile cat cksum compile_et config db \
49 makefs menuc mkcsmapper mkesdb mklocale mknod msgc \
54 pwd_mkdb stat strfile sunlabel zic
56 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
58 . if
${MKMANDOC} == "yes"
63 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
64 SUBDIR
+= autoconf .WAIT gettext
67 .if
${MACHINE} == "hp700"
71 .if
${MACHINE} == "ibmnws"
75 .if
${MACHINE} == "macppc"
76 SUBDIR
+= macppc-fixcoff
79 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
80 SUBDIR
+= powerpc-mkbootimage
83 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb")
84 SUBDIR
+= mips-elf2ecoff
87 .if
(${MACHINE} == "sgimips")
91 .if
${MACHINE} == "acorn32"
95 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
99 .if
${MACHINE} == "amiga"
100 SUBDIR
+= amiga-elf2bb
104 .if
${MACHINE} == "hp300"
105 SUBDIR
+= hp300-mkboot
108 check_MKTOOLS
: .PHONY .NOTMAIN
109 .if
${MKTOOLS
:Uyes
} == "no"
110 @echo
'*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
111 @echo
'*** updating your host toolchain. This should be used only as a'
112 @echo
'*** temporary workaround for toolchain problems, as it will result'
113 @echo
'*** in version skew and build errors over time!'
116 .if
${MKTOOLS
:Uyes
} == "no" ||
${USETOOLS} != "yes" # {
117 realall realdepend
install: check_MKTOOLS
119 .for
dir in
${SUBDIR
:N.WAIT
}
120 all-
${dir} depend-
${dir} dependall-
${dir} install-
${dir}:
125 .
include <bsd.subdir.mk
>
126 .
include <bsd.obj.mk
>
128 .if
!defined
(PREVIOUSTOOLDIR
)
129 . if exists
(PREVIOUSTOOLDIR
)
130 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
136 CLEANFILES
+= PREVIOUSTOOLDIR
138 realall realdepend
: .MAKE
139 .if
!empty
(PREVIOUSTOOLDIR
) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
140 @echo
"*** WARNING: TOOLDIR has moved?"
141 @echo
"*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
142 @echo
"*** != TOOLDIR '${TOOLDIR}'"
143 @echo
"*** Cleaning mis-matched tools"
144 rm -f PREVIOUSTOOLDIR
145 (cd
${.CURDIR
} && ${MAKE} PREVIOUSTOOLDIR
=${TOOLDIR} cleandir
)
147 echo
${TOOLDIR} >PREVIOUSTOOLDIR
149 # For each .WAIT point, make sure the immediately preceding target is
150 # installed before building anything after that point.
151 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
152 # install of 'b', but not the install of 'a'.)
154 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
155 # to achieve this. These targets look like:
156 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
157 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
158 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
159 # places corresponding to the .WAITs in our $SUBDIR variable.
161 # Also, since we're now mixing `install' with `all' and `depend' targets
162 # an order relationship between those in each individual subdirectory
163 # must be established.
168 .for d in
${SUBDIR} # {
171 .if
${_this} == ".WAIT" # {
173 # setup dependency to apply to all/depend targets in the next group
174 _deps
:= ${_deps} ${_prev
:S
/^
/install-
/}
176 # if we're building *only* individual targets (i.e. "dependall-yacc"),
177 # make sure prerequisite tools build before installing
178 # XXX: dsl: this is likely to generate a dependency loop since there is
179 # a .ORDER releation between the nodes as well.
180 .if
!make
(all) && !make
(dependall
) && !make
(install)
181 install-
${_prev}: dependall-
${_prev}
184 .
else # ${_this} != ".WAIT" # } {
186 # order depend/all/install targets for ${d} subdir.
187 .ORDER
: depend-
${d} all-
${d} dependall-
${d} install-
${d}
189 # prevent cleandir in real{all,depend} from interfering with subdir makes
190 .ORDER
: realdepend dependall-
${d}
191 .ORDER
: realdepend depend-
${d}
192 .ORDER
: realall all-
${d}
194 # make all/depend-${d} dependent on list of install targets
195 depend-
${d} all-
${d} dependall-
${d}: ${_deps}
197 .
endif # ${_this} != ".WAIT" # }
199 # stash current name in case the next entry is .WAIT