]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.confs.mk
bsddialog: import version 1.0
[FreeBSD/FreeBSD.git] / share / mk / bsd.confs.mk
1
2 .if !target(__<bsd.init.mk>__)
3 .  error bsd.conf.mk cannot be included directly.
4 .endif
5
6 .if !target(__<bsd.confs.mk>__)
7 .  if target(__<bsd.dirs.mk>__)
8 .    error bsd.dirs.mk must be included after bsd.confs.mk.
9 .  endif
10
11 __<bsd.confs.mk>__:
12
13 CONFGROUPS?=    CONFS
14
15 .  if !target(buildconfig)
16 .    for group in ${CONFGROUPS}
17 buildconfig: ${${group}}
18 .    endfor
19 .  endif
20
21 .  if !defined(_SKIP_BUILD)
22 all: buildconfig
23 .  endif
24
25 .  for group in ${CONFGROUPS}
26 .    if defined(${group}) && !empty(${group})
27
28 .      if !target(afterinstallconfig)
29 afterinstallconfig:
30 .      endif
31 .      if !target(beforeinstallconfig)
32 beforeinstallconfig:
33 .      endif
34 installconfig:  beforeinstallconfig realinstallconfig afterinstallconfig
35 .ORDER:         beforeinstallconfig realinstallconfig afterinstallconfig
36
37 ${group}OWN?=   ${SHAREOWN}
38 ${group}GRP?=   ${SHAREGRP}
39 ${group}MODE?=  ${CONFMODE}
40 ${group}DIR?=   ${CONFDIR}
41 STAGE_SETS+=    ${group:C,[/*],_,g}
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:Uutilities}
47 .          else
48 ${group}TAGS+=          package=${PACKAGE:Uutilities}
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 STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}}
67
68 .      for cnf in ${${group}}
69 ${group}OWN_${cnf}?=    ${${group}OWN}
70 ${group}GRP_${cnf}?=    ${${group}GRP}
71 ${group}MODE_${cnf}?=   ${${group}MODE}
72 ${group}DIR_${cnf}?=    ${${group}DIR}
73 .        if defined(${group}NAME)
74 ${group}NAME_${cnf}?=   ${${group}NAME}
75 .        else
76 ${group}NAME_${cnf}?=   ${cnf:T}
77 .        endif
78
79
80 # Determine the directory for the current file.  Default to the parent group
81 # DIR, then check to see how to pass that variable on below.
82 ${group}DIR_${cnf}?=    ${${group}DIR}
83 .        if ${${group}DIR_${cnf}:S/^\///} == ${${group}DIR_${cnf}}
84 # DIR specifies a variable that specifies a path
85 _${group}DIR_${cnf}=    ${${group}DIR_${cnf}}
86 .        else
87 # DIR directly specifies a path
88 _${group}DIR_${cnf}=    ${group}DIR_${cnf}
89 .        endif
90 ${group}PREFIX_${cnf}=  ${DESTDIR}${${_${group}DIR_${cnf}}}
91
92 # Append DIR to DIRS if not already in place -- DIRS is already filtered, so
93 # this is primarily to ease inspection.
94 .        for d in ${DIRS}
95 _DIRS+= ${${d}}
96 .        endfor
97 .        if ${DIRS:M${_${group}DIR_${cnf}}} == ""
98 .          if ${_DIRS:M${${_${group}DIR_${cnf}}}} == ""
99 DIRS+=  ${_${group}DIR_${cnf}}
100 .          else
101 _${group}DIR_${cnf}=    ${group}DIR
102 .          endif
103 .        endif
104
105 .        if defined(${group}NAME)
106 ${group}NAME_${cnf}?=   ${${group}NAME}
107 .        else
108 ${group}NAME_${cnf}?=   ${cnf:T}
109 .        endif # defined(${group}NAME)
110
111 # Work around a bug with install(1) -C and /dev/null
112 .        if ${cnf} == "/dev/null"
113 INSTALL_COPY=
114 .        else
115 INSTALL_COPY=  -C
116 .        endif
117
118 STAGE_AS_SETS+= ${cnf:T}
119 STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}}
120 # XXX {group}OWN,GRP,MODE
121 STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${_${group}DIR_${cnf}}}
122 stage_as.${cnf:T}: ${cnf}
123
124 realinstallconfig: installdirs-${_${group}DIR_${cnf}} _${group}INS_${cnf:T}
125 _${group}INS_${cnf:T}: ${cnf}
126         ${INSTALL} ${${group}TAG_ARGS} ${INSTALL_COPY} -o ${${group}OWN_${cnf}} \
127             -g ${${group}GRP_${cnf}} -m ${${group}MODE_${cnf}} \
128             ${.ALLSRC} ${${group}PREFIX_${cnf}}/${${group}NAME_${cnf}}
129 .      endfor # for cnf in ${${group}}
130
131 .    endif # defined(${group}) && !empty(${group})
132 .  endfor
133
134 .if ${MK_STAGING} != "no"
135 .  if !empty(STAGE_SETS)
136 buildconfig: stage_files
137 stage_files:
138 .    if !empty(STAGE_AS_SETS)
139 buildconfig: stage_as
140 stage_as:
141 .    endif
142 .  endif
143 .endif
144
145 .endif # !target(__<bsd.confs.mk>__)