]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.dirs.mk
Add the initial DIRS infrastructure for creating directories with the
[FreeBSD/FreeBSD.git] / share / mk / bsd.dirs.mk
1 # $FreeBSD$
2 #
3 # Directory permissions management.
4
5 .if !target(__<bsd.dirs.mk>__)
6 __<bsd.dirs.mk>__:
7 # List of directory variable names to install.  Each variable name's value
8 # must be a full path.  If non-default permissions are desired, <DIR>_MODE,
9 # <DIR>_OWN, and <DIR>_GRP may be specified.
10 DIRS?=
11
12 .  for dir in ${DIRS:O:u}
13 .    if defined(${dir}) && !empty(${dir})
14 # Set default permissions for a directory
15 ${dir}_MODE?=   0755
16 ${dir}_OWN?=    root
17 ${dir}_GRP?=    wheel
18 .      if defined(${dir}_FLAGS) && !empty(${dir}_FLAGS)
19 ${dir}_FLAG=    -f ${${dir}_FLAGS}
20 .      endif
21
22 .      if defined(NO_ROOT)
23 .        if !defined(${dir}TAGS) || ! ${${dir}TAGS:Mpackage=*}
24 ${dir}TAGS+=            package=${${dir}PACKAGE:Uruntime}
25 .        endif
26 ${dir}TAG_ARGS= -T ${${dir}TAGS:[*]:S/ /,/g}
27 .      endif
28
29 installdirs: installdirs-${dir}
30
31 installdirs-${dir}: ${DESTDIR}${${dir}}
32
33 ${DESTDIR}${${dir}}:
34         @${ECHO} installing DIRS ${dir}
35         ${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \
36                 -g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}}
37 .    endif
38
39 realinstall: installdirs-${dir}
40 .  endfor
41
42 .endif