xref: /freebsd/share/mk/bsd.confs.mk (revision cf5f0744cd1df70f92959710bdf2a88c9f9c7df7)
19b4f4918SBaptiste Daroussin
29b4f4918SBaptiste Daroussin.if !target(__<bsd.init.mk>__)
39b4f4918SBaptiste Daroussin.  error bsd.conf.mk cannot be included directly.
49b4f4918SBaptiste Daroussin.endif
59b4f4918SBaptiste Daroussin
68f958ba9SBrad Davis.if !target(__<bsd.confs.mk>__)
78f958ba9SBrad Davis.  if target(__<bsd.dirs.mk>__)
88f958ba9SBrad Davis.    error bsd.dirs.mk must be included after bsd.confs.mk.
98f958ba9SBrad Davis.  endif
108f958ba9SBrad Davis
11*cf5f0744SSimon J. Gerraty__<bsd.confs.mk>__:	.NOTMAIN
128f958ba9SBrad Davis
139b4f4918SBaptiste DaroussinCONFGROUPS?=	CONFS
149b4f4918SBaptiste Daroussin
159b4f4918SBaptiste Daroussin.  if !target(buildconfig)
16d7d0effeSBryan Drewery.    for group in ${CONFGROUPS}
179b4f4918SBaptiste Daroussinbuildconfig: ${${group}}
189b4f4918SBaptiste Daroussin.    endfor
199b4f4918SBaptiste Daroussin.  endif
209b4f4918SBaptiste Daroussin
21db74470bSBryan Drewery.  if !defined(_SKIP_BUILD)
229b4f4918SBaptiste Daroussinall: buildconfig
23db74470bSBryan Drewery.  endif
249b4f4918SBaptiste Daroussin
25d7d0effeSBryan Drewery.  for group in ${CONFGROUPS}
269b4f4918SBaptiste Daroussin.    if defined(${group}) && !empty(${group})
279b4f4918SBaptiste Daroussin
288f958ba9SBrad Davis.      if !target(afterinstallconfig)
298f958ba9SBrad Davisafterinstallconfig:
308f958ba9SBrad Davis.      endif
31d8c06970SBrad Davis.      if !target(beforeinstallconfig)
32d8c06970SBrad Davisbeforeinstallconfig:
33d8c06970SBrad Davis.      endif
34d8c06970SBrad Davisinstallconfig:	beforeinstallconfig realinstallconfig afterinstallconfig
35d8c06970SBrad Davis.ORDER:		beforeinstallconfig realinstallconfig afterinstallconfig
368f958ba9SBrad Davis
379b4f4918SBaptiste Daroussin${group}OWN?=	${SHAREOWN}
389b4f4918SBaptiste Daroussin${group}GRP?=	${SHAREGRP}
39c8cbf0d5SBaptiste Daroussin${group}MODE?=	${CONFMODE}
40523e46d4SBryan Drewery${group}DIR?=	${CONFDIR}
41eba4cc15SBryan DrewerySTAGE_SETS+=	${group:C,[/*],_,g}
429b4f4918SBaptiste Daroussin
438f958ba9SBrad Davis.      if defined(NO_ROOT)
448f958ba9SBrad Davis.        if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*}
455c5ed48aSEmmanuel Vadot.          if defined(${group}PACKAGE)
464c1a82ceSEmmanuel Vadot${group}TAGS+=		package=${${group}PACKAGE:Uutilities}
479b4f4918SBaptiste Daroussin.          else
484c1a82ceSEmmanuel Vadot${group}TAGS+=		package=${PACKAGE:Uutilities}
499b4f4918SBaptiste Daroussin.          endif
508f958ba9SBrad Davis.        endif
518f958ba9SBrad Davis${group}TAGS+=		config
528f958ba9SBrad Davis${group}TAG_ARGS=	-T ${${group}TAGS:[*]:S/ /,/g}
538f958ba9SBrad Davis.      endif
548f958ba9SBrad Davis
558f958ba9SBrad Davis
568f958ba9SBrad Davis.      if ${${group}DIR:S/^\///} == ${${group}DIR}
578f958ba9SBrad Davis# ${group}DIR specifies a variable that specifies a path
588f958ba9SBrad DavisDIRS+=	${${group}DIR}
598f958ba9SBrad Davis_${group}DIR=	${${group}DIR}
608f958ba9SBrad Davis.      else
618f958ba9SBrad Davis# ${group}DIR specifies a path
628f958ba9SBrad DavisDIRS+=	${group}DIR
638f958ba9SBrad Davis_${group}DIR=	${group}DIR
648f958ba9SBrad Davis.      endif
658f958ba9SBrad Davis
66fe868b9bSSimon J. GerratySTAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}}
678f958ba9SBrad Davis
688f958ba9SBrad Davis.      for cnf in ${${group}}
698f958ba9SBrad Davis${group}OWN_${cnf}?=	${${group}OWN}
708f958ba9SBrad Davis${group}GRP_${cnf}?=	${${group}GRP}
718f958ba9SBrad Davis${group}MODE_${cnf}?=	${${group}MODE}
728f958ba9SBrad Davis${group}DIR_${cnf}?=	${${group}DIR}
738f958ba9SBrad Davis.        if defined(${group}NAME)
748f958ba9SBrad Davis${group}NAME_${cnf}?=	${${group}NAME}
758f958ba9SBrad Davis.        else
768f958ba9SBrad Davis${group}NAME_${cnf}?=	${cnf:T}
778f958ba9SBrad Davis.        endif
788f958ba9SBrad Davis
798f958ba9SBrad Davis
808f958ba9SBrad Davis# Determine the directory for the current file.  Default to the parent group
818f958ba9SBrad Davis# DIR, then check to see how to pass that variable on below.
828f958ba9SBrad Davis${group}DIR_${cnf}?=	${${group}DIR}
838f958ba9SBrad Davis.        if ${${group}DIR_${cnf}:S/^\///} == ${${group}DIR_${cnf}}
848f958ba9SBrad Davis# DIR specifies a variable that specifies a path
858f958ba9SBrad Davis_${group}DIR_${cnf}=	${${group}DIR_${cnf}}
868f958ba9SBrad Davis.        else
878f958ba9SBrad Davis# DIR directly specifies a path
888f958ba9SBrad Davis_${group}DIR_${cnf}=	${group}DIR_${cnf}
898f958ba9SBrad Davis.        endif
908f958ba9SBrad Davis${group}PREFIX_${cnf}=	${DESTDIR}${${_${group}DIR_${cnf}}}
918f958ba9SBrad Davis
928f958ba9SBrad Davis# Append DIR to DIRS if not already in place -- DIRS is already filtered, so
938f958ba9SBrad Davis# this is primarily to ease inspection.
948f958ba9SBrad Davis.        for d in ${DIRS}
958f958ba9SBrad Davis_DIRS+=	${${d}}
968f958ba9SBrad Davis.        endfor
978f958ba9SBrad Davis.        if ${DIRS:M${_${group}DIR_${cnf}}} == ""
988f958ba9SBrad Davis.          if ${_DIRS:M${${_${group}DIR_${cnf}}}} == ""
998f958ba9SBrad DavisDIRS+=	${_${group}DIR_${cnf}}
1008f958ba9SBrad Davis.          else
1018f958ba9SBrad Davis_${group}DIR_${cnf}=	${group}DIR
1028f958ba9SBrad Davis.          endif
1038f958ba9SBrad Davis.        endif
1048f958ba9SBrad Davis
1058f958ba9SBrad Davis.        if defined(${group}NAME)
1068f958ba9SBrad Davis${group}NAME_${cnf}?=	${${group}NAME}
1078f958ba9SBrad Davis.        else
1088f958ba9SBrad Davis${group}NAME_${cnf}?=	${cnf:T}
1098f958ba9SBrad Davis.        endif # defined(${group}NAME)
1108f958ba9SBrad Davis
11129c3c889SBrad Davis# Work around a bug with install(1) -C and /dev/null
11229c3c889SBrad Davis.        if ${cnf} == "/dev/null"
11329c3c889SBrad DavisINSTALL_COPY=
11429c3c889SBrad Davis.        else
11529c3c889SBrad DavisINSTALL_COPY=  -C
11629c3c889SBrad Davis.        endif
1178f958ba9SBrad Davis
1189b4f4918SBaptiste DaroussinSTAGE_AS_SETS+= ${cnf:T}
1199b4f4918SBaptiste DaroussinSTAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}}
1209b4f4918SBaptiste Daroussin# XXX {group}OWN,GRP,MODE
121fe868b9bSSimon J. GerratySTAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${_${group}DIR_${cnf}}}
1229b4f4918SBaptiste Daroussinstage_as.${cnf:T}: ${cnf}
1239b4f4918SBaptiste Daroussin
1248f958ba9SBrad Davisrealinstallconfig: installdirs-${_${group}DIR_${cnf}} _${group}INS_${cnf:T}
1259b4f4918SBaptiste Daroussin_${group}INS_${cnf:T}: ${cnf}
12629c3c889SBrad Davis	${INSTALL} ${${group}TAG_ARGS} ${INSTALL_COPY} -o ${${group}OWN_${cnf}} \
1278f958ba9SBrad Davis	    -g ${${group}GRP_${cnf}} -m ${${group}MODE_${cnf}} \
1288f958ba9SBrad Davis	    ${.ALLSRC} ${${group}PREFIX_${cnf}}/${${group}NAME_${cnf}}
1298f958ba9SBrad Davis.      endfor # for cnf in ${${group}}
1309b4f4918SBaptiste Daroussin
1319b4f4918SBaptiste Daroussin.    endif # defined(${group}) && !empty(${group})
1329b4f4918SBaptiste Daroussin.  endfor
1339b4f4918SBaptiste Daroussin
13499330d7aSBryan Drewery.if ${MK_STAGING} != "no"
13599330d7aSBryan Drewery.  if !empty(STAGE_SETS)
13699330d7aSBryan Drewerybuildconfig: stage_files
137cb05ce69SSimon J. Gerratystage_files:
13899330d7aSBryan Drewery.    if !empty(STAGE_AS_SETS)
13999330d7aSBryan Drewerybuildconfig: stage_as
140cb05ce69SSimon J. Gerratystage_as:
1419b4f4918SBaptiste Daroussin.    endif
1429b4f4918SBaptiste Daroussin.  endif
14399330d7aSBryan Drewery.endif
14499330d7aSBryan Drewery
1458f958ba9SBrad Davis.endif # !target(__<bsd.confs.mk>__)
146