xref: /freebsd/share/mk/local.sys.mk (revision 44d314f704764f0247a540648a4b4fc3e8012133)
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
18# some handy macros
19_this = ${.PARSEDIR:tA}/${.PARSEFILE}
20# some useful modifiers
21
22# A useful trick for testing multiple :M's against something
23# :L says to use the variable's name as its value - ie. literal
24# got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}}
25M_ListToMatch = L:@m@$${V:M$$m}@
26# match against our initial targets (see above)
27M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
28
29# turn a list into a set of :N modifiers
30# NskipFoo = ${Foo:${M_ListToSkip}}
31M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
32
33# type should be a builtin in any sh since about 1980,
34# AUTOCONF := ${autoconf:L:${M_whence}}
35M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
36M_whence = ${M_type}:M/*:[1]
37
38# convert a path to a valid shell variable
39M_P2V = tu:C,[./-],_,g
40
41MAKE_PRINT_VAR_ON_ERROR+= \
42	.CURDIR \
43	.MAKE \
44	.OBJDIR \
45	.TARGETS \
46	DESTDIR \
47	LD_LIBRARY_PATH \
48	MACHINE \
49	MACHINE_ARCH \
50	MAKEOBJDIRPREFIX \
51	MAKESYSPATH \
52	MAKE_VERSION\
53	SRCTOP \
54	OBJTOP \
55	${MAKE_PRINT_VAR_ON_ERROR_XTRAS}
56
57.if ${.MAKE.LEVEL} > 0
58MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH
59.endif
60
61# these are handy
62# we can use this for a cheap timestamp at the start of a target's script,
63# but not at the end - since make will expand both at the same time.
64TIME_STAMP_FMT = @ %s [%Y-%m-%d %T]
65TIME_STAMP = ${TIME_STAMP_FMT:localtime}
66# this will produce the same output but as of when date(1) is run.
67TIME_STAMP_DATE = `date '+${TIME_STAMP_FMT}'`
68TIME_STAMP_END?= ${TIME_STAMP_DATE}
69
70