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 # SUBDIR A list of subdirectories that should be built as well.
17 # Each of the targets will execute the same target in the
22 # afterinstall, all, all-man, beforeinstall, checkdpadd,
23 # clean, cleandepend, cleandir, depend, install, lint, maninstall,
24 # manlint, obj, objlink, realinstall, regress, tags
27 .
include <bsd.init.mk
>
30 .if defined
(SUBDIR
) && !empty
(SUBDIR
) && !defined
(NO_SUBDIR
)
31 @for entry in
${SUBDIR}; do \
32 if
test -d
${.CURDIR
}/$${entry}.
${MACHINE_ARCH}; then \
33 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
34 edir
=$${entry}.
${MACHINE_ARCH}; \
35 cd
${.CURDIR
}/$${edir}; \
37 ${ECHODIR} "===> ${DIRPRFX}$$entry"; \
39 cd
${.CURDIR
}/$${edir}; \
41 ${MAKE} ${.TARGET
:realinstall
=install} \
42 DIRPRFX
=${DIRPRFX}$$edir/; \
47 @if
test -d
${.TARGET
}.
${MACHINE_ARCH}; then \
48 cd
${.CURDIR
}/${.TARGET
}.
${MACHINE_ARCH}; \
50 cd
${.CURDIR
}/${.TARGET
}; \
55 .for __target in
all all-man checkdpadd
clean cleandepend cleandir \
56 depend lint maninstall manlint \
57 obj objlink realinstall regress
tags
61 .for __target in files includes
62 .for __stage in build
install
63 ${__stage}${__target}:
64 .if make
(${__stage}${__target})
65 ${__stage}${__target}: _SUBDIR
69 cd
${.CURDIR
}; ${MAKE} build
${__target}; ${MAKE} install${__target}
73 .if
!target
(beforeinstall
)
76 .if
!target
(afterinstall
)
79 install: beforeinstall realinstall afterinstall
80 .ORDER
: beforeinstall realinstall afterinstall
83 .ORDER
: clean cleandepend cleandir cleanobj \
84 obj objlink
tags depend
all all-man \
85 install maninstall realinstall