From patchwork Wed Dec 5 11:28:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152886 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9182328ljp; Wed, 5 Dec 2018 03:29:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/X92XcgnxoGz5O5Rq2gvJcC7IqSLCk/ok/JY2reHiy+iBmBq8xtQWQES9OquNg+8QDdy2VK X-Received: by 2002:a62:6cc8:: with SMTP id h191mr24826355pfc.89.1544009354629; Wed, 05 Dec 2018 03:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544009354; cv=none; d=google.com; s=arc-20160816; b=Eqhr5fLM1aYalbPJ1PTVNKT39jPm4Wk4vWmhr7LIch7Qp/Y0jqG0V0v5U09ImJO2Z/ W2bzSqnNWCPo5NzkyyseUtQjnY8wUcGPKJ8G8jZMUyAx3aeEOMJO6/RiMBUiMluD/maQ Lp/daG23zrEwREKjsldV9vw/OQ7aQ8R6oY0AN63cMau7kcdXWs+8spQRSv3dry+2WyCP JKTTqobhrug22m0EUiYpGwVO9HUWDa1jvK35c9D62b8TOin786O3krQ2qb+zMz7Hk93f hg8mh9Uyf94E8Z8wxvCKUyqHlbZGWs7zGDq9Vu8T5HP38BluzvPWycuojATdgc5Qxfyu 3k3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=sWyas4YPx7Kc+mWtxj9UKPr4KlAhoGwLASCZp+3wZhU=; b=l85YrAplWYie9ZSE8i+U8SqBRFvcOHUNkjE9RwbidMjjaMHzNsXsVzFXllNaHABuDd OpeRn7Ysn8B70ynPYx49EC8+zTeO809NesN+ggEh3ChoXTEWnyqY0ONWnyQeRRcHHEGU rCv0xqeDsKg9skqXo0pDIK3bvqMSJEFde0RDu0JMex0mA1ZEDrOf073BgSrsiAWgl3w0 uEYAC6TifqABrRSnEYFh7iAnzDg8sWqTUFY1iXmyxdR5eTXOdVpMCGvp8mVJlV6XLjNx JKzf+h+2klt7NeM2+t/cbErLaRf4O1kam+klewTnxICqTeMxPumqebsbcbi0JlTaVxDt mH9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w9S4OUbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si19955029plq.138.2018.12.05.03.29.14; Wed, 05 Dec 2018 03:29:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w9S4OUbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727719AbeLEL3M (ORCPT + 31 others); Wed, 5 Dec 2018 06:29:12 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:57972 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726937AbeLEL3L (ORCPT ); Wed, 5 Dec 2018 06:29:11 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wB5BSBlV028064; Wed, 5 Dec 2018 20:28:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wB5BSBlV028064 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544009292; bh=sWyas4YPx7Kc+mWtxj9UKPr4KlAhoGwLASCZp+3wZhU=; h=From:To:Cc:Subject:Date:From; b=w9S4OUbL7uO43hdC0S5b/isieGpBRChmF2XR3C5LWA5ongMKo1Egv23tDOrWEglsA T0G7r7k1uOn0AzftSYsEJk0Gmyw7yvak7t97CLQIEIPpF3/IQBI/yTQw0Aoj/I3Jwc m0wK8qvkG+Ug6KHxoLtnFlgxolvu+Kr5nhm6Ewsynifn367SuyIz0i3U1RJrry36KV oKApaiNcv4Nc5bgItsFJLZ8yNMEcuUz2lH77Bou6W5QNu3Fg2UbtRKNtCAwvJDAlfC E6yD0rC+8ji0kyqfDYZ8scdEMgLdCcO1BshvYncuXyxlm1miohYHcM4dId3MxZIHfC t49OPVTaiTT3Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: refactor Makefile.asm-generic Date: Wed, 5 Dec 2018 20:28:04 +0900 Message-Id: <1544009286-15705-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Use conventional $(MAKE) $(asm-generic)= style for directory descending - Remove unneeded FORCE since "all" is a phony target - Remove unneeded "_dummy :=" assignment - Skip $(shell mkdir ...) when headers exist in the directory - Misc cleanups Signed-off-by: Masahiro Yamada --- Makefile | 8 ++++---- scripts/Makefile.asm-generic | 37 +++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index ab38eb2..3af0379 100644 --- a/Makefile +++ b/Makefile @@ -1122,13 +1122,13 @@ prepare0: archprepare prepare: prepare0 prepare-objtool # Support for using generic headers in asm-generic +asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj + PHONY += asm-generic uapi-asm-generic asm-generic: uapi-asm-generic - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - src=asm obj=arch/$(SRCARCH)/include/generated/asm + $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm uapi-asm-generic: - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm + $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm PHONY += prepare-objtool prepare-objtool: $(objtool_target) diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 32ad8e9..760323e 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -2,41 +2,42 @@ # include/asm-generic contains a lot of files that are used # verbatim by several architectures. # -# This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild +# This Makefile reads the file arch/$(SRCARCH)/include/(uapi/)/asm/Kbuild # and for each file listed in this file with generic-y creates -# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src)) +# a small wrapper file in arch/$(SRCARCH)/include/generated/(uapi/)/asm. PHONY := all all: -kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild --include $(kbuild-file) +src := $(subst /generated,,$(obj)) +-include $(src)/Kbuild include scripts/Kbuild.include -# Create output directory if not already present -_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) +generic-y := $(addprefix $(obj)/, $(generic-y)) +generated-y := $(addprefix $(obj)/, $(generated-y)) -# Stale wrappers when the corresponding files are removed from generic-y -# need removing. -generated-y := $(generic-y) $(generated-y) -all-files := $(patsubst %, $(obj)/%, $(generated-y)) -old-headers := $(wildcard $(obj)/*.h) -unwanted := $(filter-out $(all-files),$(old-headers)) +# Remove stale wrappers when the corresponding files are removed from generic-y +old-headers := $(wildcard $(obj)/*.h) +unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers)) quiet_cmd_wrap = WRAP $@ -cmd_wrap = echo "\#include " >$@ + cmd_wrap = echo "\#include " > $@ quiet_cmd_remove = REMOVE $(unwanted) -cmd_remove = rm -f $(unwanted) + cmd_remove = rm -f $(unwanted) -all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE - $(if $(unwanted),$(call cmd,remove),) +all: $(generic-y) + $(if $(unwanted),$(call cmd,remove)) @: $(obj)/%.h: $(call cmd,wrap) -PHONY += FORCE +# Create output directory. Skip it if at least one old header exists +# since we know the output directory already exists. +ifeq ($(old-headers),) +$(shell mkdir -p $(obj)) +endif + .PHONY: $(PHONY) -FORCE: ;