xref: /freebsd/share/mk/bsd.confs.mk (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1# $FreeBSD$
2
3.if !target(__<bsd.init.mk>__)
4.error bsd.conf.mk cannot be included directly.
5.endif
6
7CONFGROUPS?=	CONFS
8
9_CONFGROUPS=	${CONFGROUPS:C,[/*],_,g}
10
11.if !target(buildconfig)
12.for group in ${_CONFGROUPS}
13buildconfig: ${${group}}
14.endfor
15.endif
16
17.if !defined(_SKIP_BUILD)
18all: 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}
29STAGE_SETS+=	${group}
30STAGE_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
46STAGE_AS_SETS+= ${cnf:T}
47STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}}
48# XXX {group}OWN,GRP,MODE
49STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}}
50stage_as.${cnf:T}: ${cnf}
51
52installconfig: _${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)
63stage_files.${group}: ${_${group}CONFS}
64
65installconfig: _${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)
83buildconfig: stage_files
84.if !empty(STAGE_AS_SETS)
85buildconfig: stage_as
86.endif
87.endif
88.endif
89
90