From patchwork Sun Jun 30 08:01:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zzs0213@gmail.com X-Patchwork-Id: 2804301 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0747E9F9FB for ; Sun, 30 Jun 2013 08:03:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DD27200ED for ; Sun, 30 Jun 2013 08:02:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06950200DE for ; Sun, 30 Jun 2013 08:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751322Ab3F3IC5 (ORCPT ); Sun, 30 Jun 2013 04:02:57 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:46939 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261Ab3F3ICy (ORCPT ); Sun, 30 Jun 2013 04:02:54 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz11so3903486pad.2 for ; Sun, 30 Jun 2013 01:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=1ZuOCNfSFJ6YewuICcVehr3ErXELvH/xwOW/pqVpSX8=; b=O0NV159WgUF8MNySF2lXBihE5i+3za7OXuKlu4BOTHuoecwag8hSdYU6mb9/r5/lVK i49K7/G0hkju0yG7nN2InC4a3Gr1kGC/HTFN9TyMmb/PzQnxqoweynvas7lM3eiuIdni uxVHv1PqNf9+V/xCei2wW94+fwleshqihU36YLjsyprdTDlkDgl1A7cSx8OnRoBmqYWl 0VLjttEQ1aOAtCyMoVGPr8jUPCFbH7XTSvDG8UBHt2yf62rPx6eSPtTZ+G6mr5yhJTuE k0e3tI7MDt+PRUFOR+yWPVNDUwnU8tCN9vOwxZvpmRVdacwmyW8dar/+HZlgroaFwjHr XhnQ== X-Received: by 10.66.82.162 with SMTP id j2mr18885185pay.168.1372579374162; Sun, 30 Jun 2013 01:02:54 -0700 (PDT) Received: from localhost.localdomain ([171.214.236.144]) by mx.google.com with ESMTPSA id aj3sm17642943pad.8.2013.06.30.01.02.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Jun 2013 01:02:53 -0700 (PDT) From: =?UTF-8?q?=E5=BC=A0=E5=BF=A0=E5=B1=B1?= To: Cc: , , =?UTF-8?q?=E5=BC=A0=E5=BF=A0=E5=B1=B1?= Subject: [PATCH] let kbuild mkdir for dir/file.o Date: Sun, 30 Jun 2013 16:01:09 +0800 Message-Id: <1372579269-6642-1-git-send-email-zzs0213@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <51CE11C2.5020406@suse.cz> References: <51CE11C2.5020406@suse.cz> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 When add a obj with dir to obj-y, like this obj-y += dir/file.o The $(obj)/dir not created, this patch fix this. When try to add a file(which in a subdir) to my board's obj-y, the build progress crashed. For example, I use at91rm9200ek board, and in kernel dir run: mkdir objtree make O=objtree at91rm9200-defconfig mkdir arch/arm/mach-at91/dir touch arch/arm/mach-at91/dir/file.c and edit arch/arm/mach-at91/dir/file.c to add some code. then edit arch/arm/mach-at91/Makefile, change the following line: obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o to: obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o dir/file.o Now build it: make O=objtree Then the error appears: ... CC arch/arm/mach-at91/board-rm9200dk.o CC arch/arm/mach-at91/board-rm9200ek.o CC arch/arm/mach-at91/dir/file.o linux-2.6/arch/arm/mach-at91/dir/file.c:5: fatal error: opening dependency file arch/arm/mach-at91/dir/.file.o.d: No such file or directory Check the objtree: LANG=en ls objtree/arch/arm/mach-at91/dir ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directory It's apparently that the target dir not created for file.o Check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs). But if the dir need not to create a built-in.o, It should never in $(obj-dirs). So I make this patch to make sure It in $(obj-dirs) this bug caused by commit f5fb976520a53f45f8bbf2e851f16b3b5558d485 Signed-off-by: ??? --- scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 51bb3de..6bae5a9 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -63,7 +63,8 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) # $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) +obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y)) # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)