1# $FreeBSD$ 2 3.if !target(__<bsd.init.mk>__) 4. error bsd.conf.mk cannot be included directly. 5.endif 6 7.if !target(__<bsd.confs.mk>__) 8. if target(__<bsd.dirs.mk>__) 9. error bsd.dirs.mk must be included after bsd.confs.mk. 10. endif 11 12__<bsd.confs.mk>__: 13 14CONFGROUPS?= CONFS 15 16. if !target(buildconfig) 17. for group in ${CONFGROUPS} 18buildconfig: ${${group}} 19. endfor 20. endif 21 22. if !defined(_SKIP_BUILD) 23all: buildconfig 24. endif 25 26. for group in ${CONFGROUPS} 27. if defined(${group}) && !empty(${group}) 28 29. if !target(afterinstallconfig) 30afterinstallconfig: 31. endif 32. if !target(beforeinstallconfig) 33beforeinstallconfig: 34. endif 35installconfig: beforeinstallconfig realinstallconfig afterinstallconfig 36.ORDER: beforeinstallconfig realinstallconfig afterinstallconfig 37 38${group}OWN?= ${SHAREOWN} 39${group}GRP?= ${SHAREGRP} 40${group}MODE?= ${CONFMODE} 41${group}DIR?= ${CONFDIR} 42STAGE_SETS+= ${group:C,[/*],_,g} 43 44. if defined(NO_ROOT) 45. if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} 46. if defined(${group}PACKAGE) 47${group}TAGS+= package=${${group}PACKAGE:Uutilities} 48. else 49${group}TAGS+= package=${PACKAGE:Uutilities} 50. endif 51. endif 52${group}TAGS+= config 53${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} 54. endif 55 56 57. if ${${group}DIR:S/^\///} == ${${group}DIR} 58# ${group}DIR specifies a variable that specifies a path 59DIRS+= ${${group}DIR} 60_${group}DIR= ${${group}DIR} 61. else 62# ${group}DIR specifies a path 63DIRS+= ${group}DIR 64_${group}DIR= ${group}DIR 65. endif 66 67STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} 68 69. for cnf in ${${group}} 70${group}OWN_${cnf}?= ${${group}OWN} 71${group}GRP_${cnf}?= ${${group}GRP} 72${group}MODE_${cnf}?= ${${group}MODE} 73${group}DIR_${cnf}?= ${${group}DIR} 74. if defined(${group}NAME) 75${group}NAME_${cnf}?= ${${group}NAME} 76. else 77${group}NAME_${cnf}?= ${cnf:T} 78. endif 79 80 81# Determine the directory for the current file. Default to the parent group 82# DIR, then check to see how to pass that variable on below. 83${group}DIR_${cnf}?= ${${group}DIR} 84. if ${${group}DIR_${cnf}:S/^\///} == ${${group}DIR_${cnf}} 85# DIR specifies a variable that specifies a path 86_${group}DIR_${cnf}= ${${group}DIR_${cnf}} 87. else 88# DIR directly specifies a path 89_${group}DIR_${cnf}= ${group}DIR_${cnf} 90. endif 91${group}PREFIX_${cnf}= ${DESTDIR}${${_${group}DIR_${cnf}}} 92 93# Append DIR to DIRS if not already in place -- DIRS is already filtered, so 94# this is primarily to ease inspection. 95. for d in ${DIRS} 96_DIRS+= ${${d}} 97. endfor 98. if ${DIRS:M${_${group}DIR_${cnf}}} == "" 99. if ${_DIRS:M${${_${group}DIR_${cnf}}}} == "" 100DIRS+= ${_${group}DIR_${cnf}} 101. else 102_${group}DIR_${cnf}= ${group}DIR 103. endif 104. endif 105 106. if defined(${group}NAME) 107${group}NAME_${cnf}?= ${${group}NAME} 108. else 109${group}NAME_${cnf}?= ${cnf:T} 110. endif # defined(${group}NAME) 111 112# Work around a bug with install(1) -C and /dev/null 113. if ${cnf} == "/dev/null" 114INSTALL_COPY= 115. else 116INSTALL_COPY= -C 117. endif 118 119STAGE_AS_SETS+= ${cnf:T} 120STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}} 121# XXX {group}OWN,GRP,MODE 122STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${_${group}DIR_${cnf}}} 123stage_as.${cnf:T}: ${cnf} 124 125realinstallconfig: installdirs-${_${group}DIR_${cnf}} _${group}INS_${cnf:T} 126_${group}INS_${cnf:T}: ${cnf} 127 ${INSTALL} ${${group}TAG_ARGS} ${INSTALL_COPY} -o ${${group}OWN_${cnf}} \ 128 -g ${${group}GRP_${cnf}} -m ${${group}MODE_${cnf}} \ 129 ${.ALLSRC} ${${group}PREFIX_${cnf}}/${${group}NAME_${cnf}} 130. endfor # for cnf in ${${group}} 131 132. endif # defined(${group}) && !empty(${group}) 133. endfor 134 135.if ${MK_STAGING} != "no" 136. if !empty(STAGE_SETS) 137buildconfig: stage_files 138stage_files: 139. if !empty(STAGE_AS_SETS) 140buildconfig: stage_as 141stage_as: 142. endif 143. endif 144.endif 145 146.endif # !target(__<bsd.confs.mk>__) 147