xref: /freebsd/share/mk/local.sys.mk (revision 98e0ffaefb0f241cda3a72395d3be04192ae0d47)
1WITH_INSTALL_AS_USER= yes
2
3.if !defined(_TARGETS)
4# some things we do only once
5_TARGETS:= ${.TARGETS}
6.export _TARGETS
7.endif
8
9.if (!empty(_TARGETS) && ${_TARGETS:Nbuildworld:Nuniverse:Ninstallworld} == "") || defined(WITHOUT_META_MODE)
10MK_AUTO_OBJ= no
11MK_META_MODE= no
12MK_STAGING= no
13MK_STAGING_PROG= no
14MK_SYSROOT= no
15UPDATE_DEPENDFILE=NO
16.endif
17
18SRCCONF:= ${.PARSEDIR}/src.conf
19# ensure we are self contained
20__MAKE_CONF:= ${SRCCONF}
21.-include "src.conf"
22
23# some handy macros
24_this = ${.PARSEDIR:tA}/${.PARSEFILE}
25# some useful modifiers
26
27# A useful trick for testing multiple :M's against something
28# :L says to use the variable's name as its value - ie. literal
29# got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}}
30M_ListToMatch = L:@m@$${V:M$$m}@
31# match against our initial targets (see above)
32M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
33
34# turn a list into a set of :N modifiers
35# NskipFoo = ${Foo:${M_ListToSkip}}
36M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
37
38# type should be a builtin in any sh since about 1980,
39# AUTOCONF := ${autoconf:L:${M_whence}}
40M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
41M_whence = ${M_type}:M/*:[1]
42
43# convert a path to a valid shell variable
44M_P2V = tu:C,[./-],_,g
45
46MAKE_PRINT_VAR_ON_ERROR+= \
47	.CURDIR \
48	.MAKE \
49	.OBJDIR \
50	.TARGETS \
51	DESTDIR \
52	LD_LIBRARY_PATH \
53	MACHINE \
54	MACHINE_ARCH \
55	MAKEOBJDIRPREFIX \
56	MAKESYSPATH \
57	MAKE_VERSION\
58	SRCTOP \
59	OBJTOP \
60	${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
61
62.if ${.MAKE.LEVEL} > 0
63MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
64.endif
65
66# these are handy
67# we can use this for a cheap timestamp at the start of a target's script,
68# but not at the end - since make will expand both at the same time.
69TIME_STAMP_FMT = @ %s [%Y-%m-%d %T]
70TIME_STAMP = ${TIME_STAMP_FMT:localtime}
71# this will produce the same output but as of when date(1) is run.
72TIME_STAMP_DATE = `date '+${TIME_STAMP_FMT}'`
73TIME_STAMP_END?= ${TIME_STAMP_DATE}
74
75