123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
- obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
- obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
- host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
- host-cmulti := $(foreach m,$(__hostprogs),\
- $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
- host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
- host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
- host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
- host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
- host-cobjs := $(filter-out %.so,$(host-cobjs))
- host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
- __hostprogs := $(addprefix $(obj)/,$(__hostprogs))
- host-csingle := $(addprefix $(obj)/,$(host-csingle))
- host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
- host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
- host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
- host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
- host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
- host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
- obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
- _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o)
- _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
- ifeq ($(KBUILD_SRC),)
- __hostc_flags = $(_hostc_flags)
- __hostcxx_flags = $(_hostcxx_flags)
- else
- __hostc_flags = -I$(obj) $(call flags,_hostc_flags)
- __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
- endif
- hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
- hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
- quiet_cmd_host-csingle = HOSTCC $@
- cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
- $(host-csingle): %: %.c FORCE
- $(call if_changed_dep,host-csingle)
- quiet_cmd_host-cmulti = HOSTLD $@
- cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
- $(addprefix $(obj)/,$($(@F)-objs)) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
- $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
- $(call if_changed,host-cmulti)
- quiet_cmd_host-cobjs = HOSTCC $@
- cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
- $(host-cobjs): %.o: %.c FORCE
- $(call if_changed_dep,host-cobjs)
- quiet_cmd_host-cxxmulti = HOSTLD $@
- cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
- $(foreach o,objs cxxobjs,\
- $(addprefix $(obj)/,$($(@F)-$(o)))) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
- $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
- $(call if_changed,host-cxxmulti)
- quiet_cmd_host-cxxobjs = HOSTCXX $@
- cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
- $(host-cxxobjs): %.o: %.cc FORCE
- $(call if_changed_dep,host-cxxobjs)
- quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
- cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
- $(host-cshobjs): %.o: %.c FORCE
- $(call if_changed_dep,host-cshobjs)
- quiet_cmd_host-cshlib = HOSTLLD -shared $@
- cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
- $(addprefix $(obj)/,$($(@F:.so=-objs))) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
- $(host-cshlib): %: $(host-cshobjs) FORCE
- $(call if_changed,host-cshlib)
- targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
- $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
|