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