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