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