Skip to contentSkip to conversation

libxl: fix gentypes call in Makefile

PATCH Superseded Cédric Bosdonnat 2 participants 4 messages Nov 10, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: fix gentypes call in Makefile

From the make documentation:

"$* [...] If the target is dir/a.foo.b' and the target pattern is a.%.b' then the stem is dir/foo'. In a static pattern rule, the stem is part of the file name that matched the %' in the target pattern."

The rule generating the c types files from the idl ones is not a static pattern rule, but rather an implicit rule. Thus the value of $* is preceded by the file path, instead of only what matches %.

In order to get this fixed, drop the path using a $(shell basename $*).

---
 tools/libxl/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tools/libxl/Makefile +7 -6
index af0a3ad..78fede3 100644
@@ -250,12 +250,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
-	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_private.h \
-		__libxl_type$*_json.h  __libxl_type$*.c
-	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
-	$(call move-if-changed,__libxl_type$*_private.h,_libxl_type$*_private.h)
-	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
-	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
+	$(eval stem = $(shell basename $*))
+	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
+		__libxl_type$(stem)_json.h  __libxl_type$(stem).c
+	$(call move-if-changed,__libxl_type$(stem).h,_libxl_type$(stem).h)
+	$(call move-if-changed,__libxl_type$(stem)_private.h,_libxl_type$(stem)_private.h)
+	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
+	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
 
 libxenlight.so: libxenlight.so.$(MAJOR)
 	$(SYMLINK_SHLIB) $< $@
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 7 lines · Cédric Bosdonnat

From the make documentation:

"$* [...] If the target is dir/a.foo.b' and the target pattern is a.%.b' then the stem is dir/foo'. In a static pattern rule, the stem is part of the file name that matched the %' in the target pattern."

Quoted 5 lines

The rule generating the c types files from the idl ones is not a static pattern rule, but rather an implicit rule. Thus the value of $* is preceded by the file path, instead of only what matches %.

In order to get this fixed, drop the path using a $(shell basename $*).

Why not $(notdir $*) ?

Juergen

Quoted 21 lines
---
 tools/libxl/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tools/libxl/Makefile +0 -6
index af0a3ad..78fede3 100644
@@ -250,12 +250,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
-	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_private.h \
-		__libxl_type$*_json.h  __libxl_type$*.c
-	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
-	$(call move-if-changed,__libxl_type$*_private.h,_libxl_type$*_private.h)
-	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
-	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \ · line 262

Quoted 10 lines
tools/libxl/Makefile +7 -0
+	$(eval stem = $(shell basename $*))
+	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
+		__libxl_type$(stem)_json.h  __libxl_type$(stem).c
+	$(call move-if-changed,__libxl_type$(stem).h,_libxl_type$(stem).h)
+	$(call move-if-changed,__libxl_type$(stem)_private.h,_libxl_type$(stem)_private.h)
+	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
+	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
 
 libxenlight.so: libxenlight.so.$(MAJOR)
 	$(SYMLINK_SHLIB) $< $@

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 8 lines · Juergen Gross
Quoted 7 lines · Cédric Bosdonnat

From the make documentation:

"$* [...] If the target is dir/a.foo.b' and the target pattern is a.%.b' then the stem is dir/foo'. In a static pattern rule, the stem is part of the file name that matched the %' in the target pattern."

Quoted 7 lines
Quoted 5 lines

The rule generating the c types files from the idl ones is not a static pattern rule, but rather an implicit rule. Thus the value of $* is preceded by the file path, instead of only what matches %.

In order to get this fixed, drop the path using a $(shell basename $*).

Why not $(notdir $*) ?

Just because I wasn't aware of it. But of course, I can change to it:
it's surely a more portable solution

--
Cedric

Quoted 26 lines

Juergen

Quoted 23 lines

---
 tools/libxl/Makefile | 13 +++++++------

 1 file changed, 7 insertions(+), 6 deletions(-)
tools/libxl/Makefile +0 -0
index af0a3ad..78fede3 100644
@@ -250,12 +250,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \

 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h

 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py

tools/libxl/Makefile +3 -6
-	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_private.h \
-		__libxl_type$*_json.h  __libxl_type$*.c
-	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
-	$(call move-if-changed,__libxl_type$*_private.h,_libxl_type$*_private.h)
-	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
-	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
+	$(eval stem = $(shell basename $*))
+	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
+		__libxl_type$(stem)_json.h  __libxl_type$(stem).c
Quoted 10 lines
Quoted 8 lines
tools/libxl/Makefile +4 -0
+	$(call move-if-changed,__libxl_type$(stem).h,_libxl_type$(stem).h)
+	$(call move-if-changed,__libxl_type$(stem)_private.h,_libxl_type$(stem)_private.h)
+	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
+	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)


 libxenlight.so: libxenlight.so.$(MAJOR)
  $(SYMLINK_SHLIB) $< $@

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 13 lines · Cedric Bosdonnat
Quoted 12 lines · Juergen Gross
Quoted 11 lines · Cédric Bosdonnat

From the make documentation:

"$* [...] If the target is dir/a.foo.b' and the target pattern is a.%.b' then the stem is dir/foo'. In a static pattern rule, the stem is part of the file name that matched the %' in the target pattern."

The rule generating the c types files from the idl ones is not a static pattern rule, but rather an implicit rule. Thus the value of $* is preceded by the file path, instead of only what matches %.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

In order to get this fixed, drop the path using a $(shell basename $*).

Why not $(notdir $*) ?

Just because I wasn't aware of it. But of course, I can change to it:
it's surely a more portable solution

And it spares two processes.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel