1 # $NetBSD: Makefile,v 1.126 2009/02/25 20:36:45 sketch 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 m4 makewhatis mkdep mtree rpcgen tsort uudecode \
46 asn1_compile atf-compile cat cksum compile_et config db \
48 makefs menuc mkcsmapper mkesdb mklocale mknod msgc \
54 pwd_mkdb stat strfile sunlabel zic
56 .if
${MKMAN} != "no" ||
${MKDOC} != "no" ||
${MKHTML} != "no"
60 .if
${MKMAINTAINERTOOLS
:Uno
} != "no"
61 SUBDIR
+= autoconf .WAIT gettext
64 .if
${MACHINE} == "hp700"
68 .if
${MACHINE} == "ibmnws"
72 .if
${MACHINE} == "macppc"
73 SUBDIR
+= macppc-fixcoff
76 .if
(${MACHINE} == "prep" ||
${MACHINE} == "rs6000" ||
${MACHINE} == "bebox")
77 SUBDIR
+= powerpc-mkbootimage
80 .if
(${MACHINE_ARCH} == "mipsel" ||
${MACHINE_ARCH} == "mipseb")
81 SUBDIR
+= mips-elf2ecoff
84 .if
(${MACHINE} == "sgimips")
88 .if
${MACHINE} == "acorn32"
92 .if
(${MACHINE_ARCH} == "sparc" ||
${MACHINE_ARCH} == "sparc64")
96 .if
${MACHINE} == "amiga"
101 .if
${MACHINE} == "hp300"
102 SUBDIR
+= hp300-mkboot
105 check_MKTOOLS
: .PHONY .NOTMAIN
106 .if
${MKTOOLS
:Uyes
} == "no"
107 @echo
'*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
108 @echo
'*** updating your host toolchain. This should be used only as a'
109 @echo
'*** temporary workaround for toolchain problems, as it will result'
110 @echo
'*** in version skew and build errors over time!'
113 .if
${MKTOOLS
:Uyes
} == "no" ||
${USETOOLS} != "yes" # {
114 realall realdepend
install: check_MKTOOLS
116 .for
dir in
${SUBDIR
:N.WAIT
}
117 all-
${dir} depend-
${dir} dependall-
${dir} install-
${dir}:
122 .
include <bsd.subdir.mk
>
123 .
include <bsd.obj.mk
>
125 .if
!defined
(PREVIOUSTOOLDIR
)
126 . if exists
(PREVIOUSTOOLDIR
)
127 PREVIOUSTOOLDIR
!= cat PREVIOUSTOOLDIR
133 CLEANFILES
+= PREVIOUSTOOLDIR
135 realall realdepend
: .MAKE
136 .if
!empty
(PREVIOUSTOOLDIR
) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
137 @echo
"*** WARNING: TOOLDIR has moved?"
138 @echo
"*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
139 @echo
"*** != TOOLDIR '${TOOLDIR}'"
140 @echo
"*** Cleaning mis-matched tools"
141 rm -f PREVIOUSTOOLDIR
142 (cd
${.CURDIR
} && ${MAKE} PREVIOUSTOOLDIR
=${TOOLDIR} cleandir
)
144 echo
${TOOLDIR} >PREVIOUSTOOLDIR
146 # For each .WAIT point, make sure the immediately preceding target is
147 # installed before building anything after that point.
148 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
149 # install of 'b', but not the install of 'a'.)
151 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
152 # to achieve this. These targets look like:
153 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
154 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
155 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
156 # places corresponding to the .WAITs in our $SUBDIR variable.
158 # Also, since we're now mixing `install' with `all' and `depend' targets
159 # an order relationship between those in each individual subdirectory
160 # must be established.
165 .for d in
${SUBDIR} # {
168 .if
${_this} == ".WAIT" # {
170 # setup dependency to apply to all/depend targets in the next group
171 _deps
:= ${_deps} ${_prev
:S
/^
/install-
/}
173 # if we're building *only* individual targets (i.e. "dependall-yacc"),
174 # make sure prerequisite tools build before installing
175 # XXX: dsl: this is likely to generate a dependency loop since there is
176 # a .ORDER releation between the nodes as well.
177 .if
!make
(all) && !make
(dependall
) && !make
(install)
178 install-
${_prev}: dependall-
${_prev}
181 .
else # ${_this} != ".WAIT" # } {
183 # order depend/all/install targets for ${d} subdir.
184 .ORDER
: depend-
${d} all-
${d} dependall-
${d} install-
${d}
186 # prevent cleandir in real{all,depend} from interfering with subdir makes
187 .ORDER
: realdepend dependall-
${d}
188 .ORDER
: realdepend depend-
${d}
189 .ORDER
: realall all-
${d}
191 # make all/depend-${d} dependent on list of install targets
192 depend-
${d} all-
${d} dependall-
${d}: ${_deps}
194 .
endif # ${_this} != ".WAIT" # }
196 # stash current name in case the next entry is .WAIT