]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.rule
xnu-792.22.5.tar.gz
[apple/xnu.git] / makedefs / MakeInc.rule
1 #
2 # Generic Install rules
3 #
4
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
21 ifndef INSTALL_KF_MI_LCL_LIST
22 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
23 endif
24
25 ifndef INSTALL_KF_MI_LCL_GEN_LIST
26 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
27 endif
28
29 ifndef INSTALL_KF_MD_LCL_LIST
30 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
31 endif
32
33 ifndef INSTALL_KF_MD_LCL_GEN_LIST
34 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
35 endif
36
37 ifndef INSTALL_KF_MI_LIST
38 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
39 endif
40
41 ifndef INSTALL_KF_MI_GEN_LIST
42 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
43 endif
44
45 ifndef INSTALL_KF_MD_LIST
46 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
47 endif
48
49 ifndef INSTALL_KF_MD_GEN_LIST
50 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
51 endif
52
53 INSTALL_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
54
55 $(INSTALL_MI_GEN_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : %
56 @true echo Installing $< in $(dir $@); \
57 [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
58 filename=`$(BASENAME) $<`; \
59 filename_strip=$(addsuffix .strip,$${filename}); \
60 $(RM) $(RMFLAGS) $@; \
61 [ -d ./incmidir ] || $(MKDIR) ./incmidir; \
62 echo garbage > ./incmidir/$${filename_strip}; \
63 $(UNIFDEF) $(SINCFRAME_UNIFDEF) \
64 $< > ./incmidir/$${filename} || \
65 $(DECOMMENT) ./incmidir/$${filename} r > \
66 ./incmidir/$${filename_strip}; \
67 if [ -s ./incmidir/$${filename_strip} ]; \
68 then ( \
69 install $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\
70 ); \
71 else \
72 echo Header file $< not exported; \
73 fi;
74
75 INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
76
77 $(INSTALL_KF_MI_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/% : %
78 @true echo Installing $< in $(midir $@); \
79 [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
80 filename=`$(BASENAME) $<`; \
81 filename_strip=$(addsuffix .strip,$${filename}); \
82 $(RM) $(RMFLAGS) $@; \
83 [ -d ./kincmidir ] || $(MKDIR) ./kincmidir; \
84 echo garbage > ./kincmidir/$${filename_strip}; \
85 $(UNIFDEF) $(KINCFRAME_UNIFDEF) \
86 $< > ./kincmidir/$${filename} || \
87 $(DECOMMENT) ./kincmidir/$${filename} r > \
88 ./kincmidir/$${filename_strip}; \
89 if [ -s ./kincmidir/$${filename_strip} ]; \
90 then ( \
91 install $(INSTALL_FLAGS) ./kincmidir/$${filename} $(dir $@);\
92 ); \
93 else \
94 echo Header file $< not exported; \
95 fi;
96
97 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
98
99 $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : %
100 @true echo Installing $< in $(dir $@); \
101 [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
102 filename=`$(BASENAME) $<`; \
103 filename_strip=$(addsuffix .strip,$${filename}); \
104 $(RM) $(RMFLAGS) $@; \
105 [ -d ./pincmidir ] || $(MKDIR) ./pincmidir; \
106 echo garbage > ./pincmidir/$${filename_strip}; \
107 $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \
108 $< > ./pincmidir/$${filename} || \
109 $(DECOMMENT) ./pincmidir/$${filename} r > \
110 ./pincmidir/$${filename_strip}; \
111 if [ -s ./pincmidir/$${filename_strip} ]; \
112 then ( \
113 install $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\
114 ); \
115 else \
116 echo Header file $< not exported; \
117 fi;
118
119 INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
120
121 $(INSTALL_KF_MI_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/% : %
122 @true echo Installing $< in $(dir $@); \
123 [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
124 filename=`$(BASENAME) $<`; \
125 filename_strip=$(addsuffix .strip,$${filename}); \
126 $(RM) $(RMFLAGS) $@; \
127 [ -d ./kpincmidir ] || $(MKDIR) ./kpincmidir; \
128 echo garbage > ./kpincmidir/$${filename_strip}; \
129 $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \
130 $< > ./kpincmidir/$${filename} || \
131 $(DECOMMENT) ./kpincmidir/$${filename} r > \
132 ./kpincmidir/$${filename_strip}; \
133 if [ -s ./kpincmidir/$${filename_strip} ]; \
134 then ( \
135 install $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\
136 ); \
137 else \
138 echo Header file $< not exported; \
139 fi;
140
141 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
142
143 $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : %
144 @true echo Installing $< in $(dir $@); \
145 [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
146 filename=`$(BASENAME) $<`; \
147 filename_strip=$(addsuffix .strip,$${filename}); \
148 $(RM) $(RMFLAGS) $@; \
149 [ -d ./incdir ] || $(MKDIR) ./incdir; \
150 echo garbage > ./incdir/$${filename_strip}; \
151 $(UNIFDEF) $(SINCFRAME_UNIFDEF) \
152 $< > ./incdir/$${filename} || \
153 $(DECOMMENT) ./incdir/$${filename} r > \
154 ./incdir/$${filename_strip}; \
155 if [ -s ./incdir/$${filename_strip} ]; \
156 then ( \
157 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
158 ); \
159 else \
160 echo Header file $< not exported; \
161 fi;
162
163 INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
164
165 $(INSTALL_KF_MD_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/% : %
166 @true echo Installing $< in $(dir $@); \
167 [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
168 filename=`$(BASENAME) $<`; \
169 filename_strip=$(addsuffix .strip,$${filename}); \
170 $(RM) $(RMFLAGS) $@; \
171 [ -d ./kincdir ] || $(MKDIR) ./kincdir; \
172 echo garbage > ./kincdir/$${filename_strip}; \
173 $(UNIFDEF) $(KINCFRAME_UNIFDEF) \
174 $< > ./kincdir/$${filename} || \
175 $(DECOMMENT) ./kincdir/$${filename} r > \
176 ./kincdir/$${filename_strip}; \
177 if [ -s ./kincdir/$${filename_strip} ]; \
178 then ( \
179 install $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\
180 ); \
181 else \
182 echo Header file $< not exported; \
183 fi;
184
185 INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST))
186 INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST))
187
188 $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : %
189 @true echo Installing $< in $(dir $@); \
190 [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
191 filename=`$(BASENAME) $<`; \
192 filename_strip=$(addsuffix .strip,$${filename}); \
193 $(RM) $(RMFLAGS) $@; \
194 [ -d ./pincdir ] || $(MKDIR) ./pincdir; \
195 echo garbage > ./pincdir/$${filename_strip}; \
196 $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \
197 $< > ./pincdir/$${filename} || \
198 $(DECOMMENT) ./pincdir/$${filename} r > \
199 ./pincdir/$${filename_strip}; \
200 if [ -s ./pincdir/$${filename_strip} ]; \
201 then ( \
202 install $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\
203 ); \
204 else \
205 echo Header file $< not exported; \
206 fi;
207
208 INSTALL_KF_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_KF_MD_LCL_LIST))
209 INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST))
210
211 $(INSTALL_KF_MD_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/% : %
212 @true echo Installing $< in $(dir $@); \
213 [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
214 filename=`$(BASENAME) $<`; \
215 filename_strip=$(addsuffix .strip,$${filename}); \
216 $(RM) $(RMFLAGS) $@; \
217 [ -d ./kpincdir ] || $(MKDIR) ./kpincdir; \
218 echo garbage > ./kpincdir/$${filename_strip}; \
219 $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \
220 $< > ./kpincdir/$${filename} || \
221 $(DECOMMENT) ./kpincdir/$${filename} r > \
222 ./kpincdir/$${filename_strip}; \
223 if [ -s ./kpincdir/$${filename_strip} ]; \
224 then ( \
225 install $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\
226 ); \
227 else \
228 echo Header file $< not exported; \
229 fi;
230
231 setup_installhdrs_mi:
232 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
233
234 do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL_KF_MI_GEN_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES)
235 @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
236 $(MKDIR) ./incmidir ./pincmidir ./kincmidir ./kpincmidir; \
237 if [ -n "$(strip $(INSTALL_MI_LIST))" ]; then \
238 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ]; then \
239 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LIST) ); \
240 else \
241 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
242 fi; \
243 for j in $(INSTALL_MI_LIST); \
244 do \
245 echo garbage > ./incmidir/$$j.strip; \
246 $(UNIFDEF) $(SINCFRAME_UNIFDEF) \
247 $(SOURCE)/$$j > ./incmidir/$$j || \
248 $(DECOMMENT) ./incmidir/$$j r > \
249 ./incmidir/$$j.strip; \
250 if [ -s ./incmidir/$$j.strip ]; \
251 then ( \
252 install $(INSTALL_FLAGS) ./incmidir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
253 ); \
254 else \
255 echo Header file $$j not exported; \
256 fi; \
257 done; \
258 fi; \
259 if [ -n "$(strip $(INSTALL_MI_LCL_LIST))" ]; then \
260 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ]; then \
261 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LCL_LIST) ); \
262 else \
263 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
264 fi; \
265 for j in $(INSTALL_MI_LCL_LIST); \
266 do \
267 echo garbage > ./pincmidir/$$j.strip; \
268 $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \
269 $(SOURCE)/$$j > ./pincmidir/$$j || \
270 $(DECOMMENT) ./pincmidir/$$j r > \
271 ./pincmidir/$$j.strip; \
272 if [ -s ./pincmidir/$$j.strip ]; \
273 then ( \
274 install $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
275 ); \
276 else \
277 echo Header file $$j not exported; \
278 fi; \
279 done; \
280 fi; \
281 if [ -n "$(strip $(INSTALL_KF_MI_LIST))" ]; then \
282 if [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ]; then \
283 (cd $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MI_LIST) ); \
284 else \
285 $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
286 fi; \
287 for j in $(INSTALL_KF_MI_LIST); \
288 do \
289 echo garbage > ./kincmidir/$$j.strip; \
290 $(UNIFDEF) $(KINCFRAME_UNIFDEF) \
291 $(SOURCE)/$$j > ./kincmidir/$$j || \
292 $(DECOMMENT) ./kincmidir/$$j r > \
293 ./kincmidir/$$j.strip; \
294 if [ -s ./kincmidir/$$j.strip ]; \
295 then ( \
296 install $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
297 ); \
298 else \
299 echo Header file $$j not exported; \
300 fi; \
301 done; \
302 fi; \
303 if [ -n "$(strip $(INSTALL_KF_MI_LCL_LIST))" ]; then \
304 if [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ]; then \
305 (cd $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MI_LCL_LIST) ); \
306 else \
307 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
308 fi; \
309 for j in $(INSTALL_KF_MI_LCL_LIST); \
310 do \
311 echo garbage > ./kpincmidir/$$j.strip; \
312 $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \
313 $(SOURCE)/$$j > ./kpincmidir/$$j || \
314 $(DECOMMENT) ./kpincmidir/$$j r > \
315 ./kpincmidir/$$j.strip; \
316 if [ -s ./kpincmidir/$$j.strip ]; \
317 then ( \
318 install $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
319 ); \
320 else \
321 echo Header file $$j not exported; \
322 fi; \
323 done; \
324 fi; \
325 $(RM) -rf ./incmidir ./pincmidir ./kincmidir ./kpincmidir;
326
327 setup_installhdrs_md:
328 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
329
330 do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INSTALL_KF_MD_GEN_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
331 @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
332 $(MKDIR) ./incdir ./pincdir ./kincdir ./kpincdir; \
333 if [ -n "$(strip $(INSTALL_MD_LIST))" ]; then \
334 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ]; then \
335 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LIST) ); \
336 else \
337 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
338 fi; \
339 for j in $(INSTALL_MD_LIST); \
340 do \
341 echo garbage > ./incdir/$$j.strip; \
342 $(UNIFDEF) $(SINCFRAME_UNIFDEF) \
343 $(SOURCE)/$$j > ./incdir/$$j || \
344 $(DECOMMENT) ./incdir/$$j r > \
345 ./incdir/$$j.strip; \
346 if [ -s ./incdir/$$j.strip ]; \
347 then ( \
348 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
349 ); \
350 else \
351 echo Header file $$j not exported; \
352 fi; \
353 done; \
354 fi; \
355 if [ -n "$(strip $(INSTALL_MD_LCL_LIST))" ]; then \
356 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ]; then \
357 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LCL_LIST) ); \
358 else \
359 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
360 fi; \
361 for j in $(INSTALL_MD_LCL_LIST); \
362 do \
363 echo garbage > ./pincdir/$$j.strip; \
364 $(UNIFDEF) $(SPINCFRAME_UNIFDEF) \
365 $(SOURCE)/$$j > ./pincdir/$$j || \
366 $(DECOMMENT) ./pincdir/$$j r > \
367 ./pincdir/$$j.strip; \
368 if [ -s ./pincdir/$$j.strip ]; \
369 then ( \
370 install $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
371 ); \
372 else \
373 echo Header file $$j not exported; \
374 fi; \
375 done; \
376 fi; \
377 if [ -n "$(strip $(INSTALL_KF_MD_LIST))" ]; then \
378 if [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ]; then \
379 (cd $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MD_LIST) ); \
380 else \
381 $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
382 fi; \
383 for j in $(INSTALL_KF_MD_LIST); \
384 do \
385 echo garbage > ./kincdir/$$j.strip; \
386 $(UNIFDEF) $(KINCFRAME_UNIFDEF) \
387 $(SOURCE)/$$j > ./kincdir/$$j || \
388 $(DECOMMENT) ./kincdir/$$j r > \
389 ./kincdir/$$j.strip; \
390 if [ -s ./kincdir/$$j.strip ]; \
391 then ( \
392 install $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
393 ); \
394 else \
395 echo Header file $$j not exported; \
396 fi; \
397 done; \
398 fi; \
399 if [ -n "$(strip $(INSTALL_KF_MD_LCL_LIST))" ]; then \
400 if [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ]; then \
401 (cd $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_KF_MD_LCL_LIST) ); \
402 else \
403 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
404 fi; \
405 for j in $(INSTALL_KF_MD_LCL_LIST); \
406 do \
407 echo garbage > ./kpincdir/$$j.strip; \
408 $(UNIFDEF) $(KPINCFRAME_UNIFDEF) \
409 $(SOURCE)/$$j > ./kpincdir/$$j || \
410 $(DECOMMENT) ./kpincdir/$$j r > \
411 ./kpincdir/$$j.strip; \
412 if [ -s ./kpincdir/$$j.strip ]; \
413 then ( \
414 install $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
415 ); \
416 else \
417 echo Header file $$j not exported; \
418 fi; \
419 done; \
420 fi; \
421 $(RM) -rf ./incdir ./pincdir ./kincdir ./kpincdir;
422
423
424 #
425 # Generic Export rules
426 #
427 ifeq ($(INCR_EXPORTHDRS), TRUE)
428
429 EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
430 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
431
432 $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
433 @true echo Exporting $< in $(dir $@); \
434 [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
435 ${CP} -p $< $(dir $@); \
436
437
438 EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
439 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
440
441 $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
442 @true echo Exporting $< in $(dir $@); \
443 [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
444 ${CP} -p $< $(dir $@); \
445
446 setup_exporthdrs_mi:
447 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
448
449 do_exporthdrs_mi: $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES)
450 @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
451
452 setup_exporthdrs_md:
453 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
454
455 do_exporthdrs_md: $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES)
456 @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
457
458 else
459
460 EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST))
461 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
462
463 $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
464 @true echo Exporting $< in $(dir $@); \
465 [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
466 ${CP} -p $< $(dir $@); \
467
468
469 EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST))
470 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
471
472 $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
473 @true echo Exporting $< in $(dir $@); \
474 [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
475 ${CP} -p $< $(dir $@); \
476
477 setup_exporthdrs_mi:
478 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
479
480 do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES)
481 @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
482 @if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \
483 if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ]; then \
484 (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(EXPORT_MI_LIST) ); \
485 else \
486 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
487 fi; \
488 ${CP} -p $(EXPORT_MI_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
489 fi
490
491 setup_exporthdrs_md:
492 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
493
494 do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES)
495 @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
496 @if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \
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 #
515 COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST))
516
517 $(COMP_SOBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.s
518 ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< > $(patsubst %.o, %.pp, ${@});
519 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
520 ${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});
521 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});
522
523 S_RULE_1A=@ls /
524 S_RULE_1B= ${patsubst %.o,%.s,${@}} > /dev/null
525 S_RULE_2= ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< \
526 > $(patsubst %.o, %.pp, ${@}); \
527 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
528 S_RULE_3= ${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\
529 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@})
530
531 #
532 # Compilation rules to generate .o from .c
533 #
534 COMP_COBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_COBJ_LIST))
535
536 $(COMP_COBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.c
537 ${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $<
538
539 #
540 # Compilation rules to generate .o from .c for normal files
541 #
542 C_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
543 C_RULE_1B=$*.c
544 C_RULE_2=
545 C_RULE_3=
546 C_RULE_4=
547
548 #
549 # Compilation rules to generate .o from .c for driver files
550 #
551 C_RULE_1A_D=${C_RULE_1A}
552 C_RULE_1B_D=${C_RULE_1B}
553 C_RULE_2_D=${C_RULE_2}
554 C_RULE_3_D=${C_RULE_3}
555 C_RULE_4_D=${C_RULE_4}
556
557 #
558 # Compilation rules to generate .o from .m
559 #
560 M_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${MWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
561 M_RULE_1B=$*.m
562 M_RULE_2=
563 M_RULE_3=
564 M_RULE_4=
565
566 #
567 # Compilation rules to generate .co from .cp or .cpo from .cpp
568 # The config tool slickly changes the last source filename char to 'o'
569 # for the object filename.
570 #
571 P_RULE_1A=${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
572 P_RULE_1B=$(<F)
573 P_RULE_2=@sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d)
574 P_RULE_3=
575 P_RULE_4=
576
577 #
578 # Linker rule to generate a component
579 #
580 LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST))
581
582 COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE))
583
584 $(COMPONENT_IMAGE_FILE): $(LD_COMPONENT_OBJ_FILES)
585 @echo "[ creating $(COMPONENT_IMAGE) ]"
586 $(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT_IMAGE_FILE) ${LD_COMPONENT_OBJ_FILES};
587 (cd $(TARGET)$(COMP_OBJ_DIR); ${MD} -u Makedep -f -d `ls *.d`);
588
589 setup_build_all:
590 @echo "[ $(SOURCE) ] make setup_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
591
592 do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE)
593 @true echo "[ $(SOURCE) ] make do_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
594
595 ifeq ($(COMPONENT), .)
596 do_build_all: do_build_mach_kernel
597 endif
598
599 #
600 # mach_kernel building rules
601 #
602 do_build_mach_kernel: $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kgmacros
603 @echo "[ building mach_kernel ]";
604 @install $(DATA_INSTALL_FLAGS) $(SRCROOT)/config/version.c $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c;
605 @$(SRCROOT)/config/newvers.pl $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c;
606 ${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS}} ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c -o $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.o
607 $(LD) $(LDFLAGS_KERNEL) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf "%s" "$(component)" | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.o -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS); \
608 $(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel;
609
610 $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kgmacros: $(SRCROOT)/kgmacros
611 cp $? $@
612
613 #
614 # Generic Install rules
615 #
616 INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
617
618 force_file_install:
619
620 $(INSTALL_FILE_FILES): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/% force_file_install
621 @echo Installing $< in $@;
622 @if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \
623 $(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \
624 fi; \
625 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
626 $(RM) $(RMFLAGS) $@; \
627 install $(FILE_INSTALL_FLAGS) $< $(dir $@); \
628 else \
629 if [ ! -e $@ ]; then \
630 echo >empty_file_$(notdir $@); \
631 lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
632 $(LIPO) $${lipo_arg} -create -output $@; \
633 $(RM) $(RMFLAGS) empty_file_$(notdir $@); \
634 fi; \
635 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
636 fi
637
638 INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
639
640 force_filesys_install:
641
642 $(INSTALL_FILESYS_FILES): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/%.sys force_filesys_install
643 @echo Installing $< in $@;
644 @if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \
645 $(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \
646 fi; \
647 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
648 $(RM) $(RMFLAGS) $@; \
649 install $(INSTALL_FLAGS) $< $(dir $@); \
650 else \
651 if [ ! -e $@ ]; then \
652 echo >empty_filesys_$(notdir $@); \
653 lipo_arg="$(subst _empty_file, empty_filesys_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
654 $(LIPO) $${lipo_arg} -create -output $@; \
655 $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \
656 fi; \
657 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
658 fi
659 cp $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR)
660
661 INSTALL_DATA_FILES = $(addprefix $(DSTROOT)$(INSTALL_DATA_DIR), $(INSTALL_DATA_LIST))
662
663 $(INSTALL_DATA_FILES): $(DSTROOT)$(INSTALL_DATA_DIR)% : $(SOURCE)/%
664 @echo Installing $< in $@;
665 @[ -d $(dir $@) ] ||$(MKDIR) $(dir $@); \
666 $(RM) $(RMFLAGS) $@; \
667 install $(DATA_INSTALL_FLAGS) $< $(dir $@);
668
669 setup_build_install:
670 @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
671
672 do_build_install: $(INSTALL_FILESYS_FILES) $(INSTALL_FILE_FILES) $(INSTALL_DATA_FILES)
673 @echo "[ $(SOURCE) ] make do_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
674
675 INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
676
677 do_installman: $(INSTALL_MAN_FILES)
678 @echo "[ $(SOURCE) ] make do_installman"
679 @if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
680 man_dir=$(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
681 if [ -d $$man_dir ]; then \
682 cur_dir=`pwd`; \
683 cd $$man_dir; \
684 $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS); \
685 cd $$cur_dir; \
686 else \
687 $(MKDIR) $$man_dir; \
688 fi; \
689 echo Installing $(INSTALL_MAN_LIST) in $$man_dir; \
690 install $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \
691 if [ -n "$(strip $(INSTALL_MAN_LINKS))" ]; then \
692 set `echo ${INSTALL_MAN_LINKS}`; \
693 while : ; do \
694 case $$# in \
695 0) break;; \
696 1) echo "warn: empty INSTALL_MAN_LINKS: $$1"; break;; \
697 esac; \
698 link_src=$$1; shift; link_dst=$$1; shift; \
699 echo "hard linking $${link_src} to $${link_dst}"; \
700 ln -f $${man_dir}/$${link_src} $${man_dir}/$${link_dst} ; \
701 done; \
702 fi; \
703 fi
704
705 $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : %
706 @true echo Installing $< in $(dir $@); \
707 $(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
708 $(RM) $(RMFLAGS) $@; \
709 install $(INSTALL_FLAGS) $< $(dir $@);
710
711 ifeq ($(INCL_MAKEDEP), TRUE)
712 -include Makedep
713 endif
714