[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH for-4.17 v6 2/5] libs/light: Rework targets prerequisites


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 6 Feb 2023 18:02:51 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8rHXcx2/qL3mNCXpB8gDZ0ooVc6uJLo6FWH+iGcAtI0=; b=FUC4YNzNaX9IYPB53TkS4o9SyXDnynvwtjz4ubaZ2qbIrVNbRfecReuxAmy19oAJi5BQfWRvZzqRWf3W8Jx3JniqZSduIP9AfsREYpWb1hWI4i0agme/hwla8Y1Hfn6BFOllDREVVh4pSO28nrjs20pUKra827+tcSCzz64fX585LdhnZV2C6ElSvmPFXz6UaPSl4eouyBX3/cBCzic8PxswEvGU8DxRoYzv1YCsO0K1ldp7ZuYKfHqEP7qi8z8u3c6T8+NMwlKy1ZRZr/gLVigDXfHKErCXjV4enXsD0Z7dG0PZBcba/5DamOejbMEitY4idnzndfUVZZbx/jhXhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gxm6Gi46Zk+PKO26PvqdAqfkrfnr4JtaZrE87ClFOrOStDjCIv81QnX1JfLS02P41ISYqSSbQ/wz6ukTGuRC46hcDV4xtw3LbwAKnAESY+sbsTb5nR7yBKky5iXw4EAy1hyRNIuVifM1CKhHE6fB6PYBuGDThEQU9Uf3kUH52wZyOyi0KvRqIpIusWyI1zpZ8UGwOaldtacaQ4AYXJNr47s/CjwhQzv7e1DksTLAXi9/yAtDqJpR6y7jy7gwj3EHUKfEoOTFf2MUrCzNIuwfQIn6J8i1HF2K5KSs8M/ua4dfPzetomyeyz61dkF1m3BJkw1z1M5xfuAxqlN3PnFUuA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Mon, 06 Feb 2023 18:03:29 +0000
  • Ironport-data: A9a23:qoRGcqkuRpkSS02JVL6YtE7o5gyhJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xJMXm/SPKyIZmD2fNx1PIrlpE8Pv5GHxtFrTVNupCs2FyMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7auaVA8w5ARkPqgR5AGGzhH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 cVHeB0GcBGvvPyn5+yEE9Z3luc8Ica+aevzulk4pd3YJdAPZMmaBonvu5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVM3iea8WDbWUoXiqcF9t0CUv G/ZuU/+BQkXLoe3wjuZ6HO8wOTImEsXXapDSe3gqaUx0DV/wEQ6T0QqXgOQmsK7j0XmAvVtN 3AY2jMh+P1aGEuDC4OVsweDiG6JuFsQVsRdF8U+6RqR0ezE7gCBHG8GQzVdLts8u6ceWjgCx lKP2dTzClRHsrKPTmmG3qyJtj70Mi8QRVLufgcBRAoBptXm/oc6i0uWSs45SfDkyNroBTv33 jaG6jAkgKkehtIK0KP9+k3bhzWrpd7CSQtdChjrY19JJzhRPOaND7FEI3CHhRqcBO51lmW8g UU=
  • Ironport-hdrordr: A9a23:yHYhZqo3gHdCC71iu9C61TAaV5oAeYIsimQD101hICG9E/bo8v xG+c5wuCMc5wx8ZJhNo7+90dC7MArhHP1OkOss1NWZPDUO0VHARL2Ki7GN/9SKIVycygcy78 Zdmp9FebnN5AhB5voSODPIaOrIGuP3lpxAWN2uqEuFkTsaE52IMT0JcDqmLg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20/01/2023 7:44 pm, Anthony PERARD wrote:
> 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_save_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.
>
> 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 have "libxl.h" as prerequisite of "libxl_internal.h", so generated
> headers will still be generated as needed.
>
> Make doesn't need "libxl.h" to generate "testidl.c", "libxl.h" is only
> needed later when building "testidl.o". This avoid the need to
> regenerate "testidl.c" when only "libxl.h" changed. Also use automatic
> variables $< and $@.
>
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> ---
>
> Notes:
>     v6:
>     - rebased, part of the patch commited as 4ff0811
>     - reword commit message
>     
>     v4:
>     - new patch
>
>  tools/libs/light/Makefile | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
> index cd3fa855e1..b28447a2ae 100644
> --- a/tools/libs/light/Makefile
> +++ b/tools/libs/light/Makefile
> @@ -148,9 +148,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
> @@ -178,13 +175,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 $@

Doesn't this want to be a mov-if-changed?

We don't need to force a rebuild if testidl.c hasn't changed, I don't think.

>  
> -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
>  
> @@ -196,7 +193,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
> @@ -208,14 +205,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

I know you're just rearranging existing the existing logic, but why
doesn't `#include <libxl.h>` not generate suitable dependences ?

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.