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)
28 # These are the machine independent headers that end up in /usr/include
29 # Eventually they're copied to System framework's headers directory
31 INSTALL_MI_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LIST))
32 INSTALL_MI_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
34 $(INSTALL_MI_INC_FILES) $(INSTALL_MI_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : %
35 @true echo Installing $< in $(dir $@); \
36 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
37 filename=`$(BASENAME) $<`; \
38 filename_strip=$(addsuffix .strip,$${filename}); \
39 $(RM) $(RMFLAGS) $@; \
41 echo garbage > ./incdir/$${filename_strip}; \
42 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
43 $< > ./incdir/$${filename} || \
44 $(DECOMMENT) ./incdir/$${filename} r > \
45 ./incdir/$${filename_strip}; \
46 if [ -s ./incdir/$${filename_strip} ]; \
48 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
51 echo Header file $< not exported; \
56 # These are usually machine independent System framework private headers
57 # Unless LCLDIR is specified as something else
59 INSTALL_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_LIST))
60 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
62 $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : %
63 @true echo Installing $< in $(dir $@); \
64 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
65 $(RM) $(RMFLAGS) $@; \
66 install $(INSTALL_FLAGS) $< $(dir $@);
69 # These are the Kernel framework's machine independent private headers
70 # They should be specified in INSTALL_MI_LCL_KERN_LIST and INSTALL_MI_LCL_GEN_KERN_LIST
72 INSTALL_MI_LCL_KERN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_KERN_LIST))
73 INSTALL_MI_GEN_LCL_KERN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_KERN_LIST))
75 $(INSTALL_MI_LCL_KERN_FILES) $(INSTALL_MI_GEN_LCL_KERN_FILES): $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR)/% : %
76 @true echo Installing $< in $(dir $@); \
77 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR); \
78 $(RM) $(RMFLAGS) $@; \
79 install $(INSTALL_FLAGS) $< $(dir $@);
82 # These are the machine dependent headers that end up in /usr/include
83 # Eventually they're copied to System framework's headers directory
85 INSTALL_MD_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LIST))
86 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
88 $(INSTALL_MD_INC_FILES) $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : %
89 @true echo Installing $< in $(dir $@); \
90 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
91 filename=`$(BASENAME) $<`; \
92 filename_strip=$(addsuffix .strip,$${filename}); \
93 $(RM) $(RMFLAGS) $@; \
95 echo garbage > ./incdir/$${filename_strip}; \
96 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
97 $< > ./incdir/$${filename} || \
98 $(DECOMMENT) ./incdir/$${filename} r > \
99 ./incdir/$${filename_strip}; \
100 if [ -s ./incdir/$${filename_strip} ]; \
102 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
105 echo Header file $< not exported; \
110 # These are usually machine dependent System framework private headers
111 # Unless LCLDIR is specified as something else
113 INSTALL_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_LIST))
114 INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST))
116 $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : %
117 @true echo Installing $< in $(dir $@); \
118 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
119 $(RM) $(RMFLAGS) $@; \
120 install $(INSTALL_FLAGS) $< $(dir $@);
123 # These are the Kernel framework's machine dependent private headers
124 # They should be specified in INSTALL_MD_LCL_KERN_LIST and INSTALL_MD_LCL_GEN_KERN_LIST
126 INSTALL_MD_LCL_KERN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_KERN_LIST))
127 INSTALL_MD_GEN_LCL_KERN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_KERN_LIST))
129 $(INSTALL_MD_LCL_KERN_FILES) $(INSTALL_MD_GEN_LCL_KERN_FILES): $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR)/% : %
130 @true echo Installing $< in $(dir $@); \
131 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR); \
132 $(RM) $(RMFLAGS) $@; \
133 install $(INSTALL_FLAGS) $< $(dir $@);
135 setup_installhdrs_mi:
136 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
138 do_installhdrs_mi: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_GEN_INC_FILES) $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL_MI_LCL_KERN_FILES) $(INSTALL_MI_GEN_LCL_KERN_FILES)
139 @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
141 setup_installhdrs_md:
142 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
144 do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INSTALL_MD_LCL_KERN_FILES) $(INSTALL_MD_GEN_LCL_KERN_FILES)
145 @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
149 INSTALL_MI_INC_FILES = $(addprefix $(SOURCE), $(INSTALL_MI_LIST))
150 INSTALL_MI_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST))
152 $(INSTALL_MI_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : %
153 @true echo Installing $< in $(dir $@); \
154 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
155 filename=`$(BASENAME) $<`; \
156 filename_strip=$(addsuffix .strip,$${filename}); \
157 $(RM) $(RMFLAGS) $@; \
159 echo garbage > ./incdir/$${filename_strip}; \
160 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
161 $< > ./incdir/$${filename} || \
162 $(DECOMMENT) ./incdir/$${filename} r > \
163 ./incdir/$${filename_strip}; \
164 if [ -s ./incdir/$${filename_strip} ]; \
166 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
169 echo Header file $< not exported; \
173 INSTALL_MI_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MI_LCL_LIST))
174 INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST))
176 $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : %
177 @true echo Installing $< in $(dir $@); \
178 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
179 $(RM) $(RMFLAGS) $@; \
180 install $(INSTALL_FLAGS) $< $(dir $@);
182 INSTALL_MI_LCL_KERN_FILES = $(addprefix $(SOURCE), $(INSTALL_MI_LCL_KERN_LIST))
183 INSTALL_MI_GEN_LCL_KERN_FILES = $(addprefix $(KPINCDIR)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_KERN_GEN_LIST))
185 $(INSTALL_MI_GEN_LCL_KERN_FILES): $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR)/% : %
186 @true echo Installing $< in $(dir $@); \
187 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR); \
188 $(RM) $(RMFLAGS) $@; \
189 install $(INSTALL_FLAGS) $< $(dir $@);
191 INSTALL_MD_INC_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LIST))
192 INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST))
194 $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : %
195 @true echo Installing $< in $(dir $@); \
196 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
197 filename=`$(BASENAME) $<`; \
198 filename_strip=$(addsuffix .strip,$${filename}); \
199 $(RM) $(RMFLAGS) $@; \
201 echo garbage > ./incdir/$${filename_strip}; \
202 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
203 $< > ./incdir/$${filename} || \
204 $(DECOMMENT) ./incdir/$${filename} r > \
205 ./incdir/$${filename_strip}; \
206 if [ -s ./incdir/$${filename_strip} ]; \
208 install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\
211 echo Header file $< not exported; \
215 INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST))
216 INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST))
218 $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : %
219 @true echo Installing $< in $(dir $@); \
220 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
221 $(RM) $(RMFLAGS) $@; \
222 install $(INSTALL_FLAGS) $< $(dir $@);
224 INSTALL_MD_LCL_KERN_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_KERN_LIST))
225 INSTALL_MD_GEN_LCL_KERN_FILES = $(addprefix $(KPINCDIR)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_KERN_GEN_LIST))
227 $(INSTALL_MD_GEN_LCL_KERN_FILES): $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR)/% : %
228 @true echo Installing $< in $(dir $@); \
229 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR); \
230 $(RM) $(RMFLAGS) $@; \
231 install $(INSTALL_FLAGS) $< $(dir $@);
233 setup_installhdrs_mi:
234 @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
236 do_installhdrs_mi: $(INSTALL_MI_GEN_INC_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL_MI_GEN_LCL_KERN_FILES)
237 @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
238 @if [ -n "$(strip $(INSTALL_MI_LIST))" ]; then \
239 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ]; then \
240 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LIST) ); \
242 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
245 for j in $(INSTALL_MI_LIST); \
247 echo garbage > ./incdir/$$j.strip; \
248 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
249 $(SOURCE)/$$j > ./incdir/$$j || \
250 $(DECOMMENT) ./incdir/$$j r > \
251 ./incdir/$$j.strip; \
252 if [ -s ./incdir/$$j.strip ]; \
254 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \
257 echo Header file $$j not exported; \
260 $(RM) -rf ./incdir; \
262 @if [ -n "$(strip $(INSTALL_MI_LCL_LIST))" ]; then \
263 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ]; then \
264 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LCL_LIST) ); \
266 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
268 install $(INSTALL_FLAGS) $(INSTALL_MI_LCL_FILES) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \
270 @if [ -n "$(strip $(INSTALL_MI_LCL_KERN_LIST))" ]; then \
271 if [ -d $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR) ]; then \
272 (cd $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LCL_KERN_LIST) ); \
274 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR); \
276 install $(INSTALL_FLAGS) $(INSTALL_MI_LCL_KERN_FILES) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MI_DIR); \
279 setup_installhdrs_md:
280 @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
282 do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INSTALL_MI_GEN_LCL_KERN_FILES)
283 @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
284 @if [ -n "$(strip $(INSTALL_MD_LIST))" ]; then \
285 if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ]; then \
286 (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LIST) ); \
288 $(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
291 for j in $(INSTALL_MD_LIST); \
293 echo garbage > ./incdir/$$j.strip; \
294 $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE \
295 $(SOURCE)/$$j > ./incdir/$$j || \
296 $(DECOMMENT) ./incdir/$$j r > \
297 ./incdir/$$j.strip; \
298 if [ -s ./incdir/$$j.strip ]; \
300 install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \
303 echo Header file $$j not exported; \
306 $(RM) -rf ./incdir; \
308 @if [ -n "$(strip $(INSTALL_MD_LCL_LIST))" ]; then \
309 if [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ]; then \
310 (cd $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LCL_LIST) ); \
312 $(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
314 install $(INSTALL_FLAGS) $(INSTALL_MD_LCL_FILES) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \
316 @if [ -n "$(strip $(INSTALL_MD_LCL_KERN_LIST))" ]; then \
317 if [ -d $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR) ]; then \
318 (cd $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LCL_KERN_LIST) ); \
320 $(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR); \
322 install $(INSTALL_FLAGS) $(INSTALL_MD_LCL_KERN_FILES) $(DSTROOT)/$(KPINCDIR)/$(INSTALL_MD_DIR); \
329 # Generic Export rules
331 ifeq ($(INCR_EXPORTHDRS), TRUE)
333 EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_LIST))
334 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
336 $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
337 @true echo Exporting $< in $(dir $@); \
338 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
339 ${CP} -p $< $(dir $@); \
342 EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_LIST))
343 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
345 $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
346 @true echo Exporting $< in $(dir $@); \
347 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
348 ${CP} -p $< $(dir $@); \
351 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
353 do_exporthdrs_mi: $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES)
354 @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
357 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
359 do_exporthdrs_md: $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES)
360 @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
364 EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST))
365 EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST))
367 $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : %
368 @true echo Exporting $< in $(dir $@); \
369 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
370 ${CP} -p $< $(dir $@); \
373 EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST))
374 EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST))
376 $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : %
377 @true echo Exporting $< in $(dir $@); \
378 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
379 ${CP} -p $< $(dir $@); \
382 @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
384 do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES)
385 @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
386 @if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \
387 if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ]; then \
388 (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(EXPORT_MI_LIST) ); \
390 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
392 ${CP} -p $(EXPORT_MI_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \
396 @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
398 do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES)
399 @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
400 @if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \
401 if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ]; then \
402 (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(EXPORT_MD_LIST) ); \
404 $(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
406 ${CP} -p $(EXPORT_MD_INC_FILES) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \
413 # Generic Compilation rules
417 # Compilation rules to generate .o from .s
419 COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST))
421 $(COMP_SOBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.s
422 ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< > $(patsubst %.o, %.pp, ${@});
423 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
424 ${S_KCC} ${SFLAGS} -m${ARCH_CONFIG_LC} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});
425 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@});
428 S_RULE_1B= ${patsubst %.o,%.s,${@}} > /dev/null
429 S_RULE_2= ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< \
430 > $(patsubst %.o, %.pp, ${@}); \
431 sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@});
432 S_RULE_3= ${S_KCC} ${SFLAGS} -m${ARCH_CONFIG_LC} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\
433 ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@})
436 # Compilation rules to generate .o from .c
438 COMP_COBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_COBJ_LIST))
440 $(COMP_COBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.c
441 ${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $<
444 # Compilation rules to generate .o from .c for normal files
446 C_RULE_1A=${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
453 # Compilation rules to generate .o from .c for driver files
455 C_RULE_1A_D=${C_RULE_1A}
456 C_RULE_1B_D=${C_RULE_1B}
457 C_RULE_2_D=${C_RULE_2}
458 C_RULE_3_D=${C_RULE_3}
459 C_RULE_4_D=${C_RULE_4}
462 # Compilation rules to generate .o from .m
464 M_RULE_1A=${KCC} -c ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
471 # Compilation rules to generate .co from .cp or .cpo from .cpp
472 # The config tool slickly changes the last source filename char to 'o'
473 # for the object filename.
475 P_RULE_1A=${KC++} -o $@ -c ${CPPFLAGS} ${CFLAGS} -MD ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}}
477 P_RULE_2=@sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d)
482 # Linker rule to generate a component
484 LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST))
486 COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE))
488 $(COMPONENT_IMAGE_FILE): $(LD_COMPONENT_OBJ_FILES)
489 @echo "[ creating $(COMPONENT_IMAGE) ]"
490 $(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT_IMAGE_FILE) ${LD_COMPONENT_OBJ_FILES};
491 (cd $(TARGET)$(COMP_OBJ_DIR); ${MD} -u Makedep -f -d `ls *.d`);
494 @echo "[ $(SOURCE) ] make setup_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
496 do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE)
497 @true echo "[ $(SOURCE) ] make do_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
499 ifeq ($(COMPONENT), .)
500 do_build_all: do_build_mach_kernel
504 # mach_kernel building rules
506 do_build_mach_kernel:
507 @echo "[ building mach_kernel ]";
508 $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kernel_newvers \
509 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.major`" \
510 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.minor`" \
511 "`${CAT} $(SRCROOT)/osfmk/conf/kernelversion.variant`"; \
512 ${KCC} $(CFLAGS) $(INCLUDES) -c kernel_vers.c; \
513 $(LD) $(LDFLAGS_KERNEL) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(component))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) kernel_vers.o -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS); \
514 $(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel;
516 # Generic Install rules
518 INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
522 $(INSTALL_FILE_FILES): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/% force_file_install
523 @echo Installing $< in $@;
524 @$(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \
525 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
526 $(RM) $(RMFLAGS) $@; \
527 install $(FILE_INSTALL_FLAGS) $< $(dir $@); \
529 if [ ! -e $@ ]; then \
531 lipo_arg="$(subst _empty_file, empty_file,$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
532 $(LIPO) $${lipo_arg} -create -output $@; \
533 $(RM) $(RMFLAGS) empty_file; \
535 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
538 INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST))
540 force_filesys_install:
542 $(INSTALL_FILESYS_FILES): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/%.sys force_filesys_install
543 @echo Installing $< in $@;
544 @$(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \
545 if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \
546 $(RM) $(RMFLAGS) $@; \
547 install $(INSTALL_FLAGS) $< $(dir $@); \
549 if [ ! -e $@ ]; then \
551 lipo_arg="$(subst _empty_file, empty_file,$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \
552 $(LIPO) $${lipo_arg} -create -output $@; \
553 $(RM) $(RMFLAGS) empty_file; \
555 $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \
558 INSTALL_DATA_FILES = $(addprefix $(DSTROOT)$(INSTALL_DATA_DIR), $(INSTALL_DATA_LIST))
560 $(INSTALL_DATA_FILES): $(DSTROOT)$(INSTALL_DATA_DIR)% : $(SOURCE)/%
561 @echo Installing $< in $@;
562 @$(MKDIR) $(dir $@); \
563 $(RM) $(RMFLAGS) $@; \
564 install $(DATA_INSTALL_FLAGS) $< $(dir $@);
567 @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
569 do_build_install: $(INSTALL_FILESYS_FILES) $(INSTALL_FILE_FILES) $(INSTALL_DATA_FILES)
570 @echo "[ $(SOURCE) ] make do_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
572 INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INSTALL_MAN_LIST))
574 do_installman: $(INSTALL_MAN_FILES)
575 @echo "[ $(SOURCE) ] make do_installman"
576 @if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
577 man_dir=$(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
578 if [ -d $$man_dir ]; then \
581 $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST); \
584 $(MKDIR) $$man_dir; \
586 echo Installing $(INSTALL_MAN_LIST) in $$man_dir; \
587 install $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \
590 $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : %
591 @true echo Installing $< in $(dir $@); \
592 $(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \
593 $(RM) $(RMFLAGS) $@; \
594 install $(INSTALL_FLAGS) $< $(dir $@);
596 ifeq ($(INCL_MAKEDEP), TRUE)