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