kbuild: Create output directory in Makefile.modbuiltin
authorMichal Marek <mmarek@suse.cz>
Thu, 10 Jun 2010 10:23:08 +0000 (12:23 +0200)
committerMichal Marek <mmarek@suse.cz>
Thu, 10 Jun 2010 10:23:08 +0000 (12:23 +0200)
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/Makefile.modbuiltin

index 102a276f6eeac9c4a1f71da4235b4e1496242659..1adb974e6950efb80943f82b1c4ca416b09b5417 100644 (file)
@@ -14,6 +14,11 @@ __modbuiltin:
 
 include scripts/Kbuild.include
 
+ifneq ($(KBUILD_SRC),)
+# Create output directory if not already present
+_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
+endif
+
 # The filename Kbuild has precedence over Makefile
 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)