[PATCH] tools/ocaml: Fix cleaning bindings test

Jason Andryuk posted 1 patch 2 weeks, 2 days ago
tools/ocaml/tests/bindings/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Jason Andryuk 2 weeks, 2 days ago
make clean fails in the bindings tests:

make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
rm: invalid option -- 'c'
Try 'rm --help' for more information.

Split the compiler flags out of the LIBS variable, since LIBS is passed
to rm.  The individual *.cxma files are deleted in their respective
directories.

Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/ocaml/tests/bindings/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/tests/bindings/Makefile b/tools/ocaml/tests/bindings/Makefile
index 75f8babbaf..98fcb7aa5b 100644
--- a/tools/ocaml/tests/bindings/Makefile
+++ b/tools/ocaml/tests/bindings/Makefile
@@ -10,8 +10,8 @@ OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
 	-I $(OCAML_TOPLEVEL)/libs/eventchn
 
-LIBS = \
-	unix.cmxa \
+LIBS = unix.cmxa
+LIBFLAGS = \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
@@ -21,7 +21,7 @@ LIBS = \
 PROGRAMS = test-ocaml-bindings
 OCAML_PROGRAM = test-ocaml-bindings
 
-test-ocaml-bindings_LIBS = $(LIBS)
+test-ocaml-bindings_LIBS = $(LIBS) $(LIBFLAGS)
 test-ocaml-bindings_MLSORTED = $(shell $(OCAMLDEP) -sort $(OBJS:=.ml))
 test-ocaml-bindings_OBJS = $(test-ocaml-bindings_MLSORTED:.ml=)
 
-- 
2.34.1
Re: [PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Andrew Cooper 2 weeks, 2 days ago
On 06/11/2026 11:17 pm, Jason Andryuk wrote:
> make clean fails in the bindings tests:
>
> make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
> rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
> rm: invalid option -- 'c'
> Try 'rm --help' for more information.
>
> Split the compiler flags out of the LIBS variable, since LIBS is passed
> to rm.  The individual *.cxma files are deleted in their respective
> directories.
>
> Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>

Lovely...  Sorry for breaking this.

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Re: [PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Jason Andryuk 2 weeks, 2 days ago
On 2026-11-06 18:19, Andrew Cooper wrote:
> On 06/11/2026 11:17 pm, Jason Andryuk wrote:
>> make clean fails in the bindings tests:
>>
>> make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
>> rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
>> rm: invalid option -- 'c'
>> Try 'rm --help' for more information.
>>
>> Split the compiler flags out of the LIBS variable, since LIBS is passed
>> to rm.  The individual *.cxma files are deleted in their respective
>> directories.
>>
>> Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
> 
> Lovely...  Sorry for breaking this.
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks.  I just double checked and unix.cmxa isn't in the directory on a 
successful build.  So the whole thing could be moved to LIBFLAGS or a 
suitable name.

Regards,
Jason

Re: [PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Andrii Sultanov 2 weeks ago
On 11/7/26 00:11, Jason Andryuk wrote:

> On 2026-11-06 18:19, Andrew Cooper wrote:
>> On 06/11/2026 11:17 pm, Jason Andryuk wrote:
>>> make clean fails in the bindings tests:
>>>
>>> make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
>>> rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs 
>>> *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
>>> rm: invalid option -- 'c'
>>> Try 'rm --help' for more information.
>>>
>>> Split the compiler flags out of the LIBS variable, since LIBS is passed
>>> to rm.  The individual *.cxma files are deleted in their respective
>>> directories.
>>>
>>> Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
>>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>>
>> Lovely...  Sorry for breaking this.
>>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Thanks.  I just double checked and unix.cmxa isn't in the directory on 
> a successful build.  So the whole thing could be moved to LIBFLAGS or 
> a suitable name.
>
> Regards,
> Jason

Could we follow tools/ocaml/xenstored/Makefile further and
move to BINDINGSLIBS or something like that?


Re: [PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Andrew Cooper 2 weeks ago
On 09/11/2026 8:43 am, Andrii Sultanov wrote:
> On 11/7/26 00:11, Jason Andryuk wrote:
>
>> On 2026-11-06 18:19, Andrew Cooper wrote:
>>> On 06/11/2026 11:17 pm, Jason Andryuk wrote:
>>>> make clean fails in the bindings tests:
>>>>
>>>> make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
>>>> rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs
>>>> *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
>>>> rm: invalid option -- 'c'
>>>> Try 'rm --help' for more information.
>>>>
>>>> Split the compiler flags out of the LIBS variable, since LIBS is
>>>> passed
>>>> to rm.  The individual *.cxma files are deleted in their respective
>>>> directories.
>>>>
>>>> Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
>>>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>>>
>>> Lovely...  Sorry for breaking this.
>>>
>>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>
>> Thanks.  I just double checked and unix.cmxa isn't in the directory
>> on a successful build.  So the whole thing could be moved to LIBFLAGS
>> or a suitable name.
>>
>> Regards,
>> Jason
>
> Could we follow tools/ocaml/xenstored/Makefile further and
> move to BINDINGSLIBS or something like that?
>

Yeah, lets do that.  It keeps it firmly away from variable names which
have common meanings.

I'll fix up on commit.

~Andrew

Re: [PATCH] tools/ocaml: Fix cleaning bindings test
Posted by Andrew Cooper 2 weeks, 2 days ago
On 07/11/2026 12:11 am, Jason Andryuk wrote:
> On 2026-11-06 18:19, Andrew Cooper wrote:
>> On 06/11/2026 11:17 pm, Jason Andryuk wrote:
>>> make clean fails in the bindings tests:
>>>
>>> make[7]: Entering directory '/home/amd/xen/tools/ocaml/tests/bindings'
>>> rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs
>>> *.annot *.spot *.spit unix.cmxa -ccopt -L -ccopt ....
>>> rm: invalid option -- 'c'
>>> Try 'rm --help' for more information.
>>>
>>> Split the compiler flags out of the LIBS variable, since LIBS is passed
>>> to rm.  The individual *.cxma files are deleted in their respective
>>> directories.
>>>
>>> Fixes: d97847e858f1 ("tools/ocaml: Gitlab CI test for bindings")
>>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>>
>> Lovely...  Sorry for breaking this.
>>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Thanks.  I just double checked and unix.cmxa isn't in the directory on
> a successful build.  So the whole thing could be moved to LIBFLAGS or
> a suitable name.

Unix is from the Ocaml standard library, but you still have to name it
to get an executable out at the end.

I cribbed this all from tools/ocaml/xenstored/Makefile attempting to
simplify it as I went.  What's not clear is why LIBS is a special name.

~Andrew