worldstone: add -s for statistical profiling
[minix.git] / tools / Makefile
blobfd3a322bbcf9d7f798b48d0a15aaa2bfb97a5067
1 # $NetBSD: Makefile,v 1.155 2011/11/03 07:42:56 joerg Exp $
3 .include <bsd.own.mk>
5 HAVE_GCC= 45
7 # Dependencies in SUBDIR below ordered to maximize parallel ability.
8 SUBDIR= host-mkdep .WAIT compat .WAIT \
9 binstall .WAIT mktemp .WAIT sed .WAIT \
10 genassym \
11 makewhatis mkdep \
12 mkfs.mfs m4 \
13 .WAIT yacc \
14 .WAIT awk \
15 .WAIT tic \
16 .WAIT lex \
17 .WAIT gmake .WAIT gmp .WAIT mpfr .WAIT mpc .WAIT binutils .WAIT gcc \
18 cat file pwd_mkdb stat zic \
22 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
23 realall realdepend install: check_MKTOOLS
25 .for dir in ${SUBDIR:N.WAIT}
26 all-${dir} depend-${dir} dependall-${dir} install-${dir}:
27 @true
28 .endfor
29 .endif # }
31 .include <bsd.subdir.mk>
32 .include <bsd.obj.mk>
34 .if !defined(PREVIOUSTOOLDIR)
35 . if exists(PREVIOUSTOOLDIR)
36 PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
37 . else
38 PREVIOUSTOOLDIR=
39 . endif
40 .endif
42 CLEANFILES+= PREVIOUSTOOLDIR
44 realall realdepend: .MAKE
45 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
46 @echo "*** WARNING: TOOLDIR has moved?"
47 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
48 @echo "*** != TOOLDIR '${TOOLDIR}'"
49 @echo "*** Cleaning mis-matched tools"
50 rm -f PREVIOUSTOOLDIR
51 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
52 .endif
53 echo ${TOOLDIR} >PREVIOUSTOOLDIR
55 # For each .WAIT point, make sure the immediately preceding target is
56 # installed before building anything after that point.
57 # (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
58 # install of 'b', but not the install of 'a'.)
60 # We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
61 # to achieve this. These targets look like:
62 # subdir-all: all-dir1 [.WAIT] all-dir2 etc..
63 # subdir-install: install-dir1 [.WAIT] install-dir2 etc..
64 # and so on for each element in ${TARGETS}, with .WAIT sources inserted at
65 # places corresponding to the .WAITs in our $SUBDIR variable.
67 # Also, since we're now mixing `install' with `all' and `depend' targets
68 # an order relationship between those in each individual subdirectory
69 # must be established.
71 _deps:=
72 _prev:=
74 .for d in ${SUBDIR} # {
75 _this:= ${d}
77 .if ${_this} == ".WAIT" # {
79 # setup dependency to apply to all/depend targets in the next group
80 _deps:= ${_deps} ${_prev:S/^/install-/}
82 # if we're building *only* individual targets (i.e. "dependall-yacc"),
83 # make sure prerequisite tools build before installing
84 # XXX: dsl: this is likely to generate a dependency loop since there is
85 # a .ORDER releation between the nodes as well.
86 .if !make(all) && !make(dependall) && !make(install)
87 install-${_prev}: dependall-${_prev}
88 .endif
90 .else # ${_this} != ".WAIT" # } {
92 # order depend/all/install targets for ${d} subdir.
93 .ORDER: depend-${d} all-${d} dependall-${d} install-${d}
95 # prevent cleandir in real{all,depend} from interfering with subdir makes
96 .ORDER: realdepend dependall-${d}
97 .ORDER: realdepend depend-${d}
98 .ORDER: realall all-${d}
100 # make all/depend-${d} dependent on list of install targets
101 depend-${d} all-${d} dependall-${d}: ${_deps}
103 .endif # ${_this} != ".WAIT" # }
105 # stash current name in case the next entry is .WAIT
106 _prev:= ${d}
107 .endfor # }
109 cleandir:
110 rm -f ${CLEANFILES}