From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 426B8C38142 for ; Fri, 27 Jan 2023 14:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbjA0O13 (ORCPT ); Fri, 27 Jan 2023 09:27:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232974AbjA0O11 (ORCPT ); Fri, 27 Jan 2023 09:27:27 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140E78000C; Fri, 27 Jan 2023 06:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674829633; x=1706365633; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tQHYwsHuQmv3UmxqSGxgXFuhINcA80Abo3LA82di77s=; b=Y7pVM78jO0HE/dAFn2MC+n1QPcxTlf+t0PCaJgf3dKQnetze2zawxNAu q69c0J2MEFcOOMiANVxtmQN2YSFCzI/yfSYFrFoL7gih1s6pI1UX1Lqaz ebdR9lldf4LLky8ii0uGc63YhYJQVTcR9ws1tNEIry4m1eMLhDDqwUp5h Dn9yFRdfhdeLgVSXSJmR1xO7oCDOs3QbxeZ123IW4PXfOd7qfIuuTudvF iPudNFbwLbGMIXMiu/sYVEGsJEIRIYeTvL0d017HIw/NebZuJStEhhnyK d7tN/yT832fJekgxfUe0dhJ/ea4EwWLWoVmk9sHsrPdEmlplLDFYsFgyp g==; X-IronPort-AV: E=McAfee;i="6500,9779,10603"; a="310716130" X-IronPort-AV: E=Sophos;i="5.97,251,1669104000"; d="scan'208";a="310716130" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2023 06:27:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10603"; a="731859354" X-IronPort-AV: E=Sophos;i="5.97,251,1669104000"; d="scan'208";a="731859354" Received: from skxmcp01.bj.intel.com ([10.240.193.86]) by fmsmga004.fm.intel.com with ESMTP; 27 Jan 2023 06:27:10 -0800 From: Yu Zhang To: pbonzini@redhat.com, shuah@kernel.org, seanjc@google.com, kvm@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: selftest: Add dependency rules in makefile for C source code Date: Fri, 27 Jan 2023 21:36:01 +0800 Message-Id: <20230127133601.1165472-1-yu.c.zhang@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently, KVM selftests have to run "make clean && make" to rebuild the entire test suite each time a header file is modified. Define "-MD" as an EXTRA_CFLAGS, so we can generate the dependency rules for each target object, whose prerequisites contains the source file and the included header files as well. And including those dependency files in KVM selftests' makefile will release us from such annoyance. Signed-off-by: Yu Zhang --- tools/testing/selftests/kvm/Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 1750f91dd936..b329e0d1a460 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -180,6 +180,8 @@ TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH_DIR)) TEST_GEN_PROGS_EXTENDED += $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR)) LIBKVM += $(LIBKVM_$(ARCH_DIR)) +OVERRIDE_TARGETS = 1 + # lib.mak defines $(OUTPUT), prepends $(OUTPUT)/ to $(TEST_GEN_PROGS), and most # importantly defines, i.e. overwrites, $(CC) (unless `make -e` or `make CC=`, # which causes the environment variable to override the makefile). @@ -198,9 +200,11 @@ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ -fno-builtin-memcmp -fno-builtin-memcpy -fno-builtin-memset \ -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ - -I$(