]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/local.sys.mk
MFC r319020
[FreeBSD/FreeBSD.git] / share / mk / local.sys.mk
1 # $FreeBSD$
2
3 .if ${MK_DIRDEPS_BUILD} == "yes" || ${MK_META_MODE} == "yes"
4
5 # Not in the below list as it may make sense for non-meta mode
6 # eventually.  meta.sys.mk (DIRDEPS_BUILD) also already adds these in.
7 .if ${MK_DIRDEPS_BUILD} == "no" && ${MK_META_MODE} == "yes"
8 MAKE_PRINT_VAR_ON_ERROR += \
9         .ERROR_TARGET \
10         .ERROR_META_FILE \
11         .MAKE.LEVEL \
12         MAKEFILE \
13         .MAKE.MODE
14 .endif
15
16 MAKE_PRINT_VAR_ON_ERROR+= \
17         .CURDIR \
18         .MAKE \
19         .OBJDIR \
20         .TARGETS \
21         DESTDIR \
22         LD_LIBRARY_PATH \
23         MACHINE \
24         MACHINE_ARCH \
25         MAKEOBJDIRPREFIX \
26         MAKESYSPATH \
27         MAKE_VERSION \
28         PATH \
29         SRCTOP \
30         OBJTOP \
31         ${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
32
33 .if ${.MAKE.LEVEL} > 0
34 MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
35 .endif
36 .endif
37
38 .if !empty(.OBJDIR)
39 OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
40 .endif
41
42 .include "src.sys.mk"
43
44 .if ${.MAKE.MODE:Mmeta*} != ""
45 # we can afford to use cookies to prevent some targets
46 # re-running needlessly but only when using filemon.
47 # Targets that should support the meta mode cookie handling should just be
48 # added to META_TARGETS.  If bsd.sys.mk cannot be included then ${META_DEPS}
49 # should be added as a target dependency as well.  Otherwise the target
50 # is added to in bsd.sys.mk since it comes last.
51 .if ${.MAKE.MODE:Mnofilemon} == ""
52 # Prepend .OBJDIR if not already there.
53 _META_COOKIE_COND=      "${.TARGET:M${.OBJDIR}/*}" == ""
54 _META_COOKIE_DEFAULT=   ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}
55 # Use the default if COOKIE.${.TARGET} is not defined.
56 META_COOKIE=            ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}}
57 META_COOKIE_RM=         @rm -f ${META_COOKIE}
58 META_COOKIE_TOUCH=      @touch ${META_COOKIE}
59 CLEANFILES+=            ${META_TARGETS}
60 _meta_dep_before:       .USEBEFORE .NOTMAIN
61         ${META_COOKIE_RM}
62 _meta_dep_after:        .USE .NOTMAIN
63         ${META_COOKIE_TOUCH}
64 # Attach this to a target to allow it to benefit from meta mode's
65 # not rerunning a command if it doesn't need to be considering its
66 # metafile/filemon-tracked dependencies.
67 META_DEPS=      _meta_dep_before _meta_dep_after .META
68 .endif
69 .else
70 # some targets need to be .PHONY - but not in meta mode
71 META_NOPHONY=   .PHONY
72 .endif
73 META_NOPHONY?=
74 META_COOKIE_RM?=
75 META_COOKIE_TOUCH?=
76 META_DEPS+=     ${META_NOPHONY}