2 # The include file <bsd.init.mk> includes <bsd.opts.mk>,
3 # ../Makefile.inc and <bsd.own.mk>; this is used at the
4 # top of all <bsd.*.mk> files that actually "build something".
5 # bsd.opts.mk is included early so Makefile.inc can use the
8 .if !target(__<bsd.init.mk>__)
10 .include <bsd.opts.mk>
11 .-include "local.init.mk"
13 # This is also done in bsd.obj.mk
14 .if defined(NO_OBJ) && ${.OBJDIR} != ${.CURDIR}
18 .if exists(${.CURDIR}/../Makefile.inc)
19 .include "${.CURDIR}/../Makefile.inc"
24 # This is used in bsd.{dep,lib,prog}.mk as ${OBJS_SRCS_FILTER:ts:}
25 # Some makefiles may want T as well to avoid nested objdirs.
28 # Handle INSTALL_AS_USER here to maximize the chance that
29 # it has final authority over fooOWN and fooGRP.
30 .if ${MK_INSTALL_AS_USER} != "no"
40 .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
47 # Some targets need to know when something may build. This is used to
48 # optimize targets that are only needed when building something, such as
49 # (not) reading in depend files. For DIRDEPS_BUILD, it will only calculate
50 # the dependency graph at .MAKE.LEVEL==0, so nothing should be built there.
51 # Skip "build" logic if:
52 # - DIRDEPS_BUILD at MAKELEVEL 0
53 # - make -V is used without an override
54 # - make install is used without other targets. This is to avoid breaking
55 # things like 'make all install' or 'make foo install'.
56 # - non-build targets are called
57 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} == 0
58 # targets that are ok at level 0
59 DIRDEPS_BUILD_LEVEL0_TARGETS += clean* destroy*
60 M_ListToSkip?= O:u:S,^,N,:ts:
61 .if ${.TARGETS:Uall:${DIRDEPS_BUILD_LEVEL0_TARGETS:${M_ListToSkip}}} != ""
62 _SKIP_BUILD= not building at level 0
64 .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \
65 ${.TARGETS:M*install*} == ${.TARGETS} || \
66 ${.TARGETS:Mclean*} == ${.TARGETS} || \
67 ${.TARGETS:M*clean} == ${.TARGETS} || \
68 ${.TARGETS:Mdestroy*} == ${.TARGETS} || \
69 ${.TARGETS:Mobj} == ${.TARGETS} || \
70 make(analyze) || make(print-dir)
71 # Skip building, but don't show a warning.
74 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD)
75 .warning ${_SKIP_BUILD}
78 beforebuild: .PHONY .NOTMAIN
79 .if !defined(_SKIP_BUILD)
80 all: beforebuild .WAIT
83 .if ${MK_META_MODE} == "yes"
84 .if !exists(/dev/filemon) && \
85 ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
86 !make(test-system-*) && !make(showconfig) && !make(print-dir) && \
87 ${.MAKEFLAGS:M-V} == ""
88 .warning The filemon module (/dev/filemon) is not loaded.
89 .warning META_MODE is less useful for incremental builds without filemon.
90 .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.
92 .endif # ${MK_META_MODE} == "yes"
94 .endif # !target(__<bsd.init.mk>__)