1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2015, Olivier MATZ <zer0@droids-corp.org>
4 # dump some infos if debug is enabled
6 $(call disp_list,------ all-obj,$(all-obj))
7 $(foreach obj,$(all-obj),\
8 $(info,out-$(obj): $(out-$(obj))) \
9 $(call disp_list,pre-$(obj),$(pre-$(obj))) \
11 $(call disp_list,------ all-iobj,$(all-iobj))
12 $(foreach iobj,$(all-iobj),\
13 $(call disp_list,pre-$(iobj),$(pre-$(iobj))) \
17 # if a generated file has the same name than a user target,
19 conflicts := $(filter $(all-iobj),$(all-targets))
21 $(error Intermediate file has the same names than user targets:\
24 # include dependencies and commands files if they exist
25 $(foreach obj,$(all-obj),\
26 $(eval -include $(call depfile,$(obj))) \
27 $(eval -include $(call cmdfile,$(obj))) \
29 $(foreach iobj,$(all-iobj),\
30 $(eval -include $(call depfile,$(iobj))) \
31 $(eval -include $(call cmdfile,$(iobj))) \
35 filtered-all-iobj := $(sort $(all-iobj))
37 # convert source files to intermediate object file
38 $(filtered-all-iobj): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE
39 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
40 @$(call display_deps,$(pre-$(@)),$@,$(call compile_cmd,$(pre-$(@)),$@),$?)
41 @$(if $(call check_deps,$@,$(call compile_cmd,$(pre-$(@)),$@),$?),\
42 $(call compile_print_cmd,$(pre-$(@)),$@) && \
43 $(call compile_cmd,$(pre-$(@)),$@) && \
44 $(call save_cmd,$(call compile_cmd,$(pre-$(@)),$@),$@) && \
45 $(call obj-fixdep,$@))
48 filtered-all-obj := $(sort $(all-obj))
50 # combine several objects files to one
51 $(filtered-all-obj): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE
52 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
53 @$(call display_deps,$(pre-$(@)),$@,\
54 $(call combine_cmd,$(pre-$(@)),$@),$?)
55 @$(if $(call check_deps,$@,$(call combine_cmd,$(pre-$(@)),$@),$?),\
56 $(call combine_print_cmd,$(pre-$(@)),$@) && \
57 $(call combine_cmd,$(pre-$(@)),$@) && \
58 $(call save_cmd,$(call combine_cmd,$(pre-$(@)),$@),$@) && \
59 $(call create_empty_depfile,$@))