From patchwork Mon Mar 31 07:41:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 3912701 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 79220BF540 for ; Mon, 31 Mar 2014 07:41:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E56E2037D for ; Mon, 31 Mar 2014 07:41:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B5F12037B for ; Mon, 31 Mar 2014 07:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbaCaHlu (ORCPT ); Mon, 31 Mar 2014 03:41:50 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:55588 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbaCaHlt (ORCPT ); Mon, 31 Mar 2014 03:41:49 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile12) with ESMTP id s2V7fluu000188; Mon, 31 Mar 2014 16:41:47 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili13) with ESMTP id s2V7fmJ10930; Mon, 31 Mar 2014 16:41:48 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi15) id s2V7fmOv015862; Mon, 31 Mar 2014 16:41:48 +0900 Received: from poodle by lomi15.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s2V7fl2J015837; Mon, 31 Mar 2014 16:41:47 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id B471A2740043; Mon, 31 Mar 2014 16:41:47 +0900 (JST) From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH] kbuild: create a build directory automatically for out-of-tree build Date: Mon, 31 Mar 2014 16:41:36 +0900 Message-Id: <1396251696-14815-1-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Kbuild supports saving output files in a separate directory. But the build directory must be created beforehand. For example, $ mkdir -p dir/to/store/output/files $ make O=dir/to/store/output/files defconfig Creating a build directory automatically would be useful. Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 575e1f8..35b5b7e 100644 --- a/Makefile +++ b/Makefile @@ -120,9 +120,10 @@ ifneq ($(KBUILD_OUTPUT),) # Invoke a second make in the output directory, passing relevant variables # check that the output directory actually exists saved-output := $(KBUILD_OUTPUT) -KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) +KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ + && /bin/pwd) $(if $(KBUILD_OUTPUT),, \ - $(error output directory "$(saved-output)" does not exist)) + $(error failed to create output directory "$(saved-output)")) PHONY += $(MAKECMDGOALS) sub-make