kbuild: clean up scripts/Makefile.host

The directory creation can be more simplified by two levels.

[1] Drop $(dir ...)

 $(dir $(f)) always returns non-empty string.

So, $(if $(dir $(f)),$(dir $(f)) is equivalent to $(dir $(f)).

[2] Unroll $(foreach ...) loop

$(dir ...) can take one or more arguments and returns a list of
directories of them.

$(foreach f, $(progs), $(dir $(f))) can be unrolled as $(dir $(progs)).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
Masahiro Yamada 2014-07-16 16:12:22 +09:00 коммит произвёл Michal Marek
Родитель 62e2210798
Коммит 6639355939
1 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -44,15 +44,11 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
# output directory for programs/.o files # output directory for programs/.o files
# hostprogs-y := tools/build may have been specified. Retrieve directory # hostprogs-y := tools/build may have been specified. Retrieve directory
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) host-objdirs := $(dir $(__hostprogs))
# directory of .o files from prog-objs notation # directory of .o files from prog-objs notation
host-objdirs += $(foreach f,$(host-cmulti), \ host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs)))
$(foreach m,$($(f)-objs), \
$(if $(dir $(m)),$(dir $(m)))))
# directory of .o files from prog-cxxobjs notation # directory of .o files from prog-cxxobjs notation
host-objdirs += $(foreach f,$(host-cxxmulti), \ host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs)))
$(foreach m,$($(f)-cxxobjs), \
$(if $(dir $(m)),$(dir $(m)))))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))