]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/local.sys.env.mk
bsddialog: import version 1.0
[FreeBSD/FreeBSD.git] / share / mk / local.sys.env.mk
1
2 # This makefile is for customizations that should be done early
3
4 .if !defined(_TARGETS)
5 # some things we do only once
6 _TARGETS:= ${.TARGETS}
7 .export _TARGETS
8 .endif
9
10 # some handy macros
11 _this = ${.PARSEDIR:tA}/${.PARSEFILE}
12 # some useful modifiers
13
14 # A useful trick for testing multiple :M's against something
15 # :L says to use the variable's name as its value - ie. literal
16 # got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}}
17 M_ListToMatch = L:@m@$${V:M$$m}@
18 # match against our initial targets (see above)
19 M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
20
21 # turn a list into a set of :N modifiers
22 # NskipFoo = ${Foo:${M_ListToSkip}}
23 M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
24
25 # type should be a builtin in any sh since about 1980,
26 # AUTOCONF := ${autoconf:L:${M_whence}}
27 M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
28 M_whence = ${M_type}:M/*:[1]
29
30 # convert a path to a valid shell variable
31 M_P2V = tu:C,[./-],_,g
32
33 # these are handy
34 # we can use this for a cheap timestamp at the start of a target's script,
35 # but not at the end - since make will expand both at the same time.
36 TIME_STAMP_FMT = @ %s [%Y-%m-%d %T]
37 TIME_STAMP = ${TIME_STAMP_FMT:localtime}
38 # this will produce the same output but as of when date(1) is run.
39 TIME_STAMP_DATE = `date '+${TIME_STAMP_FMT}'`
40 TIME_STAMP_END?= ${TIME_STAMP_DATE}
41
42 # Simplify auto.obj.mk mkdir -p handling and avoid unneeded/redundant
43 # error spam and show a proper error.
44 Mkdirs= Mkdirs() { mkdir -p $$* || :; }
45
46 .if !empty(.MAKEFLAGS:M-s)
47 ECHO_TRACE?=    true
48 .endif
49
50 .include "src.sys.env.mk"
51 .-include <site.sys.env.mk>
52
53 .if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
54 # we need HOST_TARGET etc below.
55 .include <host-target.mk>
56 .export HOST_TARGET
57 .endif
58
59 .include <local.sys.machine.mk>