]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.files.mk
Import bsd.clang-analyze.mk based on NetBSD's version.
[FreeBSD/FreeBSD.git] / share / mk / bsd.files.mk
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 __<bsd.files.mk>__:
9
10 FILESGROUPS?=   FILES
11
12 .for group in ${FILESGROUPS}
13 # Add in foo.yes and remove duplicates from all the groups
14 ${${group}}:= ${${group}} ${${group}.yes}
15 ${${group}}:= ${${group}:O:u}
16 buildfiles: ${${group}}
17 .endfor
18
19 .if !defined(_SKIP_BUILD)
20 all: buildfiles
21 .endif
22
23 .for group in ${FILESGROUPS}
24 .if defined(${group}) && !empty(${group})
25 installfiles: installfiles-${group}
26
27 ${group}OWN?=   ${SHAREOWN}
28 ${group}GRP?=   ${SHAREGRP}
29 ${group}MODE?=  ${SHAREMODE}
30 ${group}DIR?=   ${BINDIR}
31 .if !make(buildincludes)
32 STAGE_SETS+=    ${group}
33 .endif
34 STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR}
35
36 _${group}FILES=
37 .for file in ${${group}}
38 .if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \
39     defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \
40     defined(${group}NAME_${file:T}) || defined(${group}NAME)
41 ${group}OWN_${file:T}?= ${${group}OWN}
42 ${group}GRP_${file:T}?= ${${group}GRP}
43 ${group}MODE_${file:T}?=        ${${group}MODE}
44 ${group}DIR_${file:T}?= ${${group}DIR}
45 .if defined(${group}NAME)
46 ${group}NAME_${file:T}?=        ${${group}NAME}
47 .else
48 ${group}NAME_${file:T}?=        ${file:T}
49 .endif
50 .if !make(buildincludes)
51 STAGE_AS_SETS+= ${file:T}
52 .endif
53 STAGE_AS_${file:T}= ${${group}NAME_${file:T}}
54 # XXX {group}OWN,GRP,MODE
55 STAGE_DIR.${file:T}= ${STAGE_OBJTOP}${${group}DIR_${file:T}}
56 stage_as.${file:T}: ${file}
57
58 installfiles-${group}: _${group}INS_${file:T}
59 _${group}INS_${file:T}: ${file}
60         ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
61             -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
62             ${.ALLSRC} \
63             ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
64 .else
65 _${group}FILES+= ${file}
66 .endif
67 .endfor
68 .if !empty(_${group}FILES)
69 stage_files.${group}: ${_${group}FILES}
70
71 installfiles-${group}: _${group}INS
72 _${group}INS: ${_${group}FILES}
73 .if defined(${group}NAME)
74         ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
75             -m ${${group}MODE} ${.ALLSRC} \
76             ${DESTDIR}${${group}DIR}/${${group}NAME}
77 .else
78         ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
79             -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/
80 .endif
81 .endif
82
83 .endif # defined(${group}) && !empty(${group})
84 .endfor
85
86 realinstall: installfiles
87 .ORDER: beforeinstall installfiles
88
89 .if ${MK_STAGING} != "no"
90 .if !empty(STAGE_SETS)
91 buildfiles: stage_files
92 .if !empty(STAGE_AS_SETS)
93 buildfiles: stage_as
94 .endif
95 .endif
96 .endif
97
98 .endif # !target(__<bsd.files.mk>__)