]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.init.mk
MFV r316083,316094:
[FreeBSD/FreeBSD.git] / share / mk / bsd.init.mk
1 # $FreeBSD$
2
3 # The include file <bsd.init.mk> includes <bsd.opts.mk>,
4 # ../Makefile.inc and <bsd.own.mk>; this is used at the
5 # top of all <bsd.*.mk> files that actually "build something".
6 # bsd.opts.mk is included early so Makefile.inc can use the
7 # MK_FOO variables.
8
9 .if !target(__<bsd.init.mk>__)
10 __<bsd.init.mk>__:
11 .include <bsd.opts.mk>
12 .-include "local.init.mk"
13 .if exists(${.CURDIR}/../Makefile.inc)
14 .include "${.CURDIR}/../Makefile.inc"
15 .endif
16 .include <bsd.own.mk>
17 .MAIN: all
18
19 # Some targets need to know when something may build.  This is used to
20 # optimize targets that are only needed when building something, such as
21 # (not) reading in depend files.  For DIRDEPS_BUILD, it will only calculate
22 # the dependency graph at .MAKE.LEVEL==0, so nothing should be built there.
23 # Skip "build" logic if:
24 # - DIRDEPS_BUILD at MAKELEVEL 0
25 # - make -V is used without an override
26 # - make install is used without other targets.  This is to avoid breaking
27 #   things like 'make all install' or 'make foo install'.
28 # - non-build targets are called
29 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \
30     ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*)
31 _SKIP_BUILD=    not building at level 0
32 .elseif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \
33     ${.TARGETS:M*install*} == ${.TARGETS} || \
34     make(clean*) || make(obj) || make(analyze) || make(print-dir) || \
35     make(destroy*)
36 # Skip building, but don't show a warning.
37 _SKIP_BUILD=
38 .endif
39 .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD)
40 .warning ${_SKIP_BUILD}
41 .endif
42
43 beforebuild: .PHONY .NOTMAIN
44 .if !defined(_SKIP_BUILD)
45 all: beforebuild .WAIT
46 .endif
47
48 .if ${MK_META_MODE} == "yes"
49 .if !exists(/dev/filemon) && \
50     ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
51     !make(showconfig) && !make(print-dir) && ${.MAKEFLAGS:M-V} == ""
52 .warning The filemon module (/dev/filemon) is not loaded.
53 .warning META_MODE is less useful for incremental builds without filemon.
54 .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.
55 .endif
56 .endif  # ${MK_META_MODE} == "yes"
57
58 .endif  # !target(__<bsd.init.mk>__)