1 # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
2 # $FreeBSD: src/share/mk/bsd.subdir.mk,v 1.30.2.5 2002/07/22 14:21:51 ru Exp $
3 # $DragonFly: src/share/mk/bsd.subdir.mk,v 1.4 2005/12/09 18:53:44 swildner Exp $
5 # The include file <bsd.subdir.mk> contains the default targets
6 # for building subdirectories.
8 # For all of the directories listed in the variable SUBDIRS, the
9 # specified directory will be visited and the target made. There is
10 # also a default target which allows the command "make subdir" where
11 # subdir is any directory listed in the variable SUBDIRS.
16 # DISTRIBUTION Name of distribution. [bin]
18 # SUBDIR A list of subdirectories that should be built as well.
19 # Each of the targets will execute the same target in the
25 # This is a variant of install, which will
26 # put the stuff into the right "distribution".
28 # afterinstall, all, all-man, beforeinstall, checkdpadd,
29 # clean, cleandepend, cleandir, depend, install, lint, maninstall,
30 # manlint, obj, objlink, realinstall, regress, tags
33 .
include <bsd.init.mk
>
36 .if
!target
(distribute
)
38 .for
dist in
${DISTRIBUTION}
40 ${MAKE} install -DNO_SUBDIR DESTDIR
=${DISTDIR}/${dist} SHARED
=copies
45 .if defined
(SUBDIR
) && !empty
(SUBDIR
) && !defined
(NO_SUBDIR
)
46 @for entry in
${SUBDIR}; do \
47 if
test -d
${.CURDIR
}/$${entry}.
${MACHINE_ARCH}; then \
48 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
49 edir
=$${entry}.
${MACHINE_ARCH}; \
50 cd
${.CURDIR
}/$${edir}; \
52 ${ECHODIR} "===> ${DIRPRFX}$$entry"; \
54 cd
${.CURDIR
}/$${edir}; \
56 ${MAKE} ${.TARGET
:realinstall
=install} \
57 DIRPRFX
=${DIRPRFX}$$edir/; \
62 @if
test -d
${.TARGET
}.
${MACHINE_ARCH}; then \
63 cd
${.CURDIR
}/${.TARGET
}.
${MACHINE_ARCH}; \
65 cd
${.CURDIR
}/${.TARGET
}; \
70 .for __target in
all all-man checkdpadd
clean cleandepend cleandir \
71 depend distribute lint maninstall manlint \
72 obj objlink realinstall regress
tags
76 .for __target in files includes
77 .for __stage in build
install
78 ${__stage}${__target}:
79 .if make
(${__stage}${__target})
80 ${__stage}${__target}: _SUBDIR
84 cd
${.CURDIR
}; ${MAKE} build
${__target}; ${MAKE} install${__target}
88 .if
!target
(beforeinstall
)
91 .if
!target
(afterinstall
)
94 install: beforeinstall realinstall afterinstall
95 .ORDER
: beforeinstall realinstall afterinstall
98 .ORDER
: clean cleandepend cleandir cleanobj \
99 obj objlink
tags depend
all all-man \
100 install maninstall realinstall distribute