]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | # |
2 | # Generic Install rules | |
3 | # | |
4 | ||
1c79356b A |
5 | ifndef INSTALL_MI_LCL_LIST |
6 | INSTALL_MI_LCL_LIST = $(INSTALL_MI_LIST) | |
7 | endif | |
8 | ||
9 | ifndef INSTALL_MI_LCL_GEN_LIST | |
10 | INSTALL_MI_LCL_GEN_LIST = $(INSTALL_MI_GEN_LIST) | |
11 | endif | |
12 | ||
13 | ifndef INSTALL_MD_LCL_LIST | |
14 | INSTALL_MD_LCL_LIST = $(INSTALL_MD_LIST) | |
15 | endif | |
16 | ||
17 | ifndef INSTALL_MD_LCL_GEN_LIST | |
18 | INSTALL_MD_LCL_GEN_LIST = $(INSTALL_MD_GEN_LIST) | |
19 | endif | |
20 | ||
91447636 A |
21 | ifndef INSTALL_KF_MI_LCL_LIST |
22 | INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST) | |
23 | endif | |
1c79356b | 24 | |
91447636 A |
25 | ifndef INSTALL_KF_MI_LCL_GEN_LIST |
26 | INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
27 | endif | |
1c79356b | 28 | |
91447636 A |
29 | ifndef INSTALL_KF_MD_LCL_LIST |
30 | INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST) | |
31 | endif | |
1c79356b | 32 | |
91447636 A |
33 | ifndef INSTALL_KF_MD_LCL_GEN_LIST |
34 | INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
35 | endif | |
9bccf70c | 36 | |
91447636 A |
37 | ifndef INSTALL_KF_MI_LIST |
38 | INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST) | |
39 | endif | |
1c79356b | 40 | |
91447636 A |
41 | ifndef INSTALL_KF_MI_GEN_LIST |
42 | INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST) | |
43 | endif | |
9bccf70c | 44 | |
91447636 A |
45 | ifndef INSTALL_KF_MD_LIST |
46 | INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST) | |
47 | endif | |
9bccf70c | 48 | |
91447636 A |
49 | ifndef INSTALL_KF_MD_GEN_LIST |
50 | INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST) | |
51 | endif | |
52 | ||
2d21ac55 | 53 | ifneq ($(MACHINE_CONFIG), DEFAULT) |
316670eb | 54 | export OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG) |
2d21ac55 | 55 | else |
316670eb | 56 | export OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG) |
2d21ac55 A |
57 | endif |
58 | ||
91447636 | 59 | INSTALL_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST)) |
1c79356b | 60 | |
91447636 | 61 | $(INSTALL_MI_GEN_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : % |
2d21ac55 A |
62 | @true echo Installing $< in $(dir $@) |
63 | $(_v)[ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ | |
1c79356b A |
64 | filename=`$(BASENAME) $<`; \ |
65 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
66 | $(RM) $(RMFLAGS) $@; \ | |
91447636 A |
67 | [ -d ./incmidir ] || $(MKDIR) ./incmidir; \ |
68 | echo garbage > ./incmidir/$${filename_strip}; \ | |
69 | $(UNIFDEF) $(SINCFRAME_UNIFDEF) \ | |
70 | $< > ./incmidir/$${filename} || \ | |
71 | $(DECOMMENT) ./incmidir/$${filename} r > \ | |
72 | ./incmidir/$${filename_strip}; \ | |
73 | if [ -s ./incmidir/$${filename_strip} ]; \ | |
1c79356b | 74 | then ( \ |
593a1d5f | 75 | $(INSTALL) $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\ |
1c79356b A |
76 | ); \ |
77 | else \ | |
78 | echo Header file $< not exported; \ | |
91447636 | 79 | fi; |
1c79356b | 80 | |
91447636 | 81 | INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST)) |
1c79356b | 82 | |
91447636 | 83 | $(INSTALL_KF_MI_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/% : % |
2d21ac55 A |
84 | @true echo Installing $< in $(midir $@) |
85 | $(_v)[ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ | |
1c79356b A |
86 | filename=`$(BASENAME) $<`; \ |
87 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
88 | $(RM) $(RMFLAGS) $@; \ | |
91447636 A |
89 | [ -d ./kincmidir ] || $(MKDIR) ./kincmidir; \ |
90 | echo garbage > ./kincmidir/$${filename_strip}; \ | |
91 | $(UNIFDEF) $(KINCFRAME_UNIFDEF) \ | |
92 | $< > ./kincmidir/$${filename} || \ | |
93 | $(DECOMMENT) ./kincmidir/$${filename} r > \ | |
94 | ./kincmidir/$${filename_strip}; \ | |
95 | if [ -s ./kincmidir/$${filename_strip} ]; \ | |
1c79356b | 96 | then ( \ |
593a1d5f | 97 | $(INSTALL) $(INSTALL_FLAGS) ./kincmidir/$${filename} $(dir $@);\ |
1c79356b A |
98 | ); \ |
99 | else \ | |
100 | echo Header file $< not exported; \ | |
91447636 | 101 | fi; |
1c79356b | 102 | |
9bccf70c A |
103 | INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST)) |
104 | ||
1c79356b | 105 | $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : % |
2d21ac55 A |
106 | @true echo Installing $< in $(dir $@) |
107 | $(_v)[ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ | |
91447636 A |
108 | filename=`$(BASENAME) $<`; \ |
109 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
1c79356b | 110 | $(RM) $(RMFLAGS) $@; \ |
91447636 A |
111 | [ -d ./pincmidir ] || $(MKDIR) ./pincmidir; \ |
112 | echo garbage > ./pincmidir/$${filename_strip}; \ | |
113 | $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \ | |
114 | $< > ./pincmidir/$${filename} || \ | |
115 | $(DECOMMENT) ./pincmidir/$${filename} r > \ | |
116 | ./pincmidir/$${filename_strip}; \ | |
117 | if [ -s ./pincmidir/$${filename_strip} ]; \ | |
118 | then ( \ | |
593a1d5f | 119 | $(INSTALL) $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\ |
91447636 A |
120 | ); \ |
121 | else \ | |
122 | echo Header file $< not exported; \ | |
123 | fi; | |
1c79356b | 124 | |
91447636 | 125 | INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST)) |
9bccf70c | 126 | |
91447636 | 127 | $(INSTALL_KF_MI_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/% : % |
2d21ac55 A |
128 | @true echo Installing $< in $(dir $@) |
129 | $(_v)[ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ | |
91447636 A |
130 | filename=`$(BASENAME) $<`; \ |
131 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
9bccf70c | 132 | $(RM) $(RMFLAGS) $@; \ |
91447636 A |
133 | [ -d ./kpincmidir ] || $(MKDIR) ./kpincmidir; \ |
134 | echo garbage > ./kpincmidir/$${filename_strip}; \ | |
135 | $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \ | |
136 | $< > ./kpincmidir/$${filename} || \ | |
137 | $(DECOMMENT) ./kpincmidir/$${filename} r > \ | |
138 | ./kpincmidir/$${filename_strip}; \ | |
139 | if [ -s ./kpincmidir/$${filename_strip} ]; \ | |
140 | then ( \ | |
593a1d5f | 141 | $(INSTALL) $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\ |
91447636 A |
142 | ); \ |
143 | else \ | |
144 | echo Header file $< not exported; \ | |
145 | fi; | |
9bccf70c | 146 | |
1c79356b A |
147 | INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST)) |
148 | ||
1c79356b | 149 | $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : % |
2d21ac55 A |
150 | @true echo Installing $< in $(dir $@) |
151 | $(_v)[ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ | |
1c79356b A |
152 | filename=`$(BASENAME) $<`; \ |
153 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
154 | $(RM) $(RMFLAGS) $@; \ | |
91447636 | 155 | [ -d ./incdir ] || $(MKDIR) ./incdir; \ |
1c79356b | 156 | echo garbage > ./incdir/$${filename_strip}; \ |
91447636 | 157 | $(UNIFDEF) $(SINCFRAME_UNIFDEF) \ |
1c79356b A |
158 | $< > ./incdir/$${filename} || \ |
159 | $(DECOMMENT) ./incdir/$${filename} r > \ | |
160 | ./incdir/$${filename_strip}; \ | |
161 | if [ -s ./incdir/$${filename_strip} ]; \ | |
162 | then ( \ | |
593a1d5f | 163 | $(INSTALL) $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\ |
1c79356b A |
164 | ); \ |
165 | else \ | |
166 | echo Header file $< not exported; \ | |
91447636 A |
167 | fi; |
168 | ||
169 | INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST)) | |
170 | ||
171 | $(INSTALL_KF_MD_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/% : % | |
2d21ac55 A |
172 | @true echo Installing $< in $(dir $@) |
173 | $(_v)[ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ | |
91447636 A |
174 | filename=`$(BASENAME) $<`; \ |
175 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
176 | $(RM) $(RMFLAGS) $@; \ | |
177 | [ -d ./kincdir ] || $(MKDIR) ./kincdir; \ | |
178 | echo garbage > ./kincdir/$${filename_strip}; \ | |
179 | $(UNIFDEF) $(KINCFRAME_UNIFDEF) \ | |
180 | $< > ./kincdir/$${filename} || \ | |
181 | $(DECOMMENT) ./kincdir/$${filename} r > \ | |
182 | ./kincdir/$${filename_strip}; \ | |
183 | if [ -s ./kincdir/$${filename_strip} ]; \ | |
184 | then ( \ | |
593a1d5f | 185 | $(INSTALL) $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\ |
91447636 A |
186 | ); \ |
187 | else \ | |
188 | echo Header file $< not exported; \ | |
189 | fi; | |
1c79356b | 190 | |
9bccf70c A |
191 | INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST)) |
192 | INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST)) | |
193 | ||
1c79356b | 194 | $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : % |
2d21ac55 A |
195 | @true echo Installing $< in $(dir $@) |
196 | $(_v)[ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ | |
91447636 A |
197 | filename=`$(BASENAME) $<`; \ |
198 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
1c79356b | 199 | $(RM) $(RMFLAGS) $@; \ |
91447636 A |
200 | [ -d ./pincdir ] || $(MKDIR) ./pincdir; \ |
201 | echo garbage > ./pincdir/$${filename_strip}; \ | |
202 | $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \ | |
203 | $< > ./pincdir/$${filename} || \ | |
204 | $(DECOMMENT) ./pincdir/$${filename} r > \ | |
205 | ./pincdir/$${filename_strip}; \ | |
206 | if [ -s ./pincdir/$${filename_strip} ]; \ | |
207 | then ( \ | |
593a1d5f | 208 | $(INSTALL) $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\ |
91447636 A |
209 | ); \ |
210 | else \ | |
211 | echo Header file $< not exported; \ | |
212 | fi; | |
1c79356b | 213 | |
91447636 A |
214 | INSTALL_KF_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_KF_MD_LCL_LIST)) |
215 | INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST)) | |
9bccf70c | 216 | |
91447636 | 217 | $(INSTALL_KF_MD_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/% : % |
2d21ac55 A |
218 | @true echo Installing $< in $(dir $@) |
219 | $(_v)[ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ | |
91447636 A |
220 | filename=`$(BASENAME) $<`; \ |
221 | filename_strip=$(addsuffix .strip,$${filename}); \ | |
9bccf70c | 222 | $(RM) $(RMFLAGS) $@; \ |
91447636 A |
223 | [ -d ./kpincdir ] || $(MKDIR) ./kpincdir; \ |
224 | echo garbage > ./kpincdir/$${filename_strip}; \ | |
225 | $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \ | |
226 | $< > ./kpincdir/$${filename} || \ | |
227 | $(DECOMMENT) ./kpincdir/$${filename} r > \ | |
228 | ./kpincdir/$${filename_strip}; \ | |
229 | if [ -s ./kpincdir/$${filename_strip} ]; \ | |
230 | then ( \ | |
593a1d5f | 231 | $(INSTALL) $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\ |
91447636 A |
232 | ); \ |
233 | else \ | |
234 | echo Header file $< not exported; \ | |
235 | fi; | |
9bccf70c | 236 | |
1c79356b | 237 | setup_installhdrs_mi: |
1c79356b | 238 | |
91447636 | 239 | do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL_KF_MI_GEN_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) |
2d21ac55 A |
240 | @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
241 | $(_v)$(MKDIR) ./incmidir ./pincmidir ./kincmidir ./kpincmidir; \ | |
91447636 | 242 | if [ -n "$(strip $(INSTALL_MI_LIST))" ]; then \ |
1c79356b A |
243 | if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ]; then \ |
244 | (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LIST) ); \ | |
245 | else \ | |
246 | $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ | |
247 | fi; \ | |
1c79356b A |
248 | for j in $(INSTALL_MI_LIST); \ |
249 | do \ | |
91447636 A |
250 | echo garbage > ./incmidir/$$j.strip; \ |
251 | $(UNIFDEF) $(SINCFRAME_UNIFDEF) \ | |
252 | $(SOURCE)/$$j > ./incmidir/$$j || \ | |
253 | $(DECOMMENT) ./incmidir/$$j r > \ | |
254 | ./incmidir/$$j.strip; \ | |
255 | if [ -s ./incmidir/$$j.strip ]; \ | |
1c79356b | 256 | then ( \ |
593a1d5f | 257 | $(INSTALL) $(INSTALL_FLAGS) ./incmidir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ |
1c79356b A |
258 | ); \ |
259 | else \ | |
260 | echo Header file $$j not exported; \ | |
261 | fi; \ | |
262 | done; \ | |
91447636 A |
263 | fi; \ |
264 | if [ -n "$(strip $(INSTALL_MI_LCL_LIST))" ]; then \ | |
1c79356b A |
265 | if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ]; then \ |
266 | (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LCL_LIST) ); \ | |
91447636 | 267 | else \ |
1c79356b A |
268 | $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ |
269 | fi; \ | |
91447636 A |
270 | for j in $(INSTALL_MI_LCL_LIST); \ |
271 | do \ | |
272 | echo garbage > ./pincmidir/$$j.strip; \ | |
273 | $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \ | |
274 | $(SOURCE)/$$j > ./pincmidir/$$j || \ | |
275 | $(DECOMMENT) ./pincmidir/$$j r > \ | |
276 | ./pincmidir/$$j.strip; \ | |
277 | if [ -s ./pincmidir/$$j.strip ]; \ | |
278 | then ( \ | |
593a1d5f | 279 | $(INSTALL) $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ |
91447636 A |
280 | ); \ |
281 | else \ | |
282 | echo Header file $$j not exported; \ | |
283 | fi; \ | |
284 | done; \ | |
285 | fi; \ | |
286 | if [ -n "$(strip $(INSTALL_KF_MI_LIST))" ]; then \ | |
287 | if [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ]; then \ | |
288 | (cd $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MI_LIST) ); \ | |
289 | else \ | |
290 | $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ | |
9bccf70c | 291 | fi; \ |
91447636 A |
292 | for j in $(INSTALL_KF_MI_LIST); \ |
293 | do \ | |
294 | echo garbage > ./kincmidir/$$j.strip; \ | |
295 | $(UNIFDEF) $(KINCFRAME_UNIFDEF) \ | |
296 | $(SOURCE)/$$j > ./kincmidir/$$j || \ | |
297 | $(DECOMMENT) ./kincmidir/$$j r > \ | |
298 | ./kincmidir/$$j.strip; \ | |
299 | if [ -s ./kincmidir/$$j.strip ]; \ | |
300 | then ( \ | |
593a1d5f | 301 | $(INSTALL) $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ |
91447636 A |
302 | ); \ |
303 | else \ | |
304 | echo Header file $$j not exported; \ | |
305 | fi; \ | |
306 | done; \ | |
307 | fi; \ | |
308 | if [ -n "$(strip $(INSTALL_KF_MI_LCL_LIST))" ]; then \ | |
309 | if [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ]; then \ | |
310 | (cd $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MI_LCL_LIST) ); \ | |
311 | else \ | |
312 | $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ | |
313 | fi; \ | |
314 | for j in $(INSTALL_KF_MI_LCL_LIST); \ | |
315 | do \ | |
316 | echo garbage > ./kpincmidir/$$j.strip; \ | |
317 | $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \ | |
318 | $(SOURCE)/$$j > ./kpincmidir/$$j || \ | |
319 | $(DECOMMENT) ./kpincmidir/$$j r > \ | |
320 | ./kpincmidir/$$j.strip; \ | |
321 | if [ -s ./kpincmidir/$$j.strip ]; \ | |
322 | then ( \ | |
593a1d5f | 323 | $(INSTALL) $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ |
91447636 A |
324 | ); \ |
325 | else \ | |
326 | echo Header file $$j not exported; \ | |
327 | fi; \ | |
328 | done; \ | |
329 | fi; \ | |
330 | $(RM) -rf ./incmidir ./pincmidir ./kincmidir ./kpincmidir; | |
1c79356b A |
331 | |
332 | setup_installhdrs_md: | |
1c79356b | 333 | |
91447636 | 334 | do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INSTALL_KF_MD_GEN_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES) |
2d21ac55 A |
335 | @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
336 | $(_v)$(MKDIR) ./incdir ./pincdir ./kincdir ./kpincdir; \ | |
91447636 | 337 | if [ -n "$(strip $(INSTALL_MD_LIST))" ]; then \ |
1c79356b A |
338 | if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ]; then \ |
339 | (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LIST) ); \ | |
340 | else \ | |
341 | $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ | |
342 | fi; \ | |
1c79356b A |
343 | for j in $(INSTALL_MD_LIST); \ |
344 | do \ | |
345 | echo garbage > ./incdir/$$j.strip; \ | |
91447636 | 346 | $(UNIFDEF) $(SINCFRAME_UNIFDEF) \ |
1c79356b A |
347 | $(SOURCE)/$$j > ./incdir/$$j || \ |
348 | $(DECOMMENT) ./incdir/$$j r > \ | |
349 | ./incdir/$$j.strip; \ | |
350 | if [ -s ./incdir/$$j.strip ]; \ | |
351 | then ( \ | |
593a1d5f | 352 | $(INSTALL) $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ |
1c79356b A |
353 | ); \ |
354 | else \ | |
355 | echo Header file $$j not exported; \ | |
356 | fi; \ | |
357 | done; \ | |
91447636 A |
358 | fi; \ |
359 | if [ -n "$(strip $(INSTALL_MD_LCL_LIST))" ]; then \ | |
1c79356b A |
360 | if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ]; then \ |
361 | (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LCL_LIST) ); \ | |
362 | else \ | |
363 | $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ | |
364 | fi; \ | |
91447636 A |
365 | for j in $(INSTALL_MD_LCL_LIST); \ |
366 | do \ | |
367 | echo garbage > ./pincdir/$$j.strip; \ | |
368 | $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \ | |
369 | $(SOURCE)/$$j > ./pincdir/$$j || \ | |
370 | $(DECOMMENT) ./pincdir/$$j r > \ | |
371 | ./pincdir/$$j.strip; \ | |
372 | if [ -s ./pincdir/$$j.strip ]; \ | |
373 | then ( \ | |
593a1d5f | 374 | $(INSTALL) $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ |
91447636 A |
375 | ); \ |
376 | else \ | |
377 | echo Header file $$j not exported; \ | |
378 | fi; \ | |
379 | done; \ | |
380 | fi; \ | |
381 | if [ -n "$(strip $(INSTALL_KF_MD_LIST))" ]; then \ | |
382 | if [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ]; then \ | |
383 | (cd $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MD_LIST) ); \ | |
9bccf70c | 384 | else \ |
91447636 | 385 | $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ |
9bccf70c | 386 | fi; \ |
91447636 A |
387 | for j in $(INSTALL_KF_MD_LIST); \ |
388 | do \ | |
389 | echo garbage > ./kincdir/$$j.strip; \ | |
390 | $(UNIFDEF) $(KINCFRAME_UNIFDEF) \ | |
391 | $(SOURCE)/$$j > ./kincdir/$$j || \ | |
392 | $(DECOMMENT) ./kincdir/$$j r > \ | |
393 | ./kincdir/$$j.strip; \ | |
394 | if [ -s ./kincdir/$$j.strip ]; \ | |
395 | then ( \ | |
593a1d5f | 396 | $(INSTALL) $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ |
91447636 A |
397 | ); \ |
398 | else \ | |
399 | echo Header file $$j not exported; \ | |
400 | fi; \ | |
401 | done; \ | |
402 | fi; \ | |
403 | if [ -n "$(strip $(INSTALL_KF_MD_LCL_LIST))" ]; then \ | |
404 | if [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ]; then \ | |
405 | (cd $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MD_LCL_LIST) ); \ | |
406 | else \ | |
407 | $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ | |
408 | fi; \ | |
409 | for j in $(INSTALL_KF_MD_LCL_LIST); \ | |
410 | do \ | |
411 | echo garbage > ./kpincdir/$$j.strip; \ | |
412 | $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \ | |
413 | $(SOURCE)/$$j > ./kpincdir/$$j || \ | |
414 | $(DECOMMENT) ./kpincdir/$$j r > \ | |
415 | ./kpincdir/$$j.strip; \ | |
416 | if [ -s ./kpincdir/$$j.strip ]; \ | |
417 | then ( \ | |
593a1d5f | 418 | $(INSTALL) $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ |
91447636 A |
419 | ); \ |
420 | else \ | |
421 | echo Header file $$j not exported; \ | |
422 | fi; \ | |
423 | done; \ | |
424 | fi; \ | |
425 | $(RM) -rf ./incdir ./pincdir ./kincdir ./kpincdir; | |
1c79356b | 426 | |
1c79356b A |
427 | |
428 | # | |
429 | # Generic Export rules | |
430 | # | |
431 | ifeq ($(INCR_EXPORTHDRS), TRUE) | |
432 | ||
433 | EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST)) | |
434 | EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) | |
435 | ||
436 | $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | |
2d21ac55 A |
437 | @true echo Exporting $< in $(dir $@) |
438 | $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ | |
1c79356b A |
439 | ${CP} -p $< $(dir $@); \ |
440 | ||
441 | ||
442 | EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST)) | |
443 | EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) | |
444 | ||
445 | $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | |
2d21ac55 A |
446 | @true echo Exporting $< in $(dir $@) |
447 | $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ | |
1c79356b A |
448 | ${CP} -p $< $(dir $@); \ |
449 | ||
450 | setup_exporthdrs_mi: | |
1c79356b A |
451 | |
452 | do_exporthdrs_mi: $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES) | |
9bccf70c | 453 | @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
1c79356b A |
454 | |
455 | setup_exporthdrs_md: | |
1c79356b A |
456 | |
457 | do_exporthdrs_md: $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES) | |
9bccf70c | 458 | @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
1c79356b A |
459 | |
460 | else | |
461 | ||
462 | EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST)) | |
463 | EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) | |
464 | ||
465 | $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % | |
2d21ac55 A |
466 | @true echo Exporting $< in $(dir $@) |
467 | $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ | |
1c79356b A |
468 | ${CP} -p $< $(dir $@); \ |
469 | ||
470 | ||
471 | EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST)) | |
472 | EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) | |
473 | ||
474 | $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % | |
2d21ac55 A |
475 | @true echo Exporting $< in $(dir $@) |
476 | $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ | |
1c79356b A |
477 | ${CP} -p $< $(dir $@); \ |
478 | ||
479 | setup_exporthdrs_mi: | |
1c79356b A |
480 | |
481 | do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) | |
9bccf70c | 482 | @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
2d21ac55 | 483 | $(_v)if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \ |
1c79356b A |
484 | if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ]; then \ |
485 | (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(EXPORT_MI_LIST) ); \ | |
486 | else \ | |
487 | $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ | |
488 | fi; \ | |
489 | ${CP} -p $(EXPORT_MI_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ | |
490 | fi | |
491 | ||
492 | setup_exporthdrs_md: | |
1c79356b A |
493 | |
494 | do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) | |
9bccf70c | 495 | @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
2d21ac55 | 496 | $(_v)if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \ |
1c79356b A |
497 | if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ]; then \ |
498 | (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(EXPORT_MD_LIST) ); \ | |
499 | else \ | |
500 | $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ | |
501 | fi; \ | |
502 | ${CP} -p $(EXPORT_MD_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ | |
503 | fi | |
504 | ||
505 | ||
506 | # | |
507 | endif | |
508 | # | |
509 | # Generic Compilation rules | |
510 | # | |
511 | ||
512 | # | |
513 | # Compilation rules to generate .o from .s | |
514 | # | |
2d21ac55 | 515 | |
316670eb | 516 | S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -DASSEMBLER ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
b0d623f7 A |
517 | S_RULE_1B=$*.s |
518 | S_RULE_2=@echo AS $@ | |
519 | S_RULE_3= | |
1c79356b A |
520 | |
521 | # | |
522 | # Compilation rules to generate .o from .c for normal files | |
316670eb | 523 | # |
b0d623f7 | 524 | C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
1c79356b | 525 | C_RULE_1B=$*.c |
2d21ac55 | 526 | C_RULE_2=@echo CC $@ |
6d2010ae A |
527 | ifeq ($(BUILD_MACHO_OBJ),0) |
528 | C_RULE_3= | |
529 | else ifeq ($(BUILD_STABS),1) | |
1c79356b | 530 | C_RULE_3= |
316670eb A |
531 | else ifeq ($(BUILD_DWARF),1) |
532 | C_RULE_3=$(_v)${CTFCONVERT} -l xnu -v -o $@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $@.ctf || true; | |
2d21ac55 | 533 | else |
316670eb | 534 | C_RULE_3= |
2d21ac55 | 535 | endif |
1c79356b A |
536 | C_RULE_4= |
537 | ||
316670eb A |
538 | ifeq ($(ARCH_CONFIG),ARM) |
539 | ifeq ($(KERNEL_CONFIG),RELEASE) | |
540 | C_RULE_3= | |
541 | endif | |
542 | endif | |
543 | ||
1c79356b A |
544 | # |
545 | # Compilation rules to generate .o from .c for driver files | |
546 | # | |
547 | C_RULE_1A_D=${C_RULE_1A} | |
548 | C_RULE_1B_D=${C_RULE_1B} | |
549 | C_RULE_2_D=${C_RULE_2} | |
550 | C_RULE_3_D=${C_RULE_3} | |
551 | C_RULE_4_D=${C_RULE_4} | |
552 | ||
1c79356b A |
553 | # |
554 | # Compilation rules to generate .co from .cp or .cpo from .cpp | |
555 | # The config tool slickly changes the last source filename char to 'o' | |
556 | # for the object filename. | |
b0d623f7 | 557 | P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} |
1c79356b | 558 | P_RULE_1B=$(<F) |
2d21ac55 A |
559 | P_RULE_2=$(_v)sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d) |
560 | P_RULE_3=@echo C++ $@ | |
6d2010ae A |
561 | ifeq ($(BUILD_MACHO_OBJ),0) |
562 | P_RULE_4= | |
563 | else ifeq ($(BUILD_STABS),1) | |
2d21ac55 | 564 | P_RULE_4= |
316670eb A |
565 | else ifeq ($(BUILD_DWARF),1) |
566 | P_RULE_4=$(_v)${CTFCONVERT} -l xnu -v -o $@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $@.ctf || true; | |
2d21ac55 | 567 | else |
316670eb | 568 | P_RULE_4= |
2d21ac55 | 569 | endif |
1c79356b | 570 | |
316670eb A |
571 | ifeq ($(ARCH_CONFIG),ARM) |
572 | ifeq ($(KERNEL_CONFIG),RELEASE) | |
573 | P_RULE_4= | |
574 | endif | |
575 | endif | |
1c79356b A |
576 | |
577 | setup_build_all: | |
1c79356b A |
578 | |
579 | do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE) | |
1c79356b | 580 | |
1c79356b A |
581 | # |
582 | # mach_kernel building rules | |
583 | # | |
b0d623f7 A |
584 | ifeq ($(COMPONENT), .) |
585 | do_build_all: do_build_mach_kernel | |
586 | ||
587 | STATIC_KMODS = $(SRCROOT)/kmods.a | |
588 | ||
589 | do_build_mach_kernel: $(TARGET)/kgmacros $(TARGET)/mach_kernel | |
590 | ||
6d2010ae | 591 | $(TARGET)/mach_kernel: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .filelist, $(component))))) lastkernelconstructor.o |
b0d623f7 | 592 | $(_v)${MAKE} version.o |
b7266188 | 593 | $(_v)${MAKE} build_mach_kernel_exports |
2d21ac55 | 594 | @echo LD mach_kernel.sys |
6d2010ae A |
595 | $(_v)$(CAT) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .filelist, $(component))))) < /dev/null > link.filelist |
596 | $(_v)$(LD) $(LDFLAGS_KERNEL) -filelist link.filelist version.o lastkernelconstructor.o `if [ -e $(STATIC_KMODS) ]; then echo $(STATIC_KMODS); fi` \ | |
b0d623f7 | 597 | -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS) |
2d21ac55 | 598 | $(_v)if [ $(BUILD_DWARF) -eq 1 ]; then \ |
6d2010ae | 599 | echo DSYMUTIL mach_kernel.sys; \ |
2d21ac55 | 600 | $(DSYMUTIL) $(DSYMUTIL_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel.sys.dSYM > /dev/null; \ |
316670eb | 601 | $(MKDIR) $(TARGET)/mach_kernel.sys.dSYM/$(DSYMRESDIR); \ |
6d2010ae A |
602 | $(INSTALL) $(INSTALL_FLAGS) $(SRCROOT)/kgmacros $(TARGET)/mach_kernel.sys.dSYM/$(DSYMRESDIR)/kgmacros; \ |
603 | fi; | |
604 | $(_v)if [ $(MACHINE_CONFIG) != DEFAULT ] ; then \ | |
605 | kernel_file_name=mach.`printf "%s" "$(KERNEL_CONFIG)" | $(TR) A-Z a-z`.`printf "%s" "$(MACHINE_CONFIG)" | $(TR) A-Z a-z`; \ | |
606 | echo kernel_file_name $${kernel_file_name}; \ | |
607 | [ -h ${OBJROOT}/$${kernel_file_name} ] || $(LN) $(TARGET)/mach_kernel ${OBJROOT}/$${kernel_file_name}; \ | |
2d21ac55 A |
608 | fi; |
609 | @echo STRIP mach_kernel | |
610 | $(_v)$(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel | |
316670eb A |
611 | |
612 | $(_v)kernel_config=$(KERNEL_CONFIG); \ | |
613 | onearch=$(ARCH_CONFIG); \ | |
614 | skip_ctf=FALSE; \ | |
615 | if [ $${kernel_config} = RELEASE ]; then \ | |
616 | if [[ $${onearch} = ARM ]]; then \ | |
617 | skip_ctf=TRUE; \ | |
618 | echo "Skipping CTF processing"; \ | |
619 | fi \ | |
620 | fi; \ | |
621 | if [ $${skip_ctf} = FALSE ]; then \ | |
622 | if [ $(BUILD_MACHO_OBJ) -eq 1 -a $(BUILD_DWARF) -eq 1 ]; then \ | |
6d2010ae | 623 | echo CTFMERGE mach_kernel; \ |
b0d623f7 A |
624 | $(FIND) $(OBJPATH)/ -name \*.ctf -size 0 \ |
625 | -exec $(RM) -rf {} \; ; \ | |
316670eb A |
626 | $(FIND) $(OBJPATH)/ -name \*.ctf | \ |
627 | $(XARGS) $(CTFMERGE) -l xnu -o $(TARGET)/mach_kernel \ | |
628 | -Z $(TARGET)/mach_kernel.ctfdata || true; \ | |
6d2010ae A |
629 | echo CTFINSERT mach_kernel; \ |
630 | $(CTFINSERT) $(TARGET)/mach_kernel \ | |
631 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) $(TARGET)/mach_kernel.ctfdata \ | |
632 | -o $(TARGET)/mach_kernel || true; \ | |
633 | $(RM) -f $(TARGET)/mach_kernel.ctfdata > /dev/null || true; \ | |
b0d623f7 | 634 | fi; \ |
316670eb | 635 | fi; \ |
b0d623f7 A |
636 | |
637 | version.o: $(OBJPATH)/version.c | |
638 | ${C_RULE_1A}$< | |
639 | ${C_RULE_2} | |
640 | ${C_RULE_4} | |
55e303ae | 641 | |
b0d623f7 A |
642 | .PHONY: $(OBJPATH)/version.c |
643 | $(OBJPATH)/version.c: $(SRCROOT)/config/version.c $(NEWVERS) $(SRCROOT)/config/MasterVersion | |
644 | $(_v)$(CP) $< $@ | |
645 | $(_v)$(NEWVERS) $(OBJPATH)/version.c > /dev/null; | |
646 | ||
6d2010ae A |
647 | # "/libsa" needed because TARGET ends in "/." |
648 | lastkernelconstructor.o: COMP_OBJ_DIR=/libsa | |
b0d623f7 | 649 | lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c |
6d2010ae | 650 | $(_v)$(MKDIR) $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG) |
b0d623f7 A |
651 | ${C_RULE_1A}$< |
652 | ${C_RULE_2} | |
6d2010ae | 653 | ${C_RULE_3} |
b0d623f7 A |
654 | ${C_RULE_4} |
655 | ||
656 | $(TARGET)/kgmacros: $(SRCROOT)/kgmacros | |
593a1d5f | 657 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $? $@ |
1c79356b | 658 | |
b7266188 A |
659 | .PHONY: build_mach_kernel_exports |
660 | build_mach_kernel_exports: | |
661 | $(_v)${MAKE} \ | |
662 | MAKEFILES=${SOURCE}/config/Makefile \ | |
663 | SOURCE=${SOURCE}/config \ | |
316670eb | 664 | RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH}/config \ |
b7266188 A |
665 | TARGET=$${TARGET} \ |
666 | build_mach_kernel_exports; | |
667 | ||
b0d623f7 | 668 | endif # mach_kernel-specific build rules |
2d21ac55 A |
669 | |
670 | # | |
6d2010ae | 671 | # Kernel Install rules |
2d21ac55 | 672 | # |
6d2010ae | 673 | INSTALL_KERNEL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_KERNEL_DIR), $(INSTALL_KERNEL_FILE)) |
2d21ac55 | 674 | |
6d2010ae | 675 | force_kernel_file_install: |
2d21ac55 | 676 | |
6d2010ae | 677 | $(INSTALL_KERNEL_FILE_FILES): $(TARGET)/mach_kernel force_kernel_file_install |
2d21ac55 | 678 | @echo Installing $< in $@; |
6d2010ae A |
679 | $(_v)if [ ! -e $(DSTROOT)$(INSTALL_KERNEL_DIR) ]; then \ |
680 | $(MKDIR) $(DSTROOT)$(INSTALL_KERNEL_DIR); \ | |
2d21ac55 A |
681 | fi; \ |
682 | if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ | |
683 | $(RM) $(RMFLAGS) $@; \ | |
b0d623f7 | 684 | $(INSTALL) $(FILE_INSTALL_FLAGS) $< $@; \ |
2d21ac55 A |
685 | else \ |
686 | if [ ! -e $@ ]; then \ | |
b0d623f7 A |
687 | printf "" >empty_file_$(notdir $@); \ |
688 | lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_file_$(notdir $@))"; \ | |
2d21ac55 A |
689 | $(LIPO) $${lipo_arg} -create -output $@; \ |
690 | $(RM) $(RMFLAGS) empty_file_$(notdir $@); \ | |
691 | fi; \ | |
b0d623f7 | 692 | $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ |
2d21ac55 A |
693 | fi |
694 | ||
6d2010ae | 695 | INSTALL_KERNEL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_KERNEL_DIR), $(INSTALL_KERNEL_FILE)) |
316670eb A |
696 | ifeq ($(PLATFORM),iPhoneOS) |
697 | INSTALL_KERNEL_FILESYS_FILES += $(addprefix $(DSTROOT)$(INSTALL_KERNEL_SYM_DIR), $(INSTALL_KERNEL_FILE)) | |
698 | endif | |
1c79356b | 699 | |
6d2010ae | 700 | force_kernel_filesys_install: |
1c79356b | 701 | |
6d2010ae | 702 | $(INSTALL_KERNEL_FILESYS_FILES): $(TARGET)/mach_kernel.sys force_kernel_filesys_install |
1c79356b | 703 | @echo Installing $< in $@; |
316670eb A |
704 | ifeq ($(PLATFORM),iPhoneOS) |
705 | $(_v)if [ ! -e $(DSTROOT)$(INSTALL_KERNEL_SYM_DIR) ]; then \ | |
706 | $(MKDIR) $(DSTROOT)$(INSTALL_KERNEL_SYM_DIR); \ | |
707 | fi; | |
708 | endif | |
6d2010ae A |
709 | $(_v)if [ ! -e $(SYMROOT)$(INSTALL_KERNEL_DIR) ]; then \ |
710 | $(MKDIR) $(SYMROOT)$(INSTALL_KERNEL_DIR); \ | |
55e303ae | 711 | fi; \ |
0b4e3aa0 | 712 | if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ |
1c79356b | 713 | $(RM) $(RMFLAGS) $@; \ |
593a1d5f | 714 | $(INSTALL) $(INSTALL_FLAGS) $< $@; \ |
2d21ac55 | 715 | if [ $(BUILD_DWARF) -eq 1 ]; then \ |
2d21ac55 A |
716 | $(RM) -rf $@.dSYM; \ |
717 | $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \ | |
593a1d5f | 718 | $(INSTALL) $(INSTALL_FLAGS) \ |
2d21ac55 A |
719 | $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \ |
720 | $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ | |
6d2010ae A |
721 | $(INSTALL) $(INSTALL_FLAGS) \ |
722 | $<.dSYM/$(DSYMRESDIR)/kgmacros \ | |
723 | $@.dSYM/$(DSYMRESDIR)/kgmacros; \ | |
2d21ac55 | 724 | fi; \ |
1c79356b A |
725 | else \ |
726 | if [ ! -e $@ ]; then \ | |
b0d623f7 A |
727 | printf "" >empty_filesys_$(notdir $@); \ |
728 | lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_filesys_$(notdir $@))"; \ | |
1c79356b | 729 | $(LIPO) $${lipo_arg} -create -output $@; \ |
2d21ac55 | 730 | $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \ |
55e303ae | 731 | fi; \ |
b0d623f7 | 732 | $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ |
2d21ac55 A |
733 | \ |
734 | if [ $(BUILD_DWARF) -eq 1 ]; then \ | |
735 | if [ ! -e $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) ]; then \ | |
b0d623f7 A |
736 | printf "" >empty_filesys_$(notdir $@); \ |
737 | lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_filesys_$(notdir $@))"; \ | |
2d21ac55 A |
738 | $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \ |
739 | $(LIPO) $${lipo_arg} -create \ | |
740 | -output \ | |
741 | $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ | |
742 | $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \ | |
743 | fi; \ | |
2d21ac55 | 744 | $(LIPO) $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) \ |
b0d623f7 | 745 | -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) \ |
2d21ac55 A |
746 | $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \ |
747 | -o $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ | |
6d2010ae A |
748 | $(INSTALL) $(INSTALL_FLAGS) \ |
749 | $<.dSYM/$(DSYMRESDIR)/kgmacros \ | |
750 | $@.dSYM/$(DSYMRESDIR)/kgmacros; \ | |
2d21ac55 | 751 | fi; \ |
1c79356b | 752 | fi |
593a1d5f | 753 | $(INSTALL) $(INSTALL_FLAGS) $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR) |
1c79356b A |
754 | |
755 | setup_build_install: | |
756 | @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" | |
757 | ||
6d2010ae | 758 | do_build_install: $(INSTALL_KERNEL_FILESYS_FILES) $(INSTALL_KERNEL_FILE_FILES) |
1c79356b A |
759 | @echo "[ $(SOURCE) ] make do_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
760 | ||
9bccf70c A |
761 | INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST)) |
762 | ||
763 | do_installman: $(INSTALL_MAN_FILES) | |
764 | @echo "[ $(SOURCE) ] make do_installman" | |
2d21ac55 | 765 | $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \ |
9bccf70c A |
766 | man_dir=$(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \ |
767 | if [ -d $$man_dir ]; then \ | |
2d21ac55 A |
768 | ( cd $$man_dir; \ |
769 | $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS)); \ | |
9bccf70c A |
770 | else \ |
771 | $(MKDIR) $$man_dir; \ | |
772 | fi; \ | |
773 | echo Installing $(INSTALL_MAN_LIST) in $$man_dir; \ | |
593a1d5f | 774 | $(INSTALL) $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \ |
91447636 A |
775 | if [ -n "$(strip $(INSTALL_MAN_LINKS))" ]; then \ |
776 | set `echo ${INSTALL_MAN_LINKS}`; \ | |
777 | while : ; do \ | |
778 | case $$# in \ | |
779 | 0) break;; \ | |
780 | 1) echo "warn: empty INSTALL_MAN_LINKS: $$1"; break;; \ | |
781 | esac; \ | |
782 | link_src=$$1; shift; link_dst=$$1; shift; \ | |
783 | echo "hard linking $${link_src} to $${link_dst}"; \ | |
784 | ln -f $${man_dir}/$${link_src} $${man_dir}/$${link_dst} ; \ | |
785 | done; \ | |
786 | fi; \ | |
9bccf70c A |
787 | fi |
788 | ||
789 | $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | |
2d21ac55 A |
790 | @true echo Installing $< in $(dir $@) |
791 | $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \ | |
9bccf70c | 792 | $(RM) $(RMFLAGS) $@; \ |
593a1d5f | 793 | $(INSTALL) $(INSTALL_FLAGS) $< $(dir $@); |
9bccf70c | 794 | |
0b4e3aa0 | 795 | ifeq ($(INCL_MAKEDEP), TRUE) |
1c79356b | 796 | -include Makedep |
0b4e3aa0 | 797 | endif |
1c79356b | 798 | |
b0d623f7 A |
799 | help: |
800 | @cat README | |
801 | ||
2d21ac55 | 802 | # vim: set ft=make: |