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

[XEN PATCH v4 30/32] libs/light: Rework targets prerequisites


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Thu, 11 Aug 2022 17:48:43 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>
  • Delivery-date: Thu, 11 Aug 2022 16:59:34 +0000
  • 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/+Grg2iYISO6zNbc5IfLS69a1zCR1nSkOsUXXAtF2/oQXL9kGNL1QZ+RLm3chRFQS+Kf1FjEwc1YzQOHcOxPd1IF58tAI8ABvFZpjppwuWdvnsqyHPytppsraehVab/ddlkDXu5ouzF25sTO7JBp6QCtRT0y7Z0AaVUC4tGNOqg8NKg6az5UiLkbE/o8DNjxFHBR402k4anDjLbpungvrSKDmj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7w6q+QGvGu723Yq+R93GMCvgZ1JatcOVu/QO6tI3rtp4tr2AIbei35It8eTw25hkMqt6klJuPjtH3eD5o5xjWEwJhSuGT9DMzHN8CaC36RwJENXcTwVyiPT6PJL+50Td/Cs+4oC7TDTZGibfkMyu52wqeD/e9gFV1XkmSyL7BrrCEb/+JL9MoCzrxI0/H0wXUfeLkIhRfvH2/c/Auwjetx2DTagZ1CbcoFrQON/crnxw379TMEK1p3uiHqXz9MoN+DxNui/iX105cPDqLOFdxOSMYJBkYs5/NlEiM99sUmkprHOYR+H3zt+Iui2u1wwFr5pTthDuWFQjeguhpFQCW+oi3rk5GG+GLVFOkQvU2NlLmXoB9aTAD57K3ixJjMgWCnL5w61KXZXTF+xIfyhazqasqcUuQuQ6T7IaWNsbAjFExnsFHdLwsLl50WNOsLAhISbmZ/EvrkC9JNKMX7mzwzimxE6X9FZFmmjlRwBLcte4MpElPSeZPZFnHwx48188BkWfNFOb8ffzlF5l+5pDPdGm1AfuwX2kMFg1sm89GKWgAcX9JEV93nujf/VyFnjua9Z9Z5zeOr4vPAONj2gbTcLnBWgQHeoo6wUqvUSIJA18DfJnJFtaiQi6Lrcd6p6uy88Gp/W4RnWdtnwUJeWkPHOWAZj3+7zgbPdTRlN2+s9yj5knaHYsEkdkoN2KLZSjkU52krNDLTFpvALx62ofuCUudifTCBoN6Vn3oUTq5lvSlotQLdT3SkVZyzPDVoeTt7mlMXhk6+UkZMfFwBBDen763VjY9NPvLJ0BRSD74X41ONOZJttjeF/jE9FhM8fFRbotO/s0WZ1FQpB7x8yIexsddGTrm+I1IWV6
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <anthony.perard@xxxxxxxxxx>
---

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
-- 
Anthony PERARD




 


Rackspace

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