]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.rule
xnu-1228.7.58.tar.gz
[apple/xnu.git] / makedefs / MakeInc.rule
CommitLineData
1c79356b
A
1#
2# Generic Install rules
3#
4
1c79356b
A
5ifndef INSTALL_MI_LCL_LIST
6 INSTALL_MI_LCL_LIST = $(INSTALL_MI_LIST)
7endif
8
9ifndef INSTALL_MI_LCL_GEN_LIST
10 INSTALL_MI_LCL_GEN_LIST = $(INSTALL_MI_GEN_LIST)
11endif
12
13ifndef INSTALL_MD_LCL_LIST
14 INSTALL_MD_LCL_LIST = $(INSTALL_MD_LIST)
15endif
16
17ifndef INSTALL_MD_LCL_GEN_LIST
18 INSTALL_MD_LCL_GEN_LIST = $(INSTALL_MD_GEN_LIST)
19endif
20
91447636
A
21ifndef INSTALL_KF_MI_LCL_LIST
22 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
23endif
1c79356b 24
91447636
A
25ifndef INSTALL_KF_MI_LCL_GEN_LIST
26 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
27endif
1c79356b 28
91447636
A
29ifndef INSTALL_KF_MD_LCL_LIST
30 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
31endif
1c79356b 32
91447636
A
33ifndef INSTALL_KF_MD_LCL_GEN_LIST
34 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
35endif
9bccf70c 36
91447636
A
37ifndef INSTALL_KF_MI_LIST
38 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
39endif
1c79356b 40
91447636
A
41ifndef INSTALL_KF_MI_GEN_LIST
42 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
43endif
9bccf70c 44
91447636
A
45ifndef INSTALL_KF_MD_LIST
46 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
47endif
9bccf70c 48
91447636
A
49ifndef INSTALL_KF_MD_GEN_LIST
50 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
51endif
52
2d21ac55
A
53ifneq ($(MACHINE_CONFIG), DEFAULT)
54 OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)
55else
56 OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)
57endif
58
91447636 59INSTALL_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 ( \
91447636 75 install $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\
1c79356b
A
76 ); \
77 else \
78 echo Header file $< not exported; \
91447636 79 fi;
1c79356b 80
91447636 81INSTALL_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 ( \
91447636 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
103INSTALL_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 ( \
119 install $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\
120 ); \
121 else \
122 echo Header file $< not exported; \
123 fi;
1c79356b 124
91447636 125INSTALL_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 ( \
141 install $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\
142 ); \
143 else \
144 echo Header file $< not exported; \
145 fi;
9bccf70c 146
1c79356b
A
147INSTALL_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 ( \
163 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
164 ); \
165 else \
166 echo Header file $< not exported; \
91447636
A
167 fi;
168
169INSTALL_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 ( \
185 install $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\
186 ); \
187 else \
188 echo Header file $< not exported; \
189 fi;
1c79356b 190
9bccf70c
A
191INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST))
192INSTALL_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 ( \
208 install $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\
209 ); \
210 else \
211 echo Header file $< not exported; \
212 fi;
1c79356b 213
91447636
A
214INSTALL_KF_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_KF_MD_LCL_LIST))
215INSTALL_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 ( \
231 install $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\
232 ); \
233 else \
234 echo Header file $< not exported; \
235 fi;
9bccf70c 236
1c79356b 237setup_installhdrs_mi:
1c79356b 238
91447636 239do_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 ( \
91447636 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 ( \
279 install $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
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 ( \
301 install $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
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 ( \
323 install $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
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
332setup_installhdrs_md:
1c79356b 333
91447636 334do_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 ( \
352 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
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 ( \
374 install $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
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 ( \
396 install $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
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 ( \
418 install $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
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#
431ifeq ($(INCR_EXPORTHDRS), TRUE)
432
433EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
434EXPORT_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
442EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
443EXPORT_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
450setup_exporthdrs_mi:
1c79356b
A
451
452do_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
455setup_exporthdrs_md:
1c79356b
A
456
457do_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
460else
461
462EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST))
463EXPORT_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
471EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST))
472EXPORT_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
479setup_exporthdrs_mi:
1c79356b
A
480
481do_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
492setup_exporthdrs_md:
1c79356b
A
493
494do_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#
507endif
508#
509# Generic Compilation rules
510#
511
512#
513# Compilation rules to generate .o from .s
514#
2d21ac55 515
1c79356b
A
516COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST))
517
518$(COMP_SOBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.s
519 ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< > $(patsubst %.o, %.pp, ${@});
520 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
55e303ae 521 ${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});
1c79356b
A
522 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});
523
524S_RULE_1A=@ls /
525S_RULE_1B= ${patsubst %.o,%.s,${@}} > /dev/null
2d21ac55 526S_RULE_2=$(_v)${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< \
1c79356b
A
527 > $(patsubst %.o, %.pp, ${@}); \
528 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
2d21ac55
A
529ifeq ($(BUILD_STABS),1)
530S_RULE_3=$(_v)${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\
531 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});
532else
533S_RULE_3=$(_v)${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\
534 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});\
535 ${CTFCONVERT} -l xnu -v -o $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf || true;
536S_RULE_4=@echo ASM $@
537endif
1c79356b
A
538
539#
540# Compilation rules to generate .o from .c for normal files
2d21ac55 541C_RULE_1A=$(_v)${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
1c79356b 542C_RULE_1B=$*.c
2d21ac55
A
543C_RULE_2=@echo CC $@
544ifeq ($(BUILD_STABS),1)
1c79356b 545C_RULE_3=
2d21ac55
A
546else
547C_RULE_3=$(_v)${CTFCONVERT} -l xnu -v -o $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf || true;
548endif
1c79356b
A
549C_RULE_4=
550
551#
552# Compilation rules to generate .o from .c for driver files
553#
554C_RULE_1A_D=${C_RULE_1A}
555C_RULE_1B_D=${C_RULE_1B}
556C_RULE_2_D=${C_RULE_2}
557C_RULE_3_D=${C_RULE_3}
558C_RULE_4_D=${C_RULE_4}
559
560#
561# Compilation rules to generate .o from .m
562#
2d21ac55 563M_RULE_1A=$(_v)${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${MWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
1c79356b 564M_RULE_1B=$*.m
2d21ac55 565M_RULE_2=@echo CC $@
1c79356b
A
566M_RULE_3=
567M_RULE_4=
568
569#
570# Compilation rules to generate .co from .cp or .cpo from .cpp
571# The config tool slickly changes the last source filename char to 'o'
572# for the object filename.
2d21ac55 573P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
1c79356b 574P_RULE_1B=$(<F)
2d21ac55
A
575P_RULE_2=$(_v)sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d)
576P_RULE_3=@echo C++ $@
577ifeq ($(BUILD_STABS),1)
578P_RULE_4=
579else
580P_RULE_4=$(_v)${CTFCONVERT} -l xnu -v -o $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf || true;
581endif
1c79356b
A
582P_RULE_4=
583
584#
585# Linker rule to generate a component
586#
587LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST))
588
589COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE))
590
591$(COMPONENT_IMAGE_FILE): $(LD_COMPONENT_OBJ_FILES)
2d21ac55
A
592 @echo LD $@
593 $(_v)$(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT_IMAGE_FILE) ${LD_COMPONENT_OBJ_FILES};
594 $(_v)(cd $(TARGET)$(COMP_OBJ_DIR); ${MD} -u Makedep -f -d `ls *.d`);
1c79356b
A
595
596setup_build_all:
1c79356b
A
597
598do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE)
1c79356b 599
0b4e3aa0 600ifeq ($(COMPONENT), .)
1c79356b
A
601do_build_all: do_build_mach_kernel
602endif
603
604#
605# mach_kernel building rules
606#
2d21ac55
A
607do_build_mach_kernel: $(OBJPATH)/kgmacros
608 $(_v)install $(DATA_INSTALL_FLAGS) $(SRCROOT)/config/version.c $(OBJPATH)/version.c;
609 $(_v)$(SRCROOT)/config/newvers.pl $(OBJPATH)/version.c > /dev/null;
610 @echo CC version.o
611 $(_v)${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS}} ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $(OBJPATH)/version.c -o $(OBJPATH)/version.o
612 @echo LD mach_kernel.sys
613 $(_v)$(LD) $(LDFLAGS_KERNEL) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) $(OBJPATH)/version.o -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS)
614 @echo DSYMUTIL mach_kernel.sys
615 $(_v)if [ $(BUILD_DWARF) -eq 1 ]; then \
616 $(DSYMUTIL) $(DSYMUTIL_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel.sys.dSYM > /dev/null; \
617 fi;
618 @echo STRIP mach_kernel
619 $(_v)$(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel
55e303ae 620
2d21ac55
A
621$(OBJPATH)/kgmacros: $(SRCROOT)/kgmacros
622 $(_v)$(CP) $? $@
1c79356b 623
2d21ac55 624# Special rules to install machine configuration variants
1c79356b 625
2d21ac55 626$(DSTROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC): $(TARGET)/mach_kernel force_file_install
1c79356b 627 @echo Installing $< in $@;
55e303ae
A
628 @if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \
629 $(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \
630 fi; \
0b4e3aa0 631 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
1c79356b 632 $(RM) $(RMFLAGS) $@; \
2d21ac55
A
633 install $(FILE_INSTALL_FLAGS) $< $@; \
634 else \
635 if [ ! -e $@ ]; then \
636 echo >empty_file_$(notdir $@); \
637 lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
638 $(LIPO) $${lipo_arg} -create -output $@; \
639 $(RM) $(RMFLAGS) empty_file_$(notdir $@); \
640 fi; \
641 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
642 fi
643
644$(SYMROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC): $(TARGET)/mach_kernel.sys force_file_install
645 @echo Installing $< in $@;
646 @if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \
647 $(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \
648 fi; \
649 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
650 $(RM) $(RMFLAGS) $@; \
651 install $(FILE_INSTALL_FLAGS) $< $@; \
1c79356b
A
652 else \
653 if [ ! -e $@ ]; then \
55e303ae
A
654 echo >empty_file_$(notdir $@); \
655 lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
1c79356b 656 $(LIPO) $${lipo_arg} -create -output $@; \
55e303ae
A
657 $(RM) $(RMFLAGS) empty_file_$(notdir $@); \
658 fi; \
0b4e3aa0 659 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
1c79356b
A
660 fi
661
2d21ac55
A
662
663#
664# Generic Install rules
665#
666INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
667INSTALL_FILE_FILES_GENERIC = $(filter-out $(DSTROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC), $(INSTALL_FILE_FILES))
668
669force_file_install:
670
671$(INSTALL_FILE_FILES_GENERIC): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/% force_file_install
672 @echo Installing $< in $@;
673 $(_v)if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \
674 $(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \
675 fi; \
676 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
677 $(RM) $(RMFLAGS) $@; \
678 install $(FILE_INSTALL_FLAGS) $< $@; \
679 else \
680 if [ ! -e $@ ]; then \
681 echo >empty_file_$(notdir $@); \
682 lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
683 $(LIPO) $${lipo_arg} -create -output $@; \
684 $(RM) $(RMFLAGS) empty_file_$(notdir $@); \
685 fi; \
686 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
687 fi; \
688 if [ $(BUILD_DWARF) -eq 1 ]; then \
689 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
690 $(CP) -f $< $<.ctfsys; \
691 $(FIND) $(OBJPATH)/ -name \*.ctf -size 0 \
692 -exec $(RM) -rf {} \; ; \
693 $(CTFMERGE) -l xnu -o $<.ctfsys \
694 $(OBJPATH)/*/$(KERNEL_CONFIG)/*.*o.ctf || true; \
695 install $(FILE_INSTALL_FLAGS) $<.ctfsys $(dir $@); \
696 else \
697 if [ ! -e $@.ctfsys ]; then \
698 echo >empty_file_$(notdir $@); \
699 lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
700 $(LIPO) $${lipo_arg} -create -output $@.ctfsys;\
701 $(RM) $(RMFLAGS) empty_file_$(notdir $@);\
702 fi; \
703 $(FIND) $(OBJPATH)/ -name \*.ctf -size 0 \
704 -exec $(RM) -rf {} \; ; \
705 $(CP) -f $< $<.ctfsys; \
706 $(CTFMERGE) -l xnu -o $<.ctfsys \
707 $(OBJPATH)/*/$(KERNEL_CONFIG)/*.*o.ctf || true; \
708 $(LIPO) $@.ctfsys -replace $(ARCH_CONFIG_LC) \
709 $<.ctfsys -o $@.ctfsys; \
710 fi; \
711 fi
712
1c79356b 713INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
2d21ac55 714INSTALL_FILESYS_FILES_GENERIC = $(filter-out $(SYMROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC), $(INSTALL_FILESYS_FILES))
1c79356b
A
715
716force_filesys_install:
717
2d21ac55 718$(INSTALL_FILESYS_FILES_GENERIC): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/%.sys force_filesys_install
1c79356b 719 @echo Installing $< in $@;
2d21ac55 720 $(_v)if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \
55e303ae
A
721 $(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \
722 fi; \
0b4e3aa0 723 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
1c79356b 724 $(RM) $(RMFLAGS) $@; \
2d21ac55
A
725 install $(INSTALL_FLAGS) $< $@; \
726 if [ $(BUILD_DWARF) -eq 1 ]; then \
727 $(DSYMUTIL) $(DSYMUTIL_FLAGS) \
728 $(TARGET)/mach_kernel.sys \
729 -o $(TARGET)/mach_kernel.sys.dSYM; \
730 $(RM) -rf $@.dSYM; \
731 $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \
732 install $(INSTALL_FLAGS) \
733 $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \
734 $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \
735 fi; \
1c79356b
A
736 else \
737 if [ ! -e $@ ]; then \
2d21ac55 738 echo >empty_filesys_$(notdir $@); \
55e303ae 739 lipo_arg="$(subst _empty_file, empty_filesys_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
1c79356b 740 $(LIPO) $${lipo_arg} -create -output $@; \
2d21ac55 741 $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \
55e303ae 742 fi; \
0b4e3aa0 743 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
2d21ac55
A
744 \
745 if [ $(BUILD_DWARF) -eq 1 ]; then \
746 if [ ! -e $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) ]; then \
747 echo >empty_filesys_$(notdir $@); \
748 lipo_arg="$(subst _empty_file, empty_filesys_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
749 $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \
750 $(LIPO) $${lipo_arg} -create \
751 -output \
752 $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \
753 $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \
754 fi; \
755 $(DSYMUTIL) $(DSYMUTIL_FLAGS) \
756 $(TARGET)/mach_kernel.sys \
757 -o $(TARGET)/mach_kernel.sys.dSYM; \
758 $(LIPO) $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) \
759 -replace $(ARCH_CONFIG_LC) \
760 $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \
761 -o $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \
762 fi; \
1c79356b 763 fi
2d21ac55 764 $(CP) $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR)
1c79356b 765
d7e50217
A
766INSTALL_DATA_FILES = $(addprefix $(DSTROOT)$(INSTALL_DATA_DIR), $(INSTALL_DATA_LIST))
767
768$(INSTALL_DATA_FILES): $(DSTROOT)$(INSTALL_DATA_DIR)% : $(SOURCE)/%
769 @echo Installing $< in $@;
2d21ac55 770 $(_v)[ -d $(dir $@) ] ||$(MKDIR) $(dir $@); \
d7e50217
A
771 $(RM) $(RMFLAGS) $@; \
772 install $(DATA_INSTALL_FLAGS) $< $(dir $@);
773
1c79356b
A
774setup_build_install:
775 @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
776
d7e50217 777do_build_install: $(INSTALL_FILESYS_FILES) $(INSTALL_FILE_FILES) $(INSTALL_DATA_FILES)
1c79356b
A
778 @echo "[ $(SOURCE) ] make do_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
779
9bccf70c
A
780INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
781
782do_installman: $(INSTALL_MAN_FILES)
783 @echo "[ $(SOURCE) ] make do_installman"
2d21ac55 784 $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
9bccf70c
A
785 man_dir=$(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
786 if [ -d $$man_dir ]; then \
2d21ac55
A
787 ( cd $$man_dir; \
788 $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS)); \
9bccf70c
A
789 else \
790 $(MKDIR) $$man_dir; \
791 fi; \
792 echo Installing $(INSTALL_MAN_LIST) in $$man_dir; \
793 install $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \
91447636
A
794 if [ -n "$(strip $(INSTALL_MAN_LINKS))" ]; then \
795 set `echo ${INSTALL_MAN_LINKS}`; \
796 while : ; do \
797 case $$# in \
798 0) break;; \
799 1) echo "warn: empty INSTALL_MAN_LINKS: $$1"; break;; \
800 esac; \
801 link_src=$$1; shift; link_dst=$$1; shift; \
802 echo "hard linking $${link_src} to $${link_dst}"; \
803 ln -f $${man_dir}/$${link_src} $${man_dir}/$${link_dst} ; \
804 done; \
805 fi; \
9bccf70c
A
806 fi
807
808$(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : %
2d21ac55
A
809 @true echo Installing $< in $(dir $@)
810 $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
9bccf70c
A
811 $(RM) $(RMFLAGS) $@; \
812 install $(INSTALL_FLAGS) $< $(dir $@);
813
0b4e3aa0 814ifeq ($(INCL_MAKEDEP), TRUE)
1c79356b 815-include Makedep
0b4e3aa0 816endif
1c79356b 817
2d21ac55 818# vim: set ft=make: