From patchwork Thu Aug 11 16:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12941634 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 1C9B3C25B0C for ; Thu, 11 Aug 2022 16:59:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.384880.620410 (Exim 4.92) (envelope-from ) id 1oMBWu-0004Hv-20; Thu, 11 Aug 2022 16:59:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 384880.620410; Thu, 11 Aug 2022 16:59:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMBWt-0004H4-Tn; Thu, 11 Aug 2022 16:59:31 +0000 Received: by outflank-mailman (input) for mailman id 384880; Thu, 11 Aug 2022 16:59:30 +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 1oMBNd-0003Aq-9y for xen-devel@lists.xenproject.org; Thu, 11 Aug 2022 16:49:57 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9e4059c7-1995-11ed-bd2e-47488cf2e6aa; Thu, 11 Aug 2022 18:49:52 +0200 (CEST) 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: 9e4059c7-1995-11ed-bd2e-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1660236592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGFwXlrWynx6TK1V9fLINkj8ydS6NN68SzpiLukviOo=; b=Bbcn02x9t6ELcMfDYy/1g51p4uiVIBNSpL61EQ27vLlbj2WSyh93IuKM OtcWp1TQ/MiJqTSvS9/oYfiUNjtQcUqj54/FK68Yr0y4Pczfe1sJVdH+1 wxDQu5UdS9jOJX+QWsvfmX20inmGlCHN2Paid7q0G0ujaj1QcaqVIai5P 4=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 77898119 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:YZv2BKI7U4ZZJOR0FE//H55y6k4xRxNeGxP+qgilJ80cmdWY4AxU5fiJA7t6h/JklmHkQqc++bkUhDt+1aKTYknsPwqF0fTr+p2GHfAGGAa+5RFE2PFMpiHviMVW1pg09echHfxEm4CRUTqZzBJ/FnhQRbdfsR08ONa+vl/4QdmsU3m8Bu7zUrmmKM/3EY4gLoMCBTT+AMlxqHaXYMsuATrh2jPN5IqhX/ykw8/siy6gl63hjmE8TBKIpsN+5TmQo+WuW4R/0eoEpWBo+wuRRmtFXXJ6n0zzC+ISzr/wT9FrDAkSzjDtOl2yi6QmZNNULEqcaPhPwqidLKtNZlItLzlAynFoGQI4wcxpgqnNH3+GTiRzeRNkORLoqXnDleZkozoVkcq6OEGjJ4DpdSHTEPaOBFC1iAFYKrFu5OcGOdIHY1lDAyHUHTZWKIoJimp88cKTBxvxPPrYHFU5kxex7GMzIymPlrl/MdaJXGSlQsnytm3O41AuDsERw+k7Mh/x/+Grg2iYISO6zNbc5IfLS69a1zCR1nSkOsUXXA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a="77898119" From: Anthony PERARD To: CC: Anthony PERARD , Wei Liu , "Juergen Gross" Subject: [XEN PATCH v4 30/32] libs/light: Rework targets prerequisites Date: Thu, 11 Aug 2022 17:48:43 +0100 Message-ID: <20220811164845.38083-31-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220811164845.38083-1-anthony.perard@citrix.com> References: <20220811164845.38083-1-anthony.perard@citrix.com> MIME-Version: 1.0 No need for $(AUTOSRCS), GNU make can generate them as needed when trying to build them as needed when trying to build the object. Also, those two AUTOSRCS don't need to be a prerequisite of "all". As for the "clean" target, those two files are already removed via "_*.c". We don't need $(AUTOINCS) either: - As for both _libxl_savm_msgs*.h headers, we are adding more selective dependencies so the headers will still be generated as needed. - "clean" rule already delete the _*.h files, so AUTOINCS aren't needed there. "libxl_internal_json.h" doesn't seems to have ever existed, so the dependency is removed. Add few prerequisite for "libxl_internal.h" so all headers that it depends on should be generated. And have $(SAVE_HELPER_OBJS) depends on "libxl_internal.h". Rework objects prerequisites, to have them dependents on either "libxl.h" or "libxl_internal.h". "libxl.h" is not normally included directly in the source code as "libxl_internal.h" is used instead. But we are adding "libxl.h" as prerequisite of "libxl_internal.h", so generated headers will still be generated as needed. "testidl.c" doesn't depends on "libxl.h" but "testidl.o" does. Also use automatic variables $< and $@. Signed-off-by: Anthony PERARD --- Notes: v4: - new patch tools/libs/light/Makefile | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile index 9329055c98..274e8350bb 100644 --- a/tools/libs/light/Makefile +++ b/tools/libs/light/Makefile @@ -147,9 +147,6 @@ LIBXL_TEST_OBJS += $(foreach t, $(LIBXL_TESTS_INSIDE),libxl_test_$t.opic) TEST_PROG_OBJS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t.o) test_common.o TEST_PROGS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t) -AUTOINCS = _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h -AUTOSRCS = _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c - CLIENTS = testidl libxl-save-helper SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o @@ -177,13 +174,13 @@ libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest) testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight) -testidl.c: libxl_types.idl gentest.py $(XEN_INCLUDE)/libxl.h $(AUTOINCS) - $(PYTHON) gentest.py libxl_types.idl testidl.c.new - mv testidl.c.new testidl.c +testidl.c: libxl_types.idl gentest.py + $(PYTHON) gentest.py $< $@.new + mv -f $@.new $@ -all: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS) +all: $(CLIENTS) $(TEST_PROGS) -$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok +$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): libxl.api-ok $(DSDT_FILES-y): acpi @@ -195,7 +192,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check $(PERL) $^ touch $@ -_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS) +_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(CC) $(CPPFLAGS) $(CFLAGS) -c -E $< $(APPEND_CFLAGS) \ -DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \ >$@.new @@ -207,13 +204,22 @@ _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \ $(PERL) -w $< $@ >$@.new $(call move-if-changed,$@.new,$@) +# +# headers dependencies on generated headers +# $(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h +libxl_internal.h: $(XEN_INCLUDE)/libxl.h $(XEN_INCLUDE)/libxl_json.h libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h _libxl_types_internal_private.h -libxl_internal_json.h: _libxl_types_internal_json.h +libxl_internal.h: _libxl_save_msgs_callout.h -$(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h +# +# objects dependencies on headers that depends on generated headers +# +$(TEST_PROG_OBJS): $(XEN_INCLUDE)/libxl.h $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h +$(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h _libxl_save_msgs_helper.h +testidl.o: $(XEN_INCLUDE)/libxl.h # This exploits the 'multi-target pattern rule' trick. # gentypes.py should be executed only once to make all the targets. @@ -260,5 +266,4 @@ clean:: $(RM) testidl.c.new testidl.c *.api-ok $(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic $(RM) -r __pycache__ - $(RM) $(AUTOSRCS) $(AUTOINCS) $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean