]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.confs.mk
Fix nmount invalid pointer dereference
[FreeBSD/FreeBSD.git] / share / mk / bsd.confs.mk
1 # $FreeBSD$
2
3 .if !target(__<bsd.init.mk>__)
4 .error bsd.conf.mk cannot be included directly.
5 .endif
6
7 CONFGROUPS?=    CONFS
8
9 .if !target(buildconfig)
10 .for group in ${CONFGROUPS}
11 buildconfig: ${${group}}
12 .endfor
13 .endif
14
15 .if !defined(_SKIP_BUILD)
16 all: buildconfig
17 .endif
18
19 .if !target(installconfig)
20 .for group in ${CONFGROUPS}
21 .if defined(${group}) && !empty(${group})
22
23 ${group}OWN?=   ${SHAREOWN}
24 ${group}GRP?=   ${SHAREGRP}
25 ${group}MODE?=  ${CONFMODE}
26 ${group}DIR?=   ${CONFDIR}
27 STAGE_SETS+=    ${group:C,[/*],_,g}
28 STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR}
29
30 _${group}CONFS=
31 .for cnf in ${${group}}
32 .if defined(${group}OWN_${cnf:T}) || defined(${group}GRP_${cnf:T}) || \
33     defined(${group}MODE_${cnf:T}) || defined(${group}DIR_${cnf:T}) || \
34     defined(${group}NAME_${cnf:T}) || defined(${group}NAME)
35 ${group}OWN_${cnf:T}?=  ${${group}OWN}
36 ${group}GRP_${cnf:T}?=  ${${group}GRP}
37 ${group}MODE_${cnf:T}?= ${${group}MODE}
38 ${group}DIR_${cnf:T}?=  ${${group}DIR}
39 .if defined(${group}NAME)
40 ${group}NAME_${cnf:T}?= ${${group}NAME}
41 .else
42 ${group}NAME_${cnf:T}?= ${cnf:T}
43 .endif
44 STAGE_AS_SETS+= ${cnf:T}
45 STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}}
46 # XXX {group}OWN,GRP,MODE
47 STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}}
48 stage_as.${cnf:T}: ${cnf}
49
50 installconfig: _${group}INS_${cnf:T}
51 _${group}INS_${cnf:T}: ${cnf}
52         ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
53             -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
54             ${.ALLSRC} \
55             ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
56 .else
57 _${group}CONFS+= ${cnf}
58 .endif
59 .endfor
60 .if !empty(_${group}CONFS)
61 stage_files.${group}: ${_${group}CONFS}
62
63 installconfig: _${group}INS
64 _${group}INS: ${_${group}CONFS}
65 .if defined(${group}NAME)
66         ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
67             ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
68 .else
69         ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
70             ${.ALLSRC} ${DESTDIR}${${group}DIR}/
71 .endif
72 .endif
73
74 .endif # defined(${group}) && !empty(${group})
75 .endfor
76
77 .endif # !target(installconfig)
78
79 .if ${MK_STAGING} != "no"
80 .if !empty(STAGE_SETS)
81 buildconfig: stage_files
82 .if !empty(STAGE_AS_SETS)
83 buildconfig: stage_as
84 .endif
85 .endif
86 .endif
87