xref: /freebsd/share/mk/bsd.confs.mk (revision a2aef24aa3c8458e4036735dd6928b4ef77294e5)
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
15.if !defined(_SKIP_BUILD)
16all: 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}
27STAGE_SETS+=	${group:C,[/*],_,g}
28STAGE_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
44STAGE_AS_SETS+= ${cnf:T}
45STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}}
46# XXX {group}OWN,GRP,MODE
47STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}}
48stage_as.${cnf:T}: ${cnf}
49
50installconfig: _${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)
61stage_files.${group}: ${_${group}CONFS}
62
63installconfig: _${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)
81buildconfig: stage_files
82.if !empty(STAGE_AS_SETS)
83buildconfig: stage_as
84.endif
85.endif
86.endif
87
88