xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: fix gentypes call in Makefile
@ 2016-11-10 13:11 Cédric Bosdonnat
  2016-11-10 14:49 ` Juergen Gross
  0 siblings, 1 reply; 4+ messages in thread
From: Cédric Bosdonnat @ 2016-11-10 13:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, 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 %.

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

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
---
 tools/libxl/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index af0a3ad..78fede3 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -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) $< $@
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: fix gentypes call in Makefile
  2016-11-10 13:11 [PATCH] libxl: fix gentypes call in Makefile Cédric Bosdonnat
@ 2016-11-10 14:49 ` Juergen Gross
  2016-11-10 16:14   ` Cedric Bosdonnat
  0 siblings, 1 reply; 4+ messages in thread
From: Juergen Gross @ 2016-11-10 14:49 UTC (permalink / raw)
  To: Cédric Bosdonnat, xen-devel; +Cc: Ian Jackson, Wei Liu

On 10/11/16 14:11, Cédric Bosdonnat wrote:
> 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 $*).

Why not $(notdir $*) ?


Juergen

> 
> Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
> ---
>  tools/libxl/Makefile | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index af0a3ad..78fede3 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -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) $< $@
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: fix gentypes call in Makefile
  2016-11-10 14:49 ` Juergen Gross
@ 2016-11-10 16:14   ` Cedric Bosdonnat
  2016-11-10 16:20     ` Juergen Gross
  0 siblings, 1 reply; 4+ messages in thread
From: Cedric Bosdonnat @ 2016-11-10 16:14 UTC (permalink / raw)
  To: Juergen Gross, xen-devel; +Cc: Ian Jackson, Wei Liu

On Thu, 2016-11-10 at 15:49 +0100, Juergen Gross wrote:
> On 10/11/16 14:11, Cédric Bosdonnat wrote:
> > 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 $*).
> 
> 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

> 
> Juergen
> 
> > 
> > Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
> > ---
> >  tools/libxl/Makefile | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> > index af0a3ad..78fede3 100644
> > --- a/tools/libxl/Makefile
> > +++ b/tools/libxl/Makefile
> > @@ -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) $< $@
> > 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxl: fix gentypes call in Makefile
  2016-11-10 16:14   ` Cedric Bosdonnat
@ 2016-11-10 16:20     ` Juergen Gross
  0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2016-11-10 16:20 UTC (permalink / raw)
  To: Cedric Bosdonnat, xen-devel; +Cc: Wei Liu, Ian Jackson

On 10/11/16 17:14, Cedric Bosdonnat wrote:
> On Thu, 2016-11-10 at 15:49 +0100, Juergen Gross wrote:
>> On 10/11/16 14:11, Cédric Bosdonnat wrote:
>>> 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 $*).
>>
>> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-10 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10 13:11 [PATCH] libxl: fix gentypes call in Makefile Cédric Bosdonnat
2016-11-10 14:49 ` Juergen Gross
2016-11-10 16:14   ` Cedric Bosdonnat
2016-11-10 16:20     ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).