From patchwork Wed Jul 16 07:12:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 4564841 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 DEE369F1D6 for ; Wed, 16 Jul 2014 07:12:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D48B201BB for ; Wed, 16 Jul 2014 07:12:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BA0F201B4 for ; Wed, 16 Jul 2014 07:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759164AbaGPHMi (ORCPT ); Wed, 16 Jul 2014 03:12:38 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:34722 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759080AbaGPHMh (ORCPT ); Wed, 16 Jul 2014 03:12:37 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile14) with ESMTP id s6G7CRvC014283; Wed, 16 Jul 2014 16:12:27 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili14) with ESMTP id s6G7CSL14821; Wed, 16 Jul 2014 16:12:28 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi17) id s6G7CSVp028470; Wed, 16 Jul 2014 16:12:28 +0900 Received: from poodle by lomi17.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s6G7CRKo028430; Wed, 16 Jul 2014 16:12:27 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id B39022743A5D; Wed, 16 Jul 2014 16:12:27 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Michal Marek , Masahiro Yamada Subject: [PATCH v3 4/5] kbuild: clean up scripts/Makefile.host Date: Wed, 16 Jul 2014 16:12:22 +0900 Message-Id: <1405494743-29566-5-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405494743-29566-1-git-send-email-yamada.m@jp.panasonic.com> References: <1405494743-29566-1-git-send-email-yamada.m@jp.panasonic.com> 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.9 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 The directory creation can be more simplified by two levels. [1] Drop $(dir ...) $(dir $(f)) always returns non-empty string. So, $(if $(dir $(f)),$(dir $(f)) is equivalent to $(dir $(f)). [2] Unroll $(foreach ...) loop $(dir ...) can take one or more arguments and returns a list of directories of them. $(foreach f, $(progs), $(dir $(f))) can be unrolled as $(dir $(progs)). Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: - Further more clean-up by enrolling $(foreach ) loop scripts/Makefile.host | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 1c2e570..bb6a11f 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -44,15 +44,11 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) # output directory for programs/.o files # hostprogs-y := tools/build may have been specified. Retrieve directory -host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) +host-objdirs := $(dir $(__hostprogs)) # directory of .o files from prog-objs notation -host-objdirs += $(foreach f,$(host-cmulti), \ - $(foreach m,$($(f)-objs), \ - $(if $(dir $(m)),$(dir $(m))))) +host-objdirs += $(dir $(foreach f,$(host-cmulti), $($(f)-objs))) # directory of .o files from prog-cxxobjs notation -host-objdirs += $(foreach f,$(host-cxxmulti), \ - $(foreach m,$($(f)-cxxobjs), \ - $(if $(dir $(m)),$(dir $(m))))) +host-objdirs += $(dir $(foreach f,$(host-cxxmulti), $($(f)-cxxobjs))) host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))