2 # Generic Install rules
6 # gvdl: Let's optionally have a different list of local installs and
9 ifndef INSTALL_MI_LCL_LIST
10 INSTALL_MI_LCL_LIST = $(INSTALL_MI_LIST)
13 ifndef INSTALL_MI_LCL_GEN_LIST
14 INSTALL_MI_LCL_GEN_LIST = $(INSTALL_MI_GEN_LIST)
17 ifndef INSTALL_MD_LCL_LIST
18 INSTALL_MD_LCL_LIST = $(INSTALL_MD_LIST)
21 ifndef INSTALL_MD_LCL_GEN_LIST
22 INSTALL_MD_LCL_GEN_LIST = $(INSTALL_MD_GEN_LIST)
25 ifeq ($(INCR_INSTALLHDRS), TRUE)
27 INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST))
28 INSTALL_MI_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
29 INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_LIST))
30 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
32 $(INSTALL_MI_INC_FILES) $(INSTALL_MI_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : %
33 @true echo Installing $< in $(dir $@); \
34 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
35 filename=`$(BASENAME) $<`; \
36 filename_strip=$(addsuffix .strip,$${filename}); \
37 $(RM) $(RMFLAGS) $@; \
39 echo garbage > ./incdir/$${filename_strip}; \
40 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
41 $< > ./incdir/$${filename} || \
42 $(DECOMMENT) ./incdir/$${filename} r > \
43 ./incdir/$${filename_strip}; \
44 if [ -s ./incdir/$${filename_strip} ]; \
46 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
49 echo Header file $< not exported; \
53 $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : %
54 @true echo Installing $< in $(dir $@); \
55 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
56 $(RM) $(RMFLAGS) $@; \
57 install $(INSTALL_FLAGS) $< $(dir $@);
59 INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST))
60 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
61 INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_LIST))
62 INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST))
64 $(INSTALL_MD_INC_FILES) $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : %
65 @true echo Installing $< in $(dir $@); \
66 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
67 filename=`$(BASENAME) $<`; \
68 filename_strip=$(addsuffix .strip,$${filename}); \
69 $(RM) $(RMFLAGS) $@; \
71 echo garbage > ./incdir/$${filename_strip}; \
72 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
73 $< > ./incdir/$${filename} || \
74 $(DECOMMENT) ./incdir/$${filename} r > \
75 ./incdir/$${filename_strip}; \
76 if [ -s ./incdir/$${filename_strip} ]; \
78 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
81 echo Header file $< not exported; \
85 $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : %
86 @true echo Installing $< in $(dir $@); \
87 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
88 $(RM) $(RMFLAGS) $@; \
89 install $(INSTALL_FLAGS) $< $(dir $@);
92 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
94 do_installhdrs_mi: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_GEN_INC_FILES) $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_GEN_LCL_FILES)
95 @echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
98 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
100 do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_GEN_LCL_FILES)
101 @echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
105 INSTALL_MI_INC_FILES = $(addprefix $(SOURCE), $(INSTALL_MI_LIST))
106 INSTALL_MI_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
108 INSTALL_MI_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MI_LCL_LIST))
109 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
112 $(INSTALL_MI_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : %
113 @true echo Installing $< in $(dir $@); \
114 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
115 filename=`$(BASENAME) $<`; \
116 filename_strip=$(addsuffix .strip,$${filename}); \
117 $(RM) $(RMFLAGS) $@; \
119 echo garbage > ./incdir/$${filename_strip}; \
120 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
121 $< > ./incdir/$${filename} || \
122 $(DECOMMENT) ./incdir/$${filename} r > \
123 ./incdir/$${filename_strip}; \
124 if [ -s ./incdir/$${filename_strip} ]; \
126 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
129 echo Header file $< not exported; \
133 $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : %
134 @true echo Installing $< in $(dir $@); \
135 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
136 $(RM) $(RMFLAGS) $@; \
137 install $(INSTALL_FLAGS) $< $(dir $@);
139 INSTALL_MD_INC_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LIST))
140 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
142 INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST))
143 INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST))
145 $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : %
146 @true echo Installing $< in $(dir $@); \
147 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
148 filename=`$(BASENAME) $<`; \
149 filename_strip=$(addsuffix .strip,$${filename}); \
150 $(RM) $(RMFLAGS) $@; \
152 echo garbage > ./incdir/$${filename_strip}; \
153 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
154 $< > ./incdir/$${filename} || \
155 $(DECOMMENT) ./incdir/$${filename} r > \
156 ./incdir/$${filename_strip}; \
157 if [ -s ./incdir/$${filename_strip} ]; \
159 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
162 echo Header file $< not exported; \
166 $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : %
167 @true echo Installing $< in $(dir $@); \
168 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
169 $(RM) $(RMFLAGS) $@; \
170 install $(INSTALL_FLAGS) $< $(dir $@);
172 setup_installhdrs_mi:
173 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
175 do_installhdrs_mi: $(INSTALL_MI_GEN_INC_FILES) $(INSTALL_MI_GEN_LCL_FILES)
176 @echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
177 @if [ -n "$(strip $(INSTALL_MI_LIST))" ]; then \
178 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ]; then \
179 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LIST) ); \
181 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
184 for j in $(INSTALL_MI_LIST); \
186 echo garbage > ./incdir/$$j.strip; \
187 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
188 $(SOURCE)/$$j > ./incdir/$$j || \
189 $(DECOMMENT) ./incdir/$$j r > \
190 ./incdir/$$j.strip; \
191 if [ -s ./incdir/$$j.strip ]; \
193 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
196 echo Header file $$j not exported; \
199 $(RM) -rf ./incdir; \
201 @if [ -n "$(strip $(INSTALL_MI_LCL_LIST))" ]; then \
202 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ]; then \
203 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LCL_LIST) ); \
205 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
207 install $(INSTALL_FLAGS) $(INSTALL_MI_LCL_FILES) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
210 setup_installhdrs_md:
211 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
213 do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES)
214 @echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
215 @if [ -n "$(strip $(INSTALL_MD_LIST))" ]; then \
216 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ]; then \
217 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LIST) ); \
219 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
222 for j in $(INSTALL_MD_LIST); \
224 echo garbage > ./incdir/$$j.strip; \
225 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
226 $(SOURCE)/$$j > ./incdir/$$j || \
227 $(DECOMMENT) ./incdir/$$j r > \
228 ./incdir/$$j.strip; \
229 if [ -s ./incdir/$$j.strip ]; \
231 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
234 echo Header file $$j not exported; \
237 $(RM) -rf ./incdir; \
239 @if [ -n "$(strip $(INSTALL_MD_LCL_LIST))" ]; then \
240 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ]; then \
241 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LCL_LIST) ); \
243 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
245 install $(INSTALL_FLAGS) $(INSTALL_MD_LCL_FILES) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
252 # Generic Export rules
254 ifeq ($(INCR_EXPORTHDRS), TRUE)
256 EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
257 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
259 $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
260 @true echo Exporting $< in $(dir $@); \
261 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
262 ${CP} -p $< $(dir $@); \
265 EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
266 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
268 $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
269 @true echo Exporting $< in $(dir $@); \
270 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
271 ${CP} -p $< $(dir $@); \
274 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
276 do_exporthdrs_mi: $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES)
277 @echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
280 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
282 do_exporthdrs_md: $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES)
283 @echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
287 EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST))
288 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
290 $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
291 @true echo Exporting $< in $(dir $@); \
292 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
293 ${CP} -p $< $(dir $@); \
296 EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST))
297 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
299 $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
300 @true echo Exporting $< in $(dir $@); \
301 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
302 ${CP} -p $< $(dir $@); \
305 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
307 do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES)
308 @echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
309 @if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \
310 if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ]; then \
311 (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(EXPORT_MI_LIST) ); \
313 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
315 ${CP} -p $(EXPORT_MI_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
319 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
321 do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES)
322 @echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
323 @if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \
324 if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ]; then \
325 (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(EXPORT_MD_LIST) ); \
327 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
329 ${CP} -p $(EXPORT_MD_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
336 # Generic Compilation rules
340 # Compilation rules to generate .o from .s
342 COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST))
344 $(COMP_SOBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.s
345 ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< > $(patsubst %.o, %.pp, ${@});
346 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
347 ${S_KCC} ${SFLAGS} -m${arch_config} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});
348 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});
351 S_RULE_1B= ${patsubst %.o,%.s,${@}} > /dev/null
352 S_RULE_2= ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< \
353 > $(patsubst %.o, %.pp, ${@}); \
354 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
355 S_RULE_3= ${S_KCC} ${SFLAGS} -m${arch_config} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\
356 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@})
359 # Compilation rules to generate .o from .c
361 COMP_COBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_COBJ_LIST))
363 $(COMP_COBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.c
364 ${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $<
367 # Compilation rules to generate .o from .c for normal files
369 C_RULE_1A=${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
376 # Compilation rules to generate .o from .c for driver files
378 C_RULE_1A_D=${C_RULE_1A}
379 C_RULE_1B_D=${C_RULE_1B}
380 C_RULE_2_D=${C_RULE_2}
381 C_RULE_3_D=${C_RULE_3}
382 C_RULE_4_D=${C_RULE_4}
385 # Compilation rules to generate .o from .m
387 M_RULE_1A=${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
394 # Compilation rules to generate .co from .cp or .cpo from .cpp
395 # The config tool slickly changes the last source filename char to 'o'
396 # for the object filename.
398 P_RULE_1A=${KCC} -o $@ -c ${CPPFLAGS} ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
400 P_RULE_2=@sed 's/.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d)
405 # Linker rule to generate a component
407 LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST))
409 COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE))
411 $(COMPONENT_IMAGE_FILE): $(LD_COMPONENT_OBJ_FILES)
412 @echo "[ creating $(COMPONENT_IMAGE) ]"
413 $(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT_IMAGE_FILE) ${LD_COMPONENT_OBJ_FILES};
414 (cd $(TARGET)$(COMP_OBJ_DIR); ${MD} -u Makedep -f -d `ls *.d`);
417 @echo "[ $(SOURCE) ] make setup_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
419 do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE)
420 @echo "[ $(SOURCE) ] make do_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
422 ifeq ($(shell $(RELPATH) $(SRCROOT) $(SOURCE)), .)
423 do_build_all: do_build_mach_kernel
427 # mach_kernel building rules
429 MK_COMPONENT_OBJ_FILES = $(addprefix $(TARGET),$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell echo -n $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component)))))
431 do_build_mach_kernel:
432 @echo "[ building mach_kernel ]"
433 $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kernel_newvers \
434 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.major`" \
435 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.minor`" \
436 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.variant`"
437 ${KCC} $(CFLAGS) $(INCLUDES) -c kernel_vers.c
438 $(LD) $(LDFLAGS_KERNEL) $(MK_COMPONENT_OBJ_FILES) kernel_vers.o -o $(TARGET)mach_kernel.sys $(LD_KERNEL_LIBS)
439 $(STRIP) $(STRIP_FLAGS) $(TARGET)mach_kernel.sys -o $(TARGET)mach_kernel
441 # Generic Install rules
443 INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
447 $(INSTALL_FILE_FILES): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)% force_file_install
448 @echo Installing $< in $@;
449 @$(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \
450 if [ "`echo $(INSTALL_ARCHS) | wc -w`" -eq 1 ]; then \
451 $(RM) $(RMFLAGS) $@; \
452 install $(INSTALL_FLAGS) $< $(dir $@); \
454 if [ ! -e $@ ]; then \
456 lipo_arg="$(subst _empty_file, empty_file,$(foreach lipo_arch,$(shell echo -n $(INSTALL_ARCHS) | tr A-Z a-z), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
457 $(LIPO) $${lipo_arg} -create -output $@; \
458 $(RM) $(RMFLAGS) empty_file; \
460 $(LIPO) $@ -replace $(shell echo -n $(ARCH_CONFIG) | tr A-Z a-z) $< -o $@; \
463 INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
465 force_filesys_install:
467 $(INSTALL_FILESYS_FILES): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)%.sys force_filesys_install
468 @echo Installing $< in $@;
469 @$(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \
470 if [ "`echo $(INSTALL_ARCHS) | wc -w`" -eq 1 ]; then \
471 $(RM) $(RMFLAGS) $@; \
472 install $(INSTALL_FLAGS) $< $(dir $@); \
474 if [ ! -e $@ ]; then \
476 lipo_arg="$(subst _empty_file, empty_file,$(foreach lipo_arch,$(shell echo -n $(INSTALL_ARCHS) | tr A-Z a-z), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
477 $(LIPO) $${lipo_arg} -create -output $@; \
478 $(RM) $(RMFLAGS) empty_file; \
480 $(LIPO) $@ -replace $(shell echo -n $(ARCH_CONFIG) | tr A-Z a-z) $< -o $@; \
484 @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
486 do_build_install: $(INSTALL_FILESYS_FILES) $(INSTALL_FILE_FILES)
487 @echo "[ $(SOURCE) ] make do_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"