From patchwork Wed Jan 11 18:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 13097084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC173C5479D for ; Wed, 11 Jan 2023 18:18:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.475696.737479 (Exim 4.92) (envelope-from ) id 1pFfgF-0004tE-KW; Wed, 11 Jan 2023 18:18:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 475696.737479; Wed, 11 Jan 2023 18:18:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFfgF-0004t7-He; Wed, 11 Jan 2023 18:18:31 +0000 Received: by outflank-mailman (input) for mailman id 475696; Wed, 11 Jan 2023 18:18:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFfgD-0004t1-Og for xen-devel@lists.xenproject.org; Wed, 11 Jan 2023 18:18:29 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 56dafc82-91dc-11ed-91b6-6bf2151ebd3b; Wed, 11 Jan 2023 19:18:27 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 56dafc82-91dc-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1673461107; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8eWpl94CgVNDdkjjqPyLI3KBUVFTsyRmT98TKI665ck=; b=dsVsbTdsBg8z+f+jFXNZP3vNjqLkMPhb44ZHkLvG7RY29bzET60YdtSP iBQNCEVnD/coboH4592N9XjavAHrXLhNQvXGVd/+2s0S/lyVi5rY0c/pC 50P5tZBpceim0o9ErPBKj5NRp8VaHPvQg+RUEt66/fW3+KB65l1xWyd0X E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 92218242 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:5lxhZarKMUvrhYru9AfC5ob7/8heBmIZZRIvgKrLsJaIsI4StFCzt garIBnSOPbfZWKnLox3ao3g8EtV65TVnNU3HVE5+y40EHgb8puZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5weHziBNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXACoDVRSu2tK9+bLla81lo8JzNvW2FoxK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSZBFHU/rSn8/x7pX7WzRetFKSo7tx+2XJxRZ9+LPsLMDUapqBQsA9ckOw9 zicpjSjXkty2Nq34g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JQt5UW+AdQHI0bFCz35Yg7GK 02Zfusksp+YBefdTTUr2NvyNujUjA6GQqHWFELvoiQ3yJNlH50wkMEzIgUn2sG9pg6V55Yjt 60RZhAhfVLVIsbfKh9DOAOTY++DXHMWwvFNCaILVHuBMg8SgHwQl7MkcUIDc2RCe01JcEJ6e v8uXtjxBAPR34= X-IronPort-AV: E=Sophos;i="5.96,317,1665460800"; d="scan'208";a="92218242" From: Anthony PERARD To: CC: Jan Beulich , Andrew Cooper , Anthony PERARD Subject: [RFC PATCH] build: include/compat: figure out which other compat headers are needed Date: Wed, 11 Jan 2023 18:17:03 +0000 Message-ID: <20230111181703.30991-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Some compat headers depends on other compat headers that may not have been generated due to config option. This would be a generic way to deal with deps, instead of headers-$(call or $(CONFIG_TRACEBUFFER),$(CONFIG_HVM)) += compat/trace.h This is just an RFC, as it only deals with "hvm_op.h" and nothing is done to have make regenerate the new file when needed. Signed-off-by: Anthony PERARD --- xen/include/Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xen/include/Makefile b/xen/include/Makefile index 65be310eca..5e6de97841 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -34,6 +34,29 @@ headers-$(CONFIG_TRACEBUFFER) += compat/trace.h headers-$(CONFIG_XENOPROF) += compat/xenoprof.h headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h +# Find dependencies of compat headers. +# e.g. hvm/hvm_op.h needs trace.h; but if CONFIG_TRACEBUFFER=n, then trace.h would be missing. +# +# Using sed to remove ".." from path because unsure if something else is available +# There's `realpath`, but maynot be available +# realpath --relative-to=. -mL compat/hvm/../trace.h -> compat/trace.h +# `make` also have macro for that $(abspath), only recent version. +# +# The $(CC) line to gen deps is derived from $(cmd_compat_i) +include $(obj)/.compat-header-deps.d +$(obj)/.compat-header-deps.d: include/public/hvm/hvm_op.h + $(CC) -MM -MF $@.tmp $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $< + for f in $$(cat $@.tmp | sed -r '1s/^[^:]*: //; s/ \\$$//'); do \ + echo $$f; \ + done | sed -r \ + -e 's#.*/public#compat#; : p; s#/[^/]+/../#/#; t p; s#$$# \\#' \ + -e '1i headers-y-deps := \\' -e '$$a \ ' \ + > $@ + +headers-y-deps := $(filter-out compat/xen-compat.h,$(headers-y-deps)) +# Add compat header dependencies and eliminates duplicates +headers-y := $(sort $(headers-y) $(headers-y-deps)) + cppflags-y := -include public/xen-compat.h -DXEN_GENERATING_COMPAT_HEADERS cppflags-$(CONFIG_X86) += -m32