Initial import from FreeBSD RELENG_4:
[dragonfly.git] / share / mk / bsd.files.mk
1 # $FreeBSD: src/share/mk/bsd.files.mk,v 1.2.2.3 2002/08/07 16:31:50 ru Exp $
2
3 .if !target(__<bsd.init.mk>__)
4 .error bsd.files.mk cannot be included directly.
5 .endif
6
7 FILESGROUPS?=   FILES
8
9 .if !target(buildfiles)
10 .for group in ${FILESGROUPS}
11 buildfiles: ${${group}}
12 .endfor
13 .endif
14
15 all: buildfiles
16
17 .if !target(installfiles)
18 .for group in ${FILESGROUPS}
19 .if defined(${group}) && !empty(${group})
20
21 ${group}OWN?=   ${SHAREOWN}
22 ${group}GRP?=   ${SHAREGRP}
23 ${group}MODE?=  ${SHAREMODE}
24 ${group}DIR?=   ${BINDIR}
25
26 _${group}FILES=
27 .for file in ${${group}}
28 .if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \
29     defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \
30     defined(${group}NAME_${file:T})
31 ${group}OWN_${file:T}?= ${${group}OWN}
32 ${group}GRP_${file:T}?= ${${group}GRP}
33 ${group}MODE_${file:T}?=        ${${group}MODE}
34 ${group}DIR_${file:T}?= ${${group}DIR}
35 .if defined(${group}NAME)
36 ${group}NAME_${file:T}?=        ${${group}NAME}
37 .else
38 ${group}NAME_${file:T}?=        ${file:T}
39 .endif
40 installfiles: _${group}INS_${file:T}
41 _${group}INS_${file:T}: ${file}
42         ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
43             -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
44             ${.ALLSRC} \
45             ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
46 .else
47 _${group}FILES+= ${file}
48 .endif
49 .endfor
50 .if !empty(_${group}FILES)
51 installfiles: _${group}INS
52 _${group}INS: ${_${group}FILES}
53 .if defined(${group}NAME)
54         ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
55             -m ${${group}MODE} ${.ALLSRC} \
56             ${DESTDIR}${${group}DIR}/${${group}NAME}
57 .else
58         ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
59             -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
60 .endif
61 .endif
62
63 .endif defined(${group}) && !empty(${group})
64 .endfor
65
66 .endif !target(installfiles)
67
68 realinstall: installfiles
69 .ORDER: beforeinstall installfiles