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