Skip to content

Commit

Permalink
kbuild: obj-dirs is calculated incorrectly if hostprogs-y is defined
Browse files Browse the repository at this point in the history
When Makefile.host is included, $(obj-dirs) is subjected to the
addprefix operation for the second time.  Prefix only needs to be added
to the newly added directories, but not to those that came from
Makefile.lib.

This causes the build system to create unneeded empty directories in the
build tree when building in a separate directory.  For instance,
lib/lib/zlib_inflate is created in the build tree.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
  • Loading branch information
Pavel Roskin authored and Sam Ravnborg committed Jun 8, 2006
1 parent 1def630 commit 9870a93
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/Makefile.host
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
__hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))

# hostprogs-y := tools/build may have been specified. Retreive directory
obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))


# C code
Expand Down Expand Up @@ -73,7 +73,9 @@ 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))
host-objdirs := $(addprefix $(obj)/,$(host-objdirs))

obj-dirs += $(host-objdirs)

#####
# Handle options to gcc. Support building with separate output directory
Expand Down

0 comments on commit 9870a93

Please sign in to comment.