diff --git a/arch/ppc/boot/lib/Makefile b/arch/ppc/boot/lib/Makefile
index 9d088a5668490dfd9ab7a0cce63b2ec5cf956368..df5471fb281c90a2c2c85ffa739386d1fa72dd82 100644
--- a/arch/ppc/boot/lib/Makefile
+++ b/arch/ppc/boot/lib/Makefile
@@ -4,7 +4,13 @@
 
 CFLAGS_kbd.o	+= -Idrivers/char
 
-lib-y := $(addprefix ../../../../lib/zlib_inflate/, \
+ZLIB_DIR := ../../../../lib/zlib_inflate/
+
+lib-y := $(addprefix $(ZLIB_DIR), \
            infblock.o infcodes.o inffast.o inflate.o inftrees.o infutil.o)
 lib-y += div64.o
 lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
+
+ifneq ($(KBUILD_SRC),)
+_make_zlib_dir := $(shell [ -d $(obj)/$(ZLIB_DIR) ] || mkdir -p $(obj)/$(ZLIB_DIR) )
+endif