2 # Generic Install rules
5 ifndef INSTALL_MI_LCL_LIST
6 INSTALL_MI_LCL_LIST = $(INSTALL_MI_LIST)
9 ifndef INSTALL_MI_LCL_GEN_LIST
10 INSTALL_MI_LCL_GEN_LIST = $(INSTALL_MI_GEN_LIST)
13 ifndef INSTALL_MD_LCL_LIST
14 INSTALL_MD_LCL_LIST = $(INSTALL_MD_LIST)
17 ifndef INSTALL_MD_LCL_GEN_LIST
18 INSTALL_MD_LCL_GEN_LIST = $(INSTALL_MD_GEN_LIST)
21 ifndef INSTALL_KF_MI_LCL_LIST
22 INSTALL_KF_MI_LCL_LIST = $(EXPORT_MI_LIST)
25 ifndef INSTALL_KF_MI_LCL_GEN_LIST
26 INSTALL_KF_MI_LCL_GEN_LIST = $(EXPORT_MI_GEN_LIST)
29 ifndef INSTALL_KF_MD_LCL_LIST
30 INSTALL_KF_MD_LCL_LIST = $(EXPORT_MD_LIST)
33 ifndef INSTALL_KF_MD_LCL_GEN_LIST
34 INSTALL_KF_MD_LCL_GEN_LIST = $(EXPORT_MD_GEN_LIST)
37 ifndef INSTALL_KF_MI_LIST
38 INSTALL_KF_MI_LIST = $(EXPORT_MI_LIST)
41 ifndef INSTALL_KF_MI_GEN_LIST
42 INSTALL_KF_MI_GEN_LIST = $(EXPORT_MI_GEN_LIST)
45 ifndef INSTALL_KF_MD_LIST
46 INSTALL_KF_MD_LIST = $(EXPORT_MD_LIST)
49 ifndef INSTALL_KF_MD_GEN_LIST
50 INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST)
53 INSTALL_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
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} ]; \
69 install $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\
72 echo Header file $< not exported; \
75 INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
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} ]; \
91 install $(INSTALL_FLAGS) ./kincmidir/$${filename} $(dir $@);\
94 echo Header file $< not exported; \
97 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
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} ]; \
113 install $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\
116 echo Header file $< not exported; \
119 INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
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} ]; \
135 install $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\
138 echo Header file $< not exported; \
141 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
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} ]; \
157 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
160 echo Header file $< not exported; \
163 INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
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} ]; \
179 install $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\
182 echo Header file $< not exported; \
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))
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} ]; \
202 install $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\
205 echo Header file $< not exported; \
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))
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} ]; \
225 install $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\
228 echo Header file $< not exported; \
231 setup_installhdrs_mi:
232 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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) ); \
241 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
243 for j in $(INSTALL_MI_LIST); \
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 ]; \
252 install $(INSTALL_FLAGS) ./incmidir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
255 echo Header file $$j not exported; \
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) ); \
263 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
265 for j in $(INSTALL_MI_LCL_LIST); \
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 ]; \
274 install $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
277 echo Header file $$j not exported; \
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) ); \
285 $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
287 for j in $(INSTALL_KF_MI_LIST); \
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 ]; \
296 install $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \
299 echo Header file $$j not exported; \
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) ); \
307 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
309 for j in $(INSTALL_KF_MI_LCL_LIST); \
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 ]; \
318 install $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \
321 echo Header file $$j not exported; \
325 $(RM) -rf ./incmidir ./pincmidir ./kincmidir ./kpincmidir;
327 setup_installhdrs_md:
328 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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) ); \
337 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
339 for j in $(INSTALL_MD_LIST); \
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 ]; \
348 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
351 echo Header file $$j not exported; \
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) ); \
359 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
361 for j in $(INSTALL_MD_LCL_LIST); \
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 ]; \
370 install $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
373 echo Header file $$j not exported; \
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) ); \
381 $(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
383 for j in $(INSTALL_KF_MD_LIST); \
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 ]; \
392 install $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \
395 echo Header file $$j not exported; \
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) ); \
403 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
405 for j in $(INSTALL_KF_MD_LCL_LIST); \
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 ]; \
414 install $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \
417 echo Header file $$j not exported; \
421 $(RM) -rf ./incdir ./pincdir ./kincdir ./kpincdir;
425 # Generic Export rules
427 ifeq ($(INCR_EXPORTHDRS), TRUE)
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))
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 $@); \
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))
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 $@); \
447 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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)"
453 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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)"
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))
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 $@); \
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))
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 $@); \
478 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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) ); \
486 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
488 ${CP} -p $(EXPORT_MI_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
492 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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) ); \
500 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
502 ${CP} -p $(EXPORT_MD_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
509 # Generic Compilation rules
513 # Compilation rules to generate .o from .s
515 COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST))
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,${@});
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,${@})
532 # Compilation rules to generate .o from .c
534 COMP_COBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_COBJ_LIST))
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}} $<
540 # Compilation rules to generate .o from .c for normal files
542 C_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
549 # Compilation rules to generate .o from .c for driver files
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}
558 # Compilation rules to generate .o from .m
560 M_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${MWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
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.
571 P_RULE_1A=${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
573 P_RULE_2=@sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d)
578 # Linker rule to generate a component
580 LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST))
582 COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE))
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`);
590 @echo "[ $(SOURCE) ] make setup_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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)"
595 ifeq ($(COMPONENT), .)
596 do_build_all: do_build_mach_kernel
600 # mach_kernel building rules
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;
610 $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kgmacros: $(SRCROOT)/kgmacros
614 # Generic Install rules
616 INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
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); \
625 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
626 $(RM) $(RMFLAGS) $@; \
627 install $(FILE_INSTALL_FLAGS) $< $(dir $@); \
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 $@); \
635 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
638 INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
640 force_filesys_install:
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); \
647 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
648 $(RM) $(RMFLAGS) $@; \
649 install $(INSTALL_FLAGS) $< $(dir $@); \
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 $@); \
657 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
659 cp $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR)
661 INSTALL_DATA_FILES = $(addprefix $(DSTROOT)$(INSTALL_DATA_DIR), $(INSTALL_DATA_LIST))
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 $@);
670 @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
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)"
675 INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
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 \
684 $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS); \
687 $(MKDIR) $$man_dir; \
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}`; \
696 1) echo "warn: empty INSTALL_MAN_LINKS: $$1"; break;; \
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} ; \
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 $@);
711 ifeq ($(INCL_MAKEDEP), TRUE)