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