From patchwork Tue Jun 4 10:13:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE3382D49 for ; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD7BA281DB for ; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1251287E5; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30B40287D2 for ; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727413AbfFDKPv (ORCPT ); Tue, 4 Jun 2019 06:15:51 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39514 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727139AbfFDKPu (ORCPT ); Tue, 4 Jun 2019 06:15:50 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC77032511; Tue, 4 Jun 2019 19:14:14 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC77032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643255; bh=pUquGiN6xNeDHSibS2E6fCO5H4gfpfVcs2A9RbnL/14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AblFESWR5OlGEncv08R8Lc2lsYWxIVUQcbeaUgKG0cPSzPHOn0qLs/Ti1OaBxUsqu VdmsFA5lxplHPlDHqHnCSWqMPGmItXfMZfK17mHav7GDD0pUwOt0sTRC/I4gAmFYdP dDtT+DbuklcVZff3lNDn8os+44DqasROkKb/XGxtdy0LLiGqJLGPEgmBzOoGnq9tkF Md4Aqfd92wCJ+zvQzTPiEY3Yk0Au9tRE5z/aqLw8/NkbZ0RtTYbzdvc5Ks95hvl08q zTXIYtrtS+6+M5A/pB97Zgnpxd6uO1wEGOyUWut5M5kCjIIdiUKvUBMhiD4ItfkUP9 K50zQWy9tn69A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Michal Marek Subject: [PATCH 01/15] kbuild: remove headers_{install,check}_all Date: Tue, 4 Jun 2019 19:13:55 +0900 Message-Id: <20190604101409.2078-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP headers_install_all does not make much sense any more because different architectures export different set of uapi/linux/ headers. As you see in include/uapi/linux/Kbuild, the installation of a.out.h, kvm.h, and kvm_para.h is arch-dependent. So, headers_install_all repeats the installation/removal of them. If somebody really thinks it is useful to do headers_install for all architectures, it would be possible by small shell-scripting, but the top Makefile do not have to provide entry targets just for that purpose. Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- Documentation/kbuild/headers_install.txt | 7 ------ Documentation/kbuild/makefiles.txt | 6 +---- Makefile | 15 ++---------- scripts/headers.sh | 29 ------------------------ 4 files changed, 3 insertions(+), 54 deletions(-) delete mode 100755 scripts/headers.sh diff --git a/Documentation/kbuild/headers_install.txt b/Documentation/kbuild/headers_install.txt index f0153adb95e2..f07e34eab70b 100644 --- a/Documentation/kbuild/headers_install.txt +++ b/Documentation/kbuild/headers_install.txt @@ -39,12 +39,5 @@ INSTALL_HDR_PATH indicates where to install the headers. It defaults to An 'include' directory is automatically created inside INSTALL_HDR_PATH and headers are installed in 'INSTALL_HDR_PATH/include'. -The command "make headers_install_all" exports headers for all architectures -simultaneously. (This is mostly of interest to distribution maintainers, -who create an architecture-independent tarball from the resulting include -directory.) You also can use HDR_ARCH_LIST to specify list of architectures. -Remember to provide the appropriate linux/asm directory via "mv" or "ln -s" -before building a C library with headers exported this way. - The kernel header export infrastructure is maintained by David Woodhouse . diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index d65ad5746f94..bac301a73a86 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -897,11 +897,7 @@ When kbuild executes, the following steps are followed (roughly): --- 6.2 Add prerequisites to archheaders: The archheaders: rule is used to generate header files that - may be installed into user space by "make header_install" or - "make headers_install_all". In order to support - "make headers_install_all", this target has to be able to run - on an unconfigured tree, or a tree configured for another - architecture. + may be installed into user space by "make header_install". It is run before "make archprepare" when run on the architecture itself. diff --git a/Makefile b/Makefile index 004d67a4405f..7745bdd84861 100644 --- a/Makefile +++ b/Makefile @@ -1181,34 +1181,23 @@ headerdep: #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -# If we do an all arch process set dst to include/arch-$(SRCARCH) -hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include) - PHONY += archheaders archscripts PHONY += __headers __headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts $(Q)$(MAKE) $(build)=scripts build_unifdef -PHONY += headers_install_all -headers_install_all: - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install - PHONY += headers_install headers_install: __headers $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) - -PHONY += headers_check_all -headers_check_all: headers_install_all - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include PHONY += headers_check headers_check: headers_install $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include HDRCHECK=1 ifdef CONFIG_HEADERS_CHECK all: headers_check diff --git a/scripts/headers.sh b/scripts/headers.sh deleted file mode 100755 index e0f883eb39a2..000000000000 --- a/scripts/headers.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# Run headers_$1 command for all suitable architectures - -# Stop on error -set -e - -do_command() -{ - if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then - make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 - else - printf "Ignoring arch: %s\n" ${arch} - fi -} - -archs=${HDR_ARCH_LIST:-$(ls ${srctree}/arch)} - -for arch in ${archs}; do - case ${arch} in - um) # no userspace export - ;; - *) - if [ -d ${srctree}/arch/${arch} ]; then - do_command $1 ${arch} - fi - ;; - esac -done From patchwork Tue Jun 4 10:13:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94E9D1398 for ; Tue, 4 Jun 2019 10:15:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A1A127F94 for ; Tue, 4 Jun 2019 10:15:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E4042818E; Tue, 4 Jun 2019 10:15:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C796327F94 for ; Tue, 4 Jun 2019 10:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfFDKPi (ORCPT ); Tue, 4 Jun 2019 06:15:38 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39169 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbfFDKPi (ORCPT ); Tue, 4 Jun 2019 06:15:38 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC78032511; Tue, 4 Jun 2019 19:14:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC78032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643256; bh=e9SJiB4wnNAkhH818NbOR4wiR7iq+acLPPc6r/sEHqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wHBFMpviCKXyTlZK9yx9rTb6w54/CFiGPJKXwz3QNn4NZbc6VjSt4uDy4FBFy4I5d Ofpl6bCf61/AQZAtZjS5QtZvoIB2HxrHCZvJ58O6MpiexlY8Bkw62/v6GZN6W1oA3f 02a9bI9qWYRoL3jrINrk6i3GmRU994yZl4W2co2a9U0aYYVlK9MNNk1xlsPdgvPDK2 bKeuoBcMHpbm+RJ5ns27JAJHEQknqCQETn64BVurzli3sl6ogWLPTKMCu+sKNrjz37 yg7aqlh9VDlehbbmy/6qUwbJoroYTlc0JIsU91O9gOXSv8gNVu0hNTv9SNw2KLTWGg ehBAHQJCJFt1Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 02/15] kbuild: remove stale dependency between Documentation/ and headers_install Date: Tue, 4 Jun 2019 19:13:56 +0900 Message-Id: <20190604101409.2078-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 8e2faea877eb ("Make Documenation depend on headers_install") dates back to 2014, which is before Sphinx was introduced for the kernel documentation. Since none of DOC_TARGET requires headers_install, it is strange to run it only for the single target "Documentation/". Signed-off-by: Masahiro Yamada --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7745bdd84861..67b866d19269 100644 --- a/Makefile +++ b/Makefile @@ -1745,8 +1745,7 @@ build-dir = $(patsubst %/,%,$(dir $(build-target))) PHONY += / /: ./ -# Make sure the latest headers are built for Documentation -Documentation/ samples/: headers_install +samples/: headers_install %/: prepare FORCE $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) From patchwork Tue Jun 4 10:13:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4777513AD for ; Tue, 4 Jun 2019 10:16:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37320281DB for ; Tue, 4 Jun 2019 10:16:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B0E7287E5; Tue, 4 Jun 2019 10:16:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD62C281DB for ; Tue, 4 Jun 2019 10:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726982AbfFDKQO (ORCPT ); Tue, 4 Jun 2019 06:16:14 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39199 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbfFDKPj (ORCPT ); Tue, 4 Jun 2019 06:15:39 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC79032511; Tue, 4 Jun 2019 19:14:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC79032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643257; bh=A3Q6+8g2ASpEJmIcz4ywD24MTjUJJltUdc3L3A7Y6dA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUydSxrFjQndOsqXHTND+J0Wq/0fcQkiEtcCGiDQZBQAEZ78jmsAtuLMM+vLdHiZW Az+6zv3dJIVqAa+BDWEVhcQEzPmL7eiiBlsIE3fpf8G9otHKTkTOVF8NvOn/ea/yb9 GD2b9itMxFosT1xsTQkSlnYqfS/R6eNoTXaiwUIlbt8c6kpWuJgYLtLMBKXgzl2VB+ b/bSrboqS6rBydMLU9M6f/oQLfDVOjKkG2O7qIfkZLydJYU/8fOEf6rdFbpasL4HaE yIOkP8P9xwlCvGZKKxIe9qlKf4dIu3413DgflF2m5U+ciPLWeRLrlFWkoW+YFBDnhU aTv+zZiWpK2qA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 03/15] kbuild: make gdb_script depend on prepare0 instead of prepare Date: Tue, 4 Jun 2019 19:13:57 +0900 Message-Id: <20190604101409.2078-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 'gdb_script' needs headers generated by ./Kbuild, which is visited by 'prepare0'. None of 'gdb_script' depends on 'prepare'. Loosen the dependency. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 67b866d19269..8348939765d3 100644 --- a/Makefile +++ b/Makefile @@ -1541,7 +1541,7 @@ $(DOC_TARGETS): scripts_basic FORCE # --------------------------------------------------------------------------- PHONY += scripts_gdb -scripts_gdb: prepare +scripts_gdb: prepare0 $(Q)$(MAKE) $(build)=scripts/gdb $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) From patchwork Tue Jun 4 10:13:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 073BB13AD for ; Tue, 4 Jun 2019 10:16:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAA52287D2 for ; Tue, 4 Jun 2019 10:16:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEADF287E6; Tue, 4 Jun 2019 10:16:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DE72287D2 for ; Tue, 4 Jun 2019 10:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727339AbfFDKPn (ORCPT ); Tue, 4 Jun 2019 06:15:43 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39318 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfFDKPn (ORCPT ); Tue, 4 Jun 2019 06:15:43 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7A032511; Tue, 4 Jun 2019 19:14:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7A032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643258; bh=UUUjFRogbBACivTlFc6RgzhbVkPaCnIYQJXNtS0Cn2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pHvc2lxavg4I4Q3qoMUzW+SXQ01lTpJbEksIGn94RMsh+7NKYUWzu/3ELUBMZdrWx 4u0ldaTSyoez+pXhB7SzlMB5Hig069bPACKP76bGaeiVEyVIdsdt3o4KXykw7R+sMK KhtNOE1cED0YSHV/Xc+YMKFHPpJXe0un5tB9tC8xaHA+qCuzqqtbMhrlJhAvugkBoG vMM+sYS6IuYgadmgW1lKC8HBXgUGlaDEufXu8Urh4mb3OGmSr/eu4hrNOeyKrD4VaS MmA2sW32rC+eKVvBg5mQiYSN1cFEuSiXgA9Av/r5mKniEfMn7flHVowjSuZsNd1sr0 Ew8hewIOFKrUw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 04/15] kbuild: fix Kconfig prompt of CONFIG_HEADERS_CHECK Date: Tue, 4 Jun 2019 19:13:58 +0900 Message-Id: <20190604101409.2078-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prior to commit 257edce66d31 ("kbuild: exploit parallel building for CONFIG_HEADERS_CHECK"), the sanity check of exported headers was done as a side-effect of build rule of vmlinux. That commit is good, but I missed to update the prompt of the Kconfig entry. For the sake of preciseness, lets' say "when building 'all'". Signed-off-by: Masahiro Yamada --- lib/Kconfig.debug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index cbdfae379896..7cdcb962358c 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -306,11 +306,11 @@ config DEBUG_FS If unsure, say N. config HEADERS_CHECK - bool "Run 'make headers_check' when building vmlinux" + bool "Run sanity checks on uapi headers when building 'all'" depends on !UML help - This option will extract the user-visible kernel headers whenever - building the kernel, and will run basic sanity checks on them to + This option will extract the user-visible kernel headers when + building the 'all' target, and will run basic sanity checks on them to ensure that exported files do not attempt to include files which were not exported, etc. From patchwork Tue Jun 4 10:13:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EB441398 for ; Tue, 4 Jun 2019 10:17:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A803287D2 for ; Tue, 4 Jun 2019 10:17:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F19CD281DB; Tue, 4 Jun 2019 10:17:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F307281DB for ; Tue, 4 Jun 2019 10:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727376AbfFDKRS (ORCPT ); Tue, 4 Jun 2019 06:17:18 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:41888 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfFDKRS (ORCPT ); Tue, 4 Jun 2019 06:17:18 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7B032511; Tue, 4 Jun 2019 19:14:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7B032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643259; bh=Oka5YpAg+k5l88SL/bB7/ELT3B4mHTq93jBuR0XeVDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+lYbqkDyx5TCbBD+Dn9u83I3HtBZWpgzIStSV9W5m8Vm7NsIAtCgZTTnviNOz2/k OIa3qQLjn3LJ7SFdO7cx4WcnlaqSOAOAOumyzJ/LJRtUiJsfCSRsZYwrzkeOJHFloh 5StGJrqnxtUoL1ZJgKMKnW+FVSO1PQZGYbOztFRAmSmiiFVQv6vKdRLA4xCR4r48yn wXht5Fpzui7RHx47kKqdrv4g+1N3wRkcfOsMq3aPvHHshb53vEmzlWyFS9ffiyfLYg ENAWvph9pzP8vXv0G83Xee/xAieRnQjeb2MJfRFGjniA0vGhfY5j4gVUCvNpi8ZGY8 i977mhymYRHng== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , linux-s390@vger.kernel.org, Vasily Gorbik , Greentime Hu , linux-parisc@vger.kernel.org, "James E.J. Bottomley" , Helge Deller , Vineet Gupta , linux-kernel@vger.kernel.org, Vincent Chen , Michal Marek , Paul Mackerras , Christian Borntraeger , Benjamin Herrenschmidt , Michael Ellerman , linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Heiko Carstens Subject: [PATCH 05/15] kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of samples Date: Tue, 4 Jun 2019 19:13:59 +0900 Message-Id: <20190604101409.2078-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 5318321d367c ("samples: disable CONFIG_SAMPLES for UML") used a big hammer to fix the build errors under the samples/ directory, while only some samples actually include uapi headers from usr/include. Introduce CONFIG_HEADERS_INSTALL since 'depends on HEADERS_INSTALL' is clearer than 'depends on !UML'. If this option is enabled, uapi headers are installed before starting directory descending. I added 'depends on HEADERS_INSTALL' to per-sample CONFIG options. This allows UML to compile some samples. $ make ARCH=um allmodconfig samples/ [ snip ] CC [M] samples/configfs/configfs_sample.o CC [M] samples/kfifo/bytestream-example.o CC [M] samples/kfifo/dma-example.o CC [M] samples/kfifo/inttype-example.o CC [M] samples/kfifo/record-example.o CC [M] samples/kobject/kobject-example.o CC [M] samples/kobject/kset-example.o CC [M] samples/trace_events/trace-events-sample.o CC [M] samples/trace_printk/trace-printk.o AR samples/vfio-mdev/built-in.a AR samples/built-in.a Signed-off-by: Masahiro Yamada --- Makefile | 8 ++++---- arch/arc/configs/tb10x_defconfig | 1 + arch/nds32/configs/defconfig | 1 + arch/parisc/configs/a500_defconfig | 1 + arch/parisc/configs/b180_defconfig | 1 + arch/parisc/configs/c3000_defconfig | 1 + arch/parisc/configs/default_defconfig | 1 + arch/powerpc/configs/ppc6xx_defconfig | 1 + arch/s390/configs/debug_defconfig | 1 + lib/Kconfig.debug | 19 ++++++++++++++----- samples/Kconfig | 14 +++++++++++--- samples/Makefile | 4 ++-- 12 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 8348939765d3..ce5a9551860d 100644 --- a/Makefile +++ b/Makefile @@ -1053,9 +1053,6 @@ vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE targets := vmlinux -# Some samples need headers_install. -samples: headers_install - # The actual objects are generated when descending, # make sure no implicit rule kicks in $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; @@ -1199,6 +1196,10 @@ headers_check: headers_install $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include HDRCHECK=1 +ifdef CONFIG_HEADERS_INSTALL +prepare: headers_install +endif + ifdef CONFIG_HEADERS_CHECK all: headers_check endif @@ -1745,7 +1746,6 @@ build-dir = $(patsubst %/,%,$(dir $(build-target))) PHONY += / /: ./ -samples/: headers_install %/: prepare FORCE $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig index 5b5119d2b5d5..dc739bd093e3 100644 --- a/arch/arc/configs/tb10x_defconfig +++ b/arch/arc/configs/tb10x_defconfig @@ -94,6 +94,7 @@ CONFIG_CONFIGFS_FS=y CONFIG_DEBUG_INFO=y CONFIG_STRIP_ASM_SYMS=y CONFIG_DEBUG_FS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_MAGIC_SYSRQ=y diff --git a/arch/nds32/configs/defconfig b/arch/nds32/configs/defconfig index 65ce9259081b..40313a635075 100644 --- a/arch/nds32/configs/defconfig +++ b/arch/nds32/configs/defconfig @@ -92,6 +92,7 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF4=y CONFIG_GDB_SCRIPTS=y CONFIG_READABLE_ASM=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_MAGIC_SYSRQ=y diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig index 5acb93dcaabf..390c0bc09179 100644 --- a/arch/parisc/configs/a500_defconfig +++ b/arch/parisc/configs/a500_defconfig @@ -167,6 +167,7 @@ CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_DEBUG_FS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_MAGIC_SYSRQ=y # CONFIG_DEBUG_BUGVERBOSE is not set diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig index 83ffd161aec5..bdf1fe2b217f 100644 --- a/arch/parisc/configs/b180_defconfig +++ b/arch/parisc/configs/b180_defconfig @@ -91,6 +91,7 @@ CONFIG_NLS_ASCII=m CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig index 8d41a73bd71b..ed4d49575b38 100644 --- a/arch/parisc/configs/c3000_defconfig +++ b/arch/parisc/configs/c3000_defconfig @@ -140,6 +140,7 @@ CONFIG_NLS_ISO8859_1=m CONFIG_NLS_ISO8859_15=m CONFIG_NLS_UTF8=m CONFIG_DEBUG_FS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_MUTEXES=y diff --git a/arch/parisc/configs/default_defconfig b/arch/parisc/configs/default_defconfig index 52c9050a7c5c..fcfd9eaadf9b 100644 --- a/arch/parisc/configs/default_defconfig +++ b/arch/parisc/configs/default_defconfig @@ -184,6 +184,7 @@ CONFIG_NLS_KOI8_R=m CONFIG_NLS_KOI8_U=m CONFIG_NLS_UTF8=y CONFIG_DEBUG_FS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig index 7c6baf6df139..463aa3e53084 100644 --- a/arch/powerpc/configs/ppc6xx_defconfig +++ b/arch/powerpc/configs/ppc6xx_defconfig @@ -1124,6 +1124,7 @@ CONFIG_NLS_KOI8_R=m CONFIG_NLS_KOI8_U=m CONFIG_DEBUG_INFO=y CONFIG_UNUSED_SYMBOLS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/configs/debug_defconfig index b0920b35f87b..994e03fad424 100644 --- a/arch/s390/configs/debug_defconfig +++ b/arch/s390/configs/debug_defconfig @@ -586,6 +586,7 @@ CONFIG_GDB_SCRIPTS=y CONFIG_FRAME_WARN=1024 CONFIG_READABLE_ASM=y CONFIG_UNUSED_SYMBOLS=y +CONFIG_HEADERS_INSTALL=y CONFIG_HEADERS_CHECK=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_MAGIC_SYSRQ=y diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7cdcb962358c..6a6ea4219d1e 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -305,14 +305,23 @@ config DEBUG_FS If unsure, say N. +config HEADERS_INSTALL + bool "Install uapi headers to usr/include" + depends on !UML + help + This option will install uapi headers (headers exported to user-space) + into the usr/include directory for use during the kernel build. + This is unneeded for building the kernel itself, but needed for some + user-space program samples. It is also needed by some features such + as uapi header sanity checks. + config HEADERS_CHECK bool "Run sanity checks on uapi headers when building 'all'" - depends on !UML + depends on HEADERS_INSTALL help - This option will extract the user-visible kernel headers when - building the 'all' target, and will run basic sanity checks on them to - ensure that exported files do not attempt to include files which - were not exported, etc. + This option will run basic sanity checks on uapi headers when + building the 'all' target, for example, ensure that they do not + attempt to include files which were not exported, etc. If you're making modifications to header files which are relevant for userspace, say 'Y', and check the headers diff --git a/samples/Kconfig b/samples/Kconfig index d63cc8a3e0df..71b5e833dd9e 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SAMPLES bool "Sample kernel code" - depends on !UML help You can build and test sample kernel code here. @@ -95,16 +94,24 @@ config SAMPLE_CONFIGFS config SAMPLE_CONNECTOR tristate "Build connector sample -- loadable modules only" - depends on CONNECTOR && m + depends on CONNECTOR && HEADERS_INSTALL && m help When enabled, this builds both a sample kernel module for the connector interface and a user space tool to communicate with it. See also Documentation/connector/connector.txt +config SAMPLE_HIDRAW + bool "hidraw sample" + depends on HEADERS_INSTALL + +config SAMPLE_PIDFD + bool "pidfd sample" + depends on HEADERS_INSTALL + config SAMPLE_SECCOMP bool "Build seccomp sample code" - depends on SECCOMP_FILTER + depends on SECCOMP_FILTER && HEADERS_INSTALL help Build samples of seccomp filters using various methods of BPF filter construction. @@ -156,6 +163,7 @@ config SAMPLE_ANDROID_BINDERFS config SAMPLE_VFS bool "Build example programs that use new VFS system calls" + depends on HEADERS_INSTALL help Build example userspace programs that use new VFS system calls such as mount API and statx(). Note that this is restricted to the x86 diff --git a/samples/Makefile b/samples/Makefile index debf8925f06f..7d6e4ca28d69 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -4,14 +4,14 @@ obj-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs/ obj-$(CONFIG_SAMPLE_CONFIGFS) += configfs/ obj-$(CONFIG_SAMPLE_CONNECTOR) += connector/ -subdir-y += hidraw +subdir-$(CONFIG_SAMPLE_HIDRAW) += hidraw obj-$(CONFIG_SAMPLE_HW_BREAKPOINT) += hw_breakpoint/ obj-$(CONFIG_SAMPLE_KDB) += kdb/ obj-$(CONFIG_SAMPLE_KFIFO) += kfifo/ obj-$(CONFIG_SAMPLE_KOBJECT) += kobject/ obj-$(CONFIG_SAMPLE_KPROBES) += kprobes/ obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch/ -subdir-y += pidfd +subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd obj-$(CONFIG_SAMPLE_QMI_CLIENT) += qmi/ obj-$(CONFIG_SAMPLE_RPMSG_CLIENT) += rpmsg/ subdir-$(CONFIG_SAMPLE_SECCOMP) += seccomp From patchwork Tue Jun 4 10:14:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E4181398 for ; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B22C281DB for ; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DFA6287E9; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE3E6281DB for ; Tue, 4 Jun 2019 10:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfFDKPy (ORCPT ); Tue, 4 Jun 2019 06:15:54 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39611 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbfFDKPx (ORCPT ); Tue, 4 Jun 2019 06:15:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7C032511; Tue, 4 Jun 2019 19:14:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7C032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643260; bh=SRMHg0IpoERvkCvtt+MdEA3HXdaBY06TLuJd2kcOM8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wyo7UKxFMBHIhbSEfEStq4ZJX/1enP0S4yg0HdvkfmfVToQqkqnScLLeq53gQE5za UzQ5PMfKvCiSG09nGjslEwlWkSMIEFXXLSJ2XVkaA/KCeKlXdcaUQb0LX9sINk9K9d nTNG/1tzmggZl/DLljcTWuwokwCiMNjuRD5Ow1PmQ+8l6g9bBNJqwMCV7MbNN5Huvu igtNKOEs1W8tLtM4nwv0rkmmTU35RV9/5OAreKgH9JdSYbIvSrAEFr/dyc8gprIuj5 0z2z1QXGHwKoD06HrTVnjzB1Qt46PdB3HOnk5hIOyCh/cF/MM6PDeKY98tSRB79LBe KyEO295SLSW5Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 06/15] kbuild: remove build_unifdef target in scripts/Makefile Date: Tue, 4 Jun 2019 19:14:00 +0900 Message-Id: <20190604101409.2078-7-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 2aedcd098a94 ("kbuild: suppress annoying "... is up to date." message"), if_changed and friends nicely suppress "... is up to date" We do not need per-Makefile tricks. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/Makefile | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ce5a9551860d..e998c40c94b4 100644 --- a/Makefile +++ b/Makefile @@ -1182,7 +1182,7 @@ PHONY += archheaders archscripts PHONY += __headers __headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts - $(Q)$(MAKE) $(build)=scripts build_unifdef + $(Q)$(MAKE) $(build)=scripts scripts/unifdef PHONY += headers_install headers_install: __headers diff --git a/scripts/Makefile b/scripts/Makefile index 9d442ee050bd..16bcb8087899 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -31,11 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m) # The following hostprogs-y programs are only build on demand hostprogs-y += unifdef -# These targets are used internally to avoid "is up to date" messages -PHONY += build_unifdef -build_unifdef: $(obj)/unifdef - @: - subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_SECURITY_SELINUX) += selinux From patchwork Tue Jun 4 10:14:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BAB61398 for ; Tue, 4 Jun 2019 10:16:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C590281DB for ; Tue, 4 Jun 2019 10:16:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1065F287E5; Tue, 4 Jun 2019 10:16:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A218E281DB for ; Tue, 4 Jun 2019 10:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727390AbfFDKPt (ORCPT ); Tue, 4 Jun 2019 06:15:49 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39349 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbfFDKPo (ORCPT ); Tue, 4 Jun 2019 06:15:44 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7D032511; Tue, 4 Jun 2019 19:14:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7D032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643261; bh=H2hb1rFxVd8vHXaptRM3sOd643GclddrQKolqKpXINY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4rG5ouSgpTeBTdm1t8he1y5hpf62Q1dbSEmqMuyECjosHT0jnx102AWpORD7ktc9 urK7tk8gFJFGuQRa1lWxU4znmjdssG3HWp+B66VehHKcBZa/TahSvw5lJjuJRDNkgQ 0t2pZqguJaCBVXQts45mQ91bR94+TjUM76Wrhnv18O4wY1pWuRImUZg+VorPG0NSY3 wOMAFxmuakQ1z8+7ycZ/0VysAedtHWvqePToWSJC4GXsRy3lo5HKAEfjt9ppze29Xq V+p9ElP1a1KzhFKRlPe5SunFHy/HaV++RPHHz8ihxgMltj5cD5q8TIwacSKGEVRjZf cARg5XJjpS8dQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 07/15] kbuild: build all prerequisite of headers_install simultaneously Date: Tue, 4 Jun 2019 19:14:01 +0900 Message-Id: <20190604101409.2078-8-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, scripts/unifdef is compiled after scripts_basic, uapi-asm-generic, archheaders, and archscripts. The proper dependency is just scripts_basic. There is no problem to compile scripts/unifdef and other headers at the same time. Split scripts_unifdef out in order to allow more parallel building. Signed-off-by: Masahiro Yamada --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e998c40c94b4..f9c206eb3583 100644 --- a/Makefile +++ b/Makefile @@ -1181,8 +1181,7 @@ export INSTALL_HDR_PATH = $(objtree)/usr PHONY += archheaders archscripts PHONY += __headers -__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts - $(Q)$(MAKE) $(build)=scripts scripts/unifdef +__headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts PHONY += headers_install headers_install: __headers @@ -1204,6 +1203,10 @@ ifdef CONFIG_HEADERS_CHECK all: headers_check endif +PHONY += scripts_unifdef +scripts_unifdef: scripts_basic + $(Q)$(MAKE) $(build)=scripts scripts/unifdef + # --------------------------------------------------------------------------- # Kernel selftest From patchwork Tue Jun 4 10:14:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A3E813AD for ; Tue, 4 Jun 2019 10:15:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4904F281DB for ; Tue, 4 Jun 2019 10:15:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CDFC287E5; Tue, 4 Jun 2019 10:15:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5D1281DB for ; Tue, 4 Jun 2019 10:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727107AbfFDKPp (ORCPT ); Tue, 4 Jun 2019 06:15:45 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39357 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727336AbfFDKPo (ORCPT ); Tue, 4 Jun 2019 06:15:44 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7E032511; Tue, 4 Jun 2019 19:14:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7E032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643262; bh=1qYLsdaaOh9lptJBCcPQlsjlAs8CxWYpA4nc6lxZdy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WP+kL1o6KLR6eFETe6PdkdPiV8pb5yhoTnWyaXk0PG71b5hzFI/EJF8zRif191GPG YnvOUXoxeVtCG9lJtDG75C7S7UWPU0lA799/Qrp2oXCaXsXxE5KeK3/0Ge2gnWgnjL nFFscaV4e3hh79nk7MaOpF7MW5LbeSmRghBEvE/ByZNcgasshq4gY3B5/z3VQTfsW5 7oYMOf3cEpnjidMf2MMoIywJMzFVjEacDXtq+lJren65TP+CydBcUlMy5zY4G7slgU xWkVcNaXEotke21XuCGzhwp//cssCgyH8X8z1BwELwsKzOnVwjE2bczSkm0Rrc39Q5 OHMx6t5Rs+LDQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 08/15] kbuild: add 'headers' target to build up ready-to-install uapi headers Date: Tue, 4 Jun 2019 19:14:02 +0900 Message-Id: <20190604101409.2078-9-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In Linux build system, build targets and installation targets are separated. Examples are: - 'make vmlinux' -> 'make install' - 'make modules' -> 'make modules_install' - 'make dtbs' -> 'make dtbs_install' - 'make vdso' -> 'make vdso_install' The intention is to run the build targets under the normal privilege, then the installation targets under the root privilege since we need the write permission to the system directories. We have 'make headers_install" but the corresponding 'make headers' stage does not exist. The purpose of headers_install is to provide the kernel interface to C library. So, nobody would try to install headers to /usr/include directly. If 'sudo make INSTALL_HDR_PATH=/usr/include headers_install' were run, some build artifacts in the kernel tree would be owned by root because some of uapi headers are generated by 'uapi-asm-generic', 'archheaders' targets. Anyway, I believe it makes sense to split the header installation into two stages. [1] 'make headers' Process headers in uapi directories by scripts/headers_install.sh and copy them to usr/include [2] 'make headers_install' Copy '*.h' verbatim from usr/include to $(INSTALL_HDR_PATH)/include For the backward compatibility, 'headers_install' depends on 'headers'. Some samples expect uapi headers in usr/include. So, the 'headers' target is useful to build up them in the fixed location usr/include irrespective of INSTALL_HDR_PATH. Another benefit is to stop polluting the final destination with the time-stamp files '.install' and '.check'. Maybe you can see them in your toolchains. Lastly, my main motivation is to prepare for compile-testing uapi headers. To build something, we have to creating an object and .*.cmd somewhere. The usr/include/ will be the work directory for that. Signed-off-by: Masahiro Yamada --- Makefile | 23 +++++++++++++++-------- lib/Kconfig.debug | 4 +--- scripts/Makefile.headersinst | 8 ++++---- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index f9c206eb3583..3c172dd516ff 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ old_version_h := include/linux/version.h clean-targets := %clean mrproper cleandocs no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ - $(version_h) headers_% archheaders archscripts \ + $(version_h) headers headers_% archheaders archscripts \ %asm-generic kernelversion %src-pkg no-sync-config-targets := $(no-dot-config-targets) install %install \ kernelrelease @@ -1178,25 +1178,32 @@ headerdep: #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -PHONY += archheaders archscripts - -PHONY += __headers -__headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts +quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include + cmd_headers_install = \ + mkdir -p $(INSTALL_HDR_PATH); \ + rsync -mrl --include='*/' --include='*\.h' --exclude='*' \ + usr/include $(INSTALL_HDR_PATH) PHONY += headers_install -headers_install: __headers +headers_install: headers + $(call cmd,headers_install) + +PHONY += archheaders archscripts + +PHONY += headers +headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include PHONY += headers_check -headers_check: headers_install +headers_check: headers $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include HDRCHECK=1 ifdef CONFIG_HEADERS_INSTALL -prepare: headers_install +prepare: headers endif ifdef CONFIG_HEADERS_CHECK diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6a6ea4219d1e..0031a31d98c2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -324,9 +324,7 @@ config HEADERS_CHECK attempt to include files which were not exported, etc. If you're making modifications to header files which are - relevant for userspace, say 'Y', and check the headers - exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in - your build tree), to make sure they're suitable. + relevant for userspace, say 'Y'. config OPTIMIZE_INLINING bool "Allow compiler to uninline functions marked 'inline'" diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 3d1ebaabd1b6..1af6d0b06585 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -41,7 +41,7 @@ ifeq ($(skip-inst),) kbuild-file := $(srctree)/$(obj)/Kbuild -include $(kbuild-file) -installdir := $(INSTALL_HDR_PATH)/$(dst) +installdir := usr/$(dst) gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) header-files := $(notdir $(wildcard $(srcdir)/*.h)) header-files := $(filter-out $(no-export-headers), $(header-files)) @@ -60,10 +60,10 @@ output-files := $(addprefix $(installdir)/, $(all-files)) oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders)) -# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) +# Prefix unwanted with full paths to objtree unwanted-file := $(addprefix $(installdir)/, $(unwanted)) -printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) +printdir = $(patsubst %/,%,$(dir $@)) quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ file$(if $(word 2, $(all-files)),s)) @@ -81,7 +81,7 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) cmd_check = for f in $(all-files); do \ echo "$(installdir)/$${f}"; done \ | xargs \ - $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \ + $(PERL) $< usr/include $(SRCARCH); \ touch $@ ifndef HDRCHECK From patchwork Tue Jun 4 10:14:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8442513AD for ; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74636281DB for ; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65A0F287E6; Tue, 4 Jun 2019 10:16:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8223E281DB for ; Tue, 4 Jun 2019 10:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727452AbfFDKQD (ORCPT ); Tue, 4 Jun 2019 06:16:03 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39599 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbfFDKPw (ORCPT ); Tue, 4 Jun 2019 06:15:52 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7F032511; Tue, 4 Jun 2019 19:14:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7F032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643262; bh=a2r32HBmfOPNhRHR6NEw2nxMZDcJlmjbZJmpiqemrdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QdVNDT7nNkg19+Wlfu/K+AI0Yx1lbQ5iZqx1EHQH9hhnpPYpyNa0thqDI9gC9lpOq dQfvsxeZM1ek9Gx2oA+FOAPwvMdu3RaM6Yrndu6jjuaaHxYFb9YOT1TzP2wpTixDkI j4NQHwarh3frbWvnQnze1UHuAngkxC/x5W31OxJhoMPaLiV5YUEjH/EEh/gSBFmHqQ gubwXc2sYP4EytQTMgQ+OtENpBNetfhNJzrYvXxyD8I0n2clhgtoym8n+U2iy18R9n m1nvMFbzERoKuPAeTdDKpCbAE3c+hHMJ8Ir25WfjtUq5aN4Pd48GsCTvAWueXfcUnc 1s+tEih4LeIsQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 09/15] kbuild: re-implement Makefile.headersinst without directory descending Date: Tue, 4 Jun 2019 19:14:03 +0900 Message-Id: <20190604101409.2078-10-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit fcc8487d477a ("uapi: export all headers under uapi directories"), the headers in uapi directories are all exported by default although exceptional cases are still allowed by the syntax 'no-export-headers'. The traditional directory descending has been still kept (in a somewhat hacky way), but it is no longer needed. Get rid of it to simplify the code. Also, handle files one by one instead of the previous per-directory processing. This will emit much more log, but I like it. Signed-off-by: Masahiro Yamada --- Makefile | 8 +- include/uapi/{linux => }/Kbuild | 6 +- scripts/Makefile.headersinst | 132 +++++++++++++------------------- 3 files changed, 62 insertions(+), 84 deletions(-) rename include/uapi/{linux => }/Kbuild (77%) diff --git a/Makefile b/Makefile index 3c172dd516ff..608af32cc758 100644 --- a/Makefile +++ b/Makefile @@ -1194,13 +1194,13 @@ PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) - $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include + $(Q)$(MAKE) $(hdr-inst)=include/uapi + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi PHONY += headers_check headers_check: headers - $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi dst=include HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1 ifdef CONFIG_HEADERS_INSTALL prepare: headers diff --git a/include/uapi/linux/Kbuild b/include/uapi/Kbuild similarity index 77% rename from include/uapi/linux/Kbuild rename to include/uapi/Kbuild index 34711c5d6968..61ee6e59c930 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/Kbuild @@ -1,14 +1,14 @@ # SPDX-License-Identifier: GPL-2.0 ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),) -no-export-headers += a.out.h +no-export-headers += linux/a.out.h endif ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),) -no-export-headers += kvm.h +no-export-headers += linux/kvm.h endif ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),) ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.h),) -no-export-headers += kvm_para.h +no-export-headers += linux/kvm_para.h endif endif diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 1af6d0b06585..c96c4c26e240 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -14,109 +14,87 @@ __headers: include scripts/Kbuild.include -srcdir := $(srctree)/$(obj) +src := $(srctree)/$(obj) +gen := $(objtree)/$(subst include/,include/generated/,$(obj)) +dst := usr/include -# When make is run under a fakechroot environment, the function -# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular -# files. So, we are using a combination of sort/dir/wildcard which works -# with fakechroot. -subdirs := $(patsubst $(srcdir)/%/,%,\ - $(filter-out $(srcdir)/,\ - $(sort $(dir $(wildcard $(srcdir)/*/))))) +-include $(src)/Kbuild -# Recursion -__headers: $(subdirs) +src-subdirs := $(patsubst $(src)/%/,%,$(wildcard $(src)/*/)) +gen-subdirs := $(patsubst $(gen)/%/,%,$(wildcard $(gen)/*/)) +all-subdirs := $(sort $(src-subdirs) $(gen-subdirs)) -PHONY += $(subdirs) -$(subdirs): - $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ +src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h')) +src-headers := $(filter-out $(no-export-headers), $(src-headers)) +gen-headers := $(if $(gen-subdirs), $(shell cd $(gen) && find $(gen-subdirs) -name '*.h')) +gen-headers := $(filter-out $(no-export-headers), $(gen-headers)) -# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi. -# We have only sub-directories there. -skip-inst := $(if $(filter %/uapi,$(obj)),1) +# If the same header is exported from source and generated directories, +# the former takes precedence, but this should be warned. +duplicated := $(filter $(gen-headers), $(src-headers)) +$(if $(duplicated), $(warning duplicated header export: $(duplicated))) -ifeq ($(skip-inst),) +gen-headers := $(filter-out $(duplicated), $(gen-headers)) -# Kbuild file is optional -kbuild-file := $(srctree)/$(obj)/Kbuild --include $(kbuild-file) +# Add dst path prefix +all-subdirs := $(addprefix $(dst)/, $(all-subdirs)) +src-headers := $(addprefix $(dst)/, $(src-headers)) +gen-headers := $(addprefix $(dst)/, $(gen-headers)) +all-headers := $(src-headers) $(gen-headers) -installdir := usr/$(dst) -gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) -header-files := $(notdir $(wildcard $(srcdir)/*.h)) -header-files := $(filter-out $(no-export-headers), $(header-files)) -genhdr-files := $(notdir $(wildcard $(gendir)/*.h)) -genhdr-files := $(filter-out $(header-files), $(genhdr-files)) +# Work out what needs to be removed +old-subdirs := $(wildcard $(all-subdirs)) +old-headers := $(if $(old-subdirs),$(shell find $(old-subdirs) -name '*.h')) +unwanted := $(filter-out $(all-headers), $(old-headers)) -# files used to track state of install/check -install-file := $(installdir)/.install -check-file := $(installdir)/.check +# Create directories +existing-dirs := $(sort $(dir $(old-headers))) +wanted-dirs := $(sort $(dir $(all-headers))) +new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs)) +$(if $(new-dirs), $(shell mkdir -p $(new-dirs))) -# all headers files for this dir -all-files := $(header-files) $(genhdr-files) -output-files := $(addprefix $(installdir)/, $(all-files)) +# Rules -# Work out what needs to be removed -oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) -unwanted := $(filter-out $(all-files),$(oldheaders)) +ifndef HDRCHECK -# Prefix unwanted with full paths to objtree -unwanted-file := $(addprefix $(installdir)/, $(unwanted)) +quiet_cmd_install = HDRINST $@ + cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $(@D) $( X-Patchwork-Id: 10974665 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9AF61398 for ; Tue, 4 Jun 2019 10:16:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A549F281DB for ; Tue, 4 Jun 2019 10:16:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 967B9287E5; Tue, 4 Jun 2019 10:16:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434A8281DB for ; Tue, 4 Jun 2019 10:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727114AbfFDKQV (ORCPT ); Tue, 4 Jun 2019 06:16:21 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39165 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfFDKPi (ORCPT ); Tue, 4 Jun 2019 06:15:38 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7G032511; Tue, 4 Jun 2019 19:14:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7G032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643263; bh=VGjPFxsP6kBrwBDYVWYAlv4U8kztKdxrIjkfmrPtJXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mPNAsiSfLq57iHEV9xRwWBflUZfrT8ykBp+GDWZIAjQVsJRkpidrYn5NkG9tdx0QX Z4wnRAsDdssWbfEuF/grcOod8QKRBuz5qp1MRl7V8lCPEHVjH0BEs56PXqBZutxt5e 66MwUD6gQ2OAu5/QtgktevdXDj9X4ST08oq01DRS3BK5Uqyv01nWs5TZQZJyahCJQb 0S0lRIy9WXxWAiPFrpoLLjQYe4L5LJOnXmbdbrwESnQQLXqqCx7keYmlD/Hx9UCqoL 2S3L71IWhirlHqf21BD7bSeBFGx/i+0MNV5ytyZJkEEdhnVzQW4tJQ2TG34DraNtat m8IRGhxixPBmQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 10/15] kbuild: move hdr-inst shorthand to top Makefile Date: Tue, 4 Jun 2019 19:14:04 +0900 Message-Id: <20190604101409.2078-11-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that hdr-inst is used only in the top Makefile, move it there from scripts/Kbuild.include. Signed-off-by: Masahiro Yamada --- Makefile | 2 ++ scripts/Kbuild.include | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 608af32cc758..48bac02fb72d 100644 --- a/Makefile +++ b/Makefile @@ -1190,6 +1190,8 @@ headers_install: headers PHONY += archheaders archscripts +hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj + PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index f12e81eeb89b..9ae4493d5bcd 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -180,12 +180,6 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj # $(Q)$(MAKE) $(clean)=dir clean := -f $(srctree)/scripts/Makefile.clean obj -### -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj= -# Usage: -# $(Q)$(MAKE) $(hdr-inst)=dir -hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj - # echo command. # Short version is used, if $(quiet) equals `quiet_', otherwise full one. echo-cmd = $(if $($(quiet)cmd_$(1)),\ From patchwork Tue Jun 4 10:14:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1B0B13AD for ; Tue, 4 Jun 2019 10:16:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C068A281DB for ; Tue, 4 Jun 2019 10:16:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B44B2287E5; Tue, 4 Jun 2019 10:16:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488B0287D2 for ; Tue, 4 Jun 2019 10:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727312AbfFDKPk (ORCPT ); Tue, 4 Jun 2019 06:15:40 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39195 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbfFDKPk (ORCPT ); Tue, 4 Jun 2019 06:15:40 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7H032511; Tue, 4 Jun 2019 19:14:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7H032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643264; bh=ZW8oJHHCyujAucqOHf5owysxupf7VvOq0sufCbzCWAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbpYgPT74iM32GjIo997UUOMQ9vWoTSw0PoW8PZguSq4D/k4Va2cIhN41x4E1gqUs TyHDXxYIBw3dMAdm680pEiOiWDdi6V3+qS1+xCwR+mYrtpQrppDU92JOzHssuABdV0 8mI/ysv69ZyRQoCZtdqeDFvHMnBRtjSyz0CEj9KWEc8CFZZsiCK2IaIF0WcZ9m1BYs Gfn2gx5QOX8qnqhtGKPXgyJ0Em7H+AT95vylOg8HAVkgjXLsWsUcFTi/1GHlvJbMEb sygylFj+vTiTtZQCbfEOTVMKaf73xjlVnE2MPUQc7Ya5gm+lnZpVvPPXR2OsvZBYaj ittJ4YlSEshHw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 11/15] kbuild: simplify scripts/headers_install.sh Date: Tue, 4 Jun 2019 19:14:05 +0900 Message-Id: <20190604101409.2078-12-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that headers_install.sh is invoked per file, remove the for-loop in the shell script. Signed-off-by: Masahiro Yamada --- scripts/Makefile.headersinst | 2 +- scripts/headers_install.sh | 48 +++++++++++++++--------------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index c96c4c26e240..d2b572a7a628 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -58,7 +58,7 @@ $(if $(new-dirs), $(shell mkdir -p $(new-dirs))) ifndef HDRCHECK quiet_cmd_install = HDRINST $@ - cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $(@D) $(@@ + s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g + s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g + s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @ +' $INFILE > $TMPFILE || exit 1 -FILE= -trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT -for i in "$@" -do - FILE="$(basename "$i")" - sed -E \ - -e 's/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g' \ - -e 's/__attribute_const__([[:space:]]|$)/\1/g' \ - -e 's@^#include @@' \ - -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ - -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \ - -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \ - "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 - scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ - > "$OUTDIR/$FILE" - [ $? -gt 1 ] && exit 1 - rm -f "$OUTDIR/$FILE.sed" -done +scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE +[ $? -gt 1 ] && exit 1 + +rm -f $TMPFILE trap - EXIT From patchwork Tue Jun 4 10:14:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 079F31398 for ; Tue, 4 Jun 2019 10:16:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB9CD281DB for ; Tue, 4 Jun 2019 10:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF411287E5; Tue, 4 Jun 2019 10:16:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9257B281DB for ; Tue, 4 Jun 2019 10:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbfFDKPj (ORCPT ); Tue, 4 Jun 2019 06:15:39 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39189 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfFDKPj (ORCPT ); Tue, 4 Jun 2019 06:15:39 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7I032511; Tue, 4 Jun 2019 19:14:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7I032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643265; bh=PpZBMxg4bzgoXAd/8YiPn6tt8q7c+h3C7+mX9vii/zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCSIv1QPdcRJ6xQilbXbvoLZr6xt90IOw0qoumntl15OKD2jRyvNLwoG/RvooA59G flhdZjogSeqZ2Ca9ZJnfoz2j1/9CcYv0RAgmP2e84uL+3tCg6ZcLHNgp1Rrrnm7yGd m5BKXDqli36feukDrAYpvuLIkKT012GanppJ/E833lTAY1/VKoWkxgrpeIXrLH71Ev 67Vok6y5uFUNN4S/55QLFP3OGBmYGfZ0Zikq5CN1HC4eMD+iVJGDJHYsalGxZTVGBC 0qCaxPdmkiJQIpnoZvNyXrxPCkSxJTq4WrQjMyzoZ7v6G2Dz0P6Jj9YB8DbfIJ96jz deNDGwsF1dZ+g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 12/15] kbuild: deb-pkg: do not run headers_check Date: Tue, 4 Jun 2019 19:14:06 +0900 Message-Id: <20190604101409.2078-13-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is absolutely fine to add extra sanity checks in package scripts, but it is not necessary to do so. This is already covered by the daily compile-testing (0day bot etc.) because headers_check is run as a part of the normal build process when CONFIG_HEADERS_CHECK=y. Replace it with the newly-added "make headers". Signed-off-by: Masahiro Yamada --- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index b03dd56a4782..e8ca6dc97e96 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -130,7 +130,7 @@ if is_enabled CONFIG_MODULES; then fi if [ "$ARCH" != "um" ]; then - $MAKE -f $srctree/Makefile headers_check + $MAKE -f $srctree/Makefile headers $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" fi From patchwork Tue Jun 4 10:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1F232D49 for ; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0663281DB for ; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3D0E287E6; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6D3287E5 for ; Tue, 4 Jun 2019 10:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727274AbfFDKP6 (ORCPT ); Tue, 4 Jun 2019 06:15:58 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39732 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbfFDKP6 (ORCPT ); Tue, 4 Jun 2019 06:15:58 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7J032511; Tue, 4 Jun 2019 19:14:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7J032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643266; bh=BnyOCSyE+CGMxDknrCFwRpFRPhO2lG/Y/shoIrbI5AY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z5/reEbeHi70KbQtAaW59xxuhoN5CJ6vi0zTzUweFozO6GDDLJBeAGOt0HbBxdGYs kmnBi+G4qTPRlpvorbsKGV4myGYjxSVZF9yHS55WzeKcH13aYk9/cS2UuOW+A6U6aZ /f5GshStK0NXon6uCqj3GinWBcgr25RsSNDCWQXKlTBZ97N9mxffeQvL3rd5WoLYGa izMngyoSmA5ZkdN3JvlFeOHitJlzQ4eiTJeUUasTdqPNdfAWGSchXUCFEgU0oUZFlM SZ9cV3kw61ijSECWdmpFdOLvbCYuVlhModjQaNe7WJUU+jGrifFNh4HnHvf6H1lo40 4S3RsAwPlADag== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Chris Wilson , Masahiro Yamada , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH 13/15] kbuild: add support for ensuring headers are self-contained Date: Tue, 4 Jun 2019 19:14:07 +0900 Message-Id: <20190604101409.2078-14-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jani Nikula Sometimes it's useful to be able to explicitly ensure certain headers remain self-contained, i.e. that they are compilable as standalone units, by including and/or forward declaring everything they depend on. Add special target header-test-y where individual Makefiles can add headers to be tested if CONFIG_HEADER_TEST is enabled. This will generate a dummy C file per header that gets built as part of extra-y. Cc: Chris Wilson Cc: Masahiro Yamada Cc: Michal Marek Signed-off-by: Jani Nikula Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 7 +++++++ init/Kconfig | 9 +++++++++ scripts/Makefile.build | 10 ++++++++++ scripts/Makefile.lib | 3 +++ 4 files changed, 29 insertions(+) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index bac301a73a86..ca4b24ec0399 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -1018,6 +1018,13 @@ When kbuild executes, the following steps are followed (roughly): In this example, extra-y is used to list object files that shall be built, but shall not be linked as part of built-in.a. + header-test-y + + header-test-y specifies headers (*.h) in the current directory that + should be compile tested to ensure they are self-contained, + i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled, + this autogenerates dummy sources to include the headers, and builds them + as part of extra-y. --- 6.7 Commands useful for building a boot image diff --git a/init/Kconfig b/init/Kconfig index 36894c9fb420..02d8897b91fb 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -96,6 +96,15 @@ config COMPILE_TEST here. If you are a user/distributor, say N here to exclude useless drivers to be distributed. +config HEADER_TEST + bool "Compile test headers that should be standalone compilable" + help + Compile test headers listed in header-test-y target to ensure they are + self-contained, i.e. compilable as standalone units. + + If you are a developer or tester and want to ensure the requested + headers are self-contained, say Y here. Otherwise, choose N. + config LOCALVERSION string "Local version - append to kernel release" help diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ae9cf740633e..2b4d56483c2e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -294,6 +294,16 @@ quiet_cmd_cc_lst_c = MKLST $@ $(obj)/%.lst: $(src)/%.c FORCE $(call if_changed_dep,cc_lst_c) +# Dummy C sources for header test (header-test-y target) +# --------------------------------------------------------------------------- + +quiet_cmd_header_test = HDRTEST $@ + cmd_header_test = echo "\#include \"$( $@ + +# FIXME: would be nice to be able to limit this implicit rule to header-test-y +$(obj)/%.header_test.c: $(src)/%.h FORCE + $(call if_changed,header_test) + # Compile assembler sources (.S) # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f1f38c8cdc74..60a739a22b9c 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -66,6 +66,9 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) endif +# Test self-contained headers +extra-$(CONFIG_HEADER_TEST) += $(patsubst %.h,%.header_test.o,$(header-test-y)) + # Add subdir path extra-y := $(addprefix $(obj)/,$(extra-y)) From patchwork Tue Jun 4 10:14:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A79E61398 for ; Tue, 4 Jun 2019 10:16:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95EC7287D2 for ; Tue, 4 Jun 2019 10:16:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A3C3287E6; Tue, 4 Jun 2019 10:16:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3500B287D2 for ; Tue, 4 Jun 2019 10:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727200AbfFDKPi (ORCPT ); Tue, 4 Jun 2019 06:15:38 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39190 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfFDKPi (ORCPT ); Tue, 4 Jun 2019 06:15:38 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7K032511; Tue, 4 Jun 2019 19:14:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7K032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643267; bh=LSUJNxijHUvxY1rUpeDqChsQP6kLQbdVLxrgaFhk53Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAwtFKf2wIw6tMpPoEnHS5RkStUORb0Z3gAA8ZbTb+V88FeU8cv88xStQPNue6h+/ OKqB2KOIaWtFJVVwM+XH+1poPrmHPvEhSSVL64aR0FEAjqIpEIUi5s9yjsXrWEpGnj qO4KjeafCKeZLvlmM6qJBYUQL9bS5ht8nC02ZrPT/RQ8mPP1BVc06RHEGwfVI+ue4j rxsvZeYr0BaXPIlbGxKWpskliA+8MCD5xBXj61OAqPIgTPJ6f5QyvjzBv93/ZNdwyH 7QFsTlFeo0uhbM3zg/0x+64Qoqfphszli/KbT9BhjKBnjg7HLh6ihcNcanikBMUTAC 6J7CTEB97kYPQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 14/15] fixup: kbuild: add support for ensuring headers are self-contained Date: Tue, 4 Jun 2019 19:14:08 +0900 Message-Id: <20190604101409.2078-15-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is needed to avoid regeneration of header-test C files. This will go away when Jani send v2. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 2b4d56483c2e..067e98628664 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -298,10 +298,9 @@ $(obj)/%.lst: $(src)/%.c FORCE # --------------------------------------------------------------------------- quiet_cmd_header_test = HDRTEST $@ - cmd_header_test = echo "\#include \"$( $@ + cmd_header_test = echo "\#include \"$*.h\"" > $@ -# FIXME: would be nice to be able to limit this implicit rule to header-test-y -$(obj)/%.header_test.c: $(src)/%.h FORCE +$(obj)/%.header_test.c: $(call if_changed,header_test) # Compile assembler sources (.S) From patchwork Tue Jun 4 10:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10974669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7D481398 for ; Tue, 4 Jun 2019 10:17:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9311C281DB for ; Tue, 4 Jun 2019 10:17:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 802B2287E5; Tue, 4 Jun 2019 10:17:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92185281DB for ; Tue, 4 Jun 2019 10:17:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727091AbfFDKQ5 (ORCPT ); Tue, 4 Jun 2019 06:16:57 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:41277 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfFDKQ5 (ORCPT ); Tue, 4 Jun 2019 06:16:57 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x54AEC7L032511; Tue, 4 Jun 2019 19:14:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x54AEC7L032511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1559643268; bh=89f4NG7T3lIJUXbh+crgcBM9ot/TW/l/GBiNZdH3IcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7YyTeOIkyiLbhjHLtqXLb1VWv2GjQYy5cTgkr8C8U/cyucPCS5tXvbLRRzUzJ6TE ziZe0sTaCI7+AxfD4MJh54gQr0L1AJ9WvpLuV36i+x53I9JXcPBPn6xdvR2dHK9sML qN05UgT7qHP1pTja6UhXNVyhMW7EtydbRoefYU98Pxmufa5LHg6DmGwKMpHVw/LZeo NqkT9Opk4Tm0y8mmDzNavtG4fIOGm8Jcj2d55/G7CYHnGI/2KymFZgUTQCOWVome3q +O5FFmRsXenLxnlozqVJcD5GQPFx2xNzow+Ov8ya3wThpyW5MD5etP34fHH+iOnJbP iI8KUO3jj3lDg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Randy Dunlap , Arnd Bergmann , David Howells , Sam Ravnborg , Jani Nikula , Masahiro Yamada , Song Liu , Alexei Starovoitov , netdev@vger.kernel.org, Yonghong Song , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Michal Marek , Martin KaFai Lau , Palmer Dabbelt , bpf@vger.kernel.org, Daniel Borkmann , Albert Ou Subject: [PATCH 15/15] kbuild: compile test UAPI headers to ensure they are self-contained Date: Tue, 4 Jun 2019 19:14:09 +0900 Message-Id: <20190604101409.2078-16-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604101409.2078-1-yamada.masahiro@socionext.com> References: <20190604101409.2078-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Multiple people have suggested compile-testing UAPI headers to ensure they can be really included from user-space. "make headers_check" is obviously not enough to catch bugs, and we often leak references to kernel-space definition to user-space. The most recent patch I know is David Howells' work: https://patchwork.kernel.org/patch/10590203/ While I agree that we should do this, we must consider how it can be integrated cleanly. That is why it has not been supported in the mainline yet. The idea that has been in my mind is to compile every UAPI header so that it can be included without relying on any include order. Please note usr/include/ is built with a completely different set of compiler flags. The header search path is set to $(objtree)/usr/include since UAPI headers should not include unexported headers. We use -std=gnu89 for the kernel space since the kernel code highly depends on GNU extensions. On the other hand, UAPI headers should be written in somewhat strict C, so they are compiled with -std=c89. This will catch C++ style comments, the keyword 'inline', etc. ('__inline__' should be used instead). There is additional compiler requirement for building under usr/include. because many of UAPI headers include , , , etc. directly or indirectly. You can use kernel.org prebuilt toolchains for building the kernel (https://mirrors.edge.kernel.org/pub/tools/crosstool/index.html) but they do not provide etc. If you want to compile test UAPI headers, you need to use full-featured compilers, which are usually provided by distributions. I added scripts/cc-system-headers.sh to check if necessary system headers are available, which CONFIG_UAPI_HEADER_TEST depends on. For now, a lot of headers need to be excluded because they cannot be compiled standalone, but this is a good start point. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- init/Kconfig | 11 +++ scripts/cc-system-headers.sh | 8 +++ usr/.gitignore | 1 - usr/Makefile | 2 + usr/include/.gitignore | 3 + usr/include/Makefile | 132 +++++++++++++++++++++++++++++++++++ 7 files changed, 157 insertions(+), 2 deletions(-) create mode 100755 scripts/cc-system-headers.sh create mode 100644 usr/include/.gitignore create mode 100644 usr/include/Makefile diff --git a/Makefile b/Makefile index 48bac02fb72d..0d54b073c415 100644 --- a/Makefile +++ b/Makefile @@ -1363,7 +1363,7 @@ CLEAN_DIRS += $(MODVERDIR) include/ksym CLEAN_FILES += modules.builtin.modinfo # Directories & files removed with 'make mrproper' -MRPROPER_DIRS += include/config usr/include include/generated \ +MRPROPER_DIRS += include/config include/generated \ arch/$(SRCARCH)/include/generated .tmp_objdiff MRPROPER_FILES += .config .config.old .version \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ diff --git a/init/Kconfig b/init/Kconfig index 02d8897b91fb..9a26f0e7e3fb 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -105,6 +105,17 @@ config HEADER_TEST If you are a developer or tester and want to ensure the requested headers are self-contained, say Y here. Otherwise, choose N. +config UAPI_HEADER_TEST + bool "Compile test UAPI headers" + depends on HEADER_TEST && HEADERS_INSTALL + depends on $(success,$(srctree)/scripts/cc-system-headers.sh $(CC)) + help + Compile test headers exported to user-space to ensure they are + self-contained, i.e. compilable as standalone units. + + If you are a developer or tester and want to ensure the UAPI + headers are self-contained, say Y here. Otherwise, choose N. + config LOCALVERSION string "Local version - append to kernel release" help diff --git a/scripts/cc-system-headers.sh b/scripts/cc-system-headers.sh new file mode 100755 index 000000000000..1b3db369828c --- /dev/null +++ b/scripts/cc-system-headers.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +cat << "END" | $@ -E -x c - -o /dev/null >/dev/null 2>&1 +#include +#include +#include +END diff --git a/usr/.gitignore b/usr/.gitignore index 8e48117a3f3d..be5eae1df7eb 100644 --- a/usr/.gitignore +++ b/usr/.gitignore @@ -7,4 +7,3 @@ initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_list -include diff --git a/usr/Makefile b/usr/Makefile index 4a70ae43c9cb..6a89eb019275 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -56,3 +56,5 @@ $(deps_initramfs): klibcdirs $(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y) $(call if_changed,initfs) + +subdir-$(CONFIG_UAPI_HEADER_TEST) += include diff --git a/usr/include/.gitignore b/usr/include/.gitignore new file mode 100644 index 000000000000..a0991ff4402b --- /dev/null +++ b/usr/include/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!Makefile diff --git a/usr/include/Makefile b/usr/include/Makefile new file mode 100644 index 000000000000..8cba20ba4edb --- /dev/null +++ b/usr/include/Makefile @@ -0,0 +1,132 @@ +# SPDX-License-Identifier: GPL-2.0-only + +# Unlike the kernel space, uapi headers are written in more strict C. +# - Forbid C++ style comments +# - Use '__inline', '__asm__' instead of 'inline', 'asm' +# +# -std=c90 (equivalent to -ansi) catches the violation of those. +# We cannot go as far as adding -Wpedantic since it emits too many warnings. +# +# REVISIT: re-consider the proper set of compiler flags for uapi compile-test. + +UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration + +override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include + +# We want to compile as many headers as possible. We collect all headers +# by using the wildcard, then filter-out some later. +all-uapi-headers = $(shell cd $(obj) && find * -name '*.h') + +# asm-generic/*.h is used by asm/*.h, and should not be included directly +no-header-test += asm-generic/%.h + +# The following are excluded for now just because they fail to build. +# The cause of errors are mostly missing include directives. +# Check one by one, and send a patch to each subsystem. +# +# Do not add a new header to the list without legitimate reason. +# Please consider to fix the header first. +no-header-test += asm/ipcbuf.h +no-header-test += asm/msgbuf.h +no-header-test += asm/sembuf.h +no-header-test += asm/shmbuf.h +no-header-test += asm/signal.h +no-header-test += asm/ucontext.h +no-header-test += drm/vmwgfx_drm.h +no-header-test += linux/am437x-vpfe.h +no-header-test += linux/android/binderfs.h +no-header-test += linux/android/binder.h +no-header-test += linux/coda.h +no-header-test += linux/coda_psdev.h +no-header-test += linux/dvb/audio.h +no-header-test += linux/dvb/osd.h +no-header-test += linux/elfcore.h +no-header-test += linux/errqueue.h +no-header-test += linux/fsmap.h +no-header-test += linux/hdlc/ioctl.h +no-header-test += linux/jffs2.h +no-header-test += linux/kexec.h +no-header-test += linux/matroxfb.h +no-header-test += linux/netfilter_bridge/ebtables.h +no-header-test += linux/netfilter_ipv4/ipt_LOG.h +no-header-test += linux/netfilter_ipv6/ip6t_LOG.h +no-header-test += linux/nfc.h +no-header-test += linux/nilfs2_ondisk.h +no-header-test += linux/omap3isp.h +no-header-test += linux/omapfb.h +no-header-test += linux/patchkey.h +no-header-test += linux/phonet.h +no-header-test += linux/reiserfs_xattr.h +no-header-test += linux/scc.h +no-header-test += linux/sctp.h +no-header-test += linux/signal.h +no-header-test += linux/sysctl.h +no-header-test += linux/usb/audio.h +no-header-test += linux/ivtv.h +no-header-test += linux/v4l2-mediabus.h +no-header-test += linux/v4l2-subdev.h +no-header-test += linux/videodev2.h +no-header-test += linux/vm_sockets.h +no-header-test += misc/ocxl.h +no-header-test += scsi/scsi_bsg_fc.h +no-header-test += scsi/scsi_netlink_fc.h +no-header-test += scsi/scsi_netlink.h +no-header-test += sound/asequencer.h +no-header-test += sound/asound.h +no-header-test += sound/asoc.h +no-header-test += sound/compress_offload.h +no-header-test += sound/emu10k1.h +no-header-test += sound/sfnt_info.h +no-header-test += sound/sof/eq.h +no-header-test += sound/sof/fw.h +no-header-test += sound/sof/header.h +no-header-test += sound/sof/manifest.h +no-header-test += sound/sof/trace.h +no-header-test += xen/evtchn.h +no-header-test += xen/gntdev.h +no-header-test += xen/privcmd.h + +# more headers are broken in some architectures + +ifeq ($(SRCARCH),arc) +no-header-test += linux/bpf_perf_event.h +endif + +ifeq ($(SRCARCH),ia64) +no-header-test += asm/setup.h +no-header-test += asm/sigcontext.h +no-header-test += asm/perfmon.h +no-header-test += asm/perfmon_default_smpl.h +no-header-test += linux/if_bonding.h +endif + +ifeq ($(SRCARCH),mips) +no-header-test += asm/stat.h +endif + +ifeq ($(SRCARCH),powerpc) +no-header-test += asm/stat.h +no-header-test += linux/bpf_perf_event.h +endif + +ifeq ($(SRCARCH),riscv) +no-header-test += linux/bpf_perf_event.h +endif + +ifeq ($(SRCARCH),s390) +no-header-test += asm/runtime_instr.h +no-header-test += asm/zcrypt.h +endif + +ifeq ($(SRCARCH),sparc) +no-header-test += asm/stat.h +no-header-test += asm/uctx.h +no-header-test += asm/fbio.h +no-header-test += asm/openpromio.h +endif + +# Use '=' instead of ':=' to avoid $(shell ...) evaluation when cleaning +header-test-y = $(filter-out $(no-header-test), $(all-uapi-headers)) + +# Use '=' instead of ':=' to avoid $(shell ...) evaluation when building +clean-dirs = $(shell cd $(obj) 2>/dev/null && find * -maxdepth 0 -type d)