]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.files.mk
Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI.
[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 .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
14 FILESGROUPS?=   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}
20 buildfiles: ${${group}}
21 .endfor
22
23 .if !defined(_SKIP_BUILD)
24 all: buildfiles
25 .endif
26
27 .for group in ${FILESGROUPS}
28 .if defined(${group}) && !empty(${group})
29 installfiles: 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
39 STAGE_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
51 DIRS+=  ${${group}DIR}
52 _${group}DIR=   ${${group}DIR}
53 .else
54 # ${group}DIR specifies a path
55 DIRS+=  ${group}DIR
56 _${group}DIR=   ${group}DIR
57 .endif
58
59 STAGE_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}}}} == ""
89 DIRS+=  ${_${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)
100 STAGE_AS_SETS+= ${file}
101 STAGE_AS_${file}= ${${group}NAME_${file}}
102 # XXX {group}OWN,GRP,MODE
103 STAGE_DIR.${file}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}}
104 stage_as.${file}: ${file}
105
106 installfiles-${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
117 realinstall: installfiles
118 .ORDER: beforeinstall installfiles
119
120 .if ${MK_STAGING} != "no"
121 .if !empty(STAGE_SETS)
122 buildfiles: stage_files
123 STAGE_TARGETS+= stage_files
124 .if !empty(STAGE_AS_SETS)
125 buildfiles: stage_as
126 STAGE_TARGETS+= stage_as
127 .endif
128 .endif
129 .endif
130
131 .include <bsd.dirs.mk>
132
133 .endif # !target(__<bsd.files.mk>__)