xref: /freebsd/share/mk/src.sys.env.mk (revision c7d813a93eeb447470734c9bc0c140d90a54c271)
1# $FreeBSD$
2
3# early setup only see also src.sys.mk
4
5# make sure this is defined in a consistent manner
6SRCTOP:= ${.PARSEDIR:tA:H:H}
7
8.if ${.CURDIR} == ${SRCTOP}
9RELDIR = .
10.elif ${.CURDIR:M${SRCTOP}/*}
11RELDIR := ${.CURDIR:S,${SRCTOP}/,,}
12.endif
13
14# site customizations that do not depend on anything!
15SRC_ENV_CONF?= /etc/src-env.conf
16.if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_)
17.-include "${SRC_ENV_CONF}"
18_src_env_conf_included_:	.NOTMAIN
19.endif
20
21# Top-level installs should not use meta mode as it may prevent installing
22# based on cookies.
23.if make(*install*) && ${.MAKE.LEVEL} == 0
24META_MODE=	normal
25MK_META_MODE=	no
26.export MK_META_MODE
27.endif
28
29# If we were found via .../share/mk we need to replace that
30# with ${.PARSEDIR:tA} so that we can be found by
31# sub-makes launched from objdir.
32.if ${.MAKEFLAGS:M.../share/mk} != ""
33.MAKEFLAGS:= ${.MAKEFLAGS:S,.../share/mk,${.PARSEDIR:tA},}
34.endif
35.if ${MAKESYSPATH:Uno:M*.../*} != ""
36MAKESYSPATH:= ${MAKESYSPATH:S,.../share/mk,${.PARSEDIR:tA},}
37.export MAKESYSPATH
38.elif empty(MAKESYSPATH)
39MAKESYSPATH:=	${.PARSEDIR:tA}
40.export MAKESYSPATH
41.endif
42