diff mbox

[V9,3/8] Buildsystem move qapi generation to Makefile.objs

Message ID 1353060737-4244-4-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia Nov. 16, 2012, 10:12 a.m. UTC
Sub Makefile may need qapi generated files, so move them to Makefile.objs,
In this way Makfile.objs control file auto generation.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 Makefile      |   22 ----------------------
 Makefile.objs |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 22 deletions(-)

Comments

Paolo Bonzini Nov. 16, 2012, 10:54 a.m. UTC | #1
Il 16/11/2012 11:12, Wenchao Xia ha scritto:
>   Sub Makefile may need qapi generated files, so move them to Makefile.objs,
> In this way Makfile.objs control file auto generation.

No objection in principle, but why are you doing this?  Does it fix
anything?

Paolo

> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  Makefile      |   22 ----------------------
>  Makefile.objs |   22 ++++++++++++++++++++++
>  2 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 8201e80..2cde430 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -207,28 +207,6 @@ ifneq ($(wildcard config-host.mak),)
>  include $(SRC_PATH)/tests/Makefile
>  endif
>  
> -qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
> -
> -qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> -qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> -qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> -
> -qapi-types.c qapi-types.h :\
> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
> -qapi-visit.c qapi-visit.h :\
> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
> -qmp-commands.h qmp-marshal.c :\
> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
> -
>  QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
>  $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
>  
> diff --git a/Makefile.objs b/Makefile.objs
> index 37be7e2..9da96ea 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -224,6 +224,28 @@ common-obj-y += qmp.o hmp.o
>  
>  universal-obj-y += $(qapi-obj-y)
>  
> +qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
> +
> +qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> +qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> +qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
> +
> +qapi-types.c qapi-types.h :\
> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
> +qapi-visit.c qapi-visit.h :\
> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
> +qmp-commands.h qmp-marshal.c :\
> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
> +
>  ######################################################################
>  # guest agent
>  
>
Wayne Xia Nov. 16, 2012, 10:58 a.m. UTC | #2
于 2012-11-16 18:54, Paolo Bonzini 写道:
> Il 16/11/2012 11:12, Wenchao Xia ha scritto:
>>    Sub Makefile may need qapi generated files, so move them to Makefile.objs,
>> In this way Makfile.objs control file auto generation.
>
> No objection in principle, but why are you doing this?  Does it fix
> anything?
>
> Paolo
>

   It seems tools or block objects files are depending on qapi files,
and libqblock needs tools. So without it out of tree build of libqblock
would fail.

>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>> ---
>>   Makefile      |   22 ----------------------
>>   Makefile.objs |   22 ++++++++++++++++++++++
>>   2 files changed, 22 insertions(+), 22 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 8201e80..2cde430 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -207,28 +207,6 @@ ifneq ($(wildcard config-host.mak),)
>>   include $(SRC_PATH)/tests/Makefile
>>   endif
>>
>> -qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
>> -
>> -qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
>> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> -qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
>> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> -qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
>> -$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> -
>> -qapi-types.c qapi-types.h :\
>> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
>> -qapi-visit.c qapi-visit.h :\
>> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
>> -qmp-commands.h qmp-marshal.c :\
>> -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
>> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
>> -
>>   QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
>>   $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
>>
>> diff --git a/Makefile.objs b/Makefile.objs
>> index 37be7e2..9da96ea 100644
>> --- a/Makefile.objs
>> +++ b/Makefile.objs
>> @@ -224,6 +224,28 @@ common-obj-y += qmp.o hmp.o
>>
>>   universal-obj-y += $(qapi-obj-y)
>>
>> +qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
>> +
>> +qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
>> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> +qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
>> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> +qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
>> +$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
>> +
>> +qapi-types.c qapi-types.h :\
>> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
>> +qapi-visit.c qapi-visit.h :\
>> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
>> +qmp-commands.h qmp-marshal.c :\
>> +$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
>> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
>> +
>>   ######################################################################
>>   # guest agent
>>
>>
>
Paolo Bonzini Nov. 16, 2012, 11:12 a.m. UTC | #3
Il 16/11/2012 11:58, Wenchao Xia ha scritto:
>>>    Sub Makefile may need qapi generated files, so move them to
>>> Makefile.objs,
>>> In this way Makfile.objs control file auto generation.
>>
>> No objection in principle, but why are you doing this?  Does it fix
>> anything?
> 
>   It seems tools or block objects files are depending on qapi files,

Yes, block files are.

> and libqblock needs tools. So without it out of tree build of libqblock
> would fail.

The effect of this patch is to include the rules in libqblock's own
Makefile.

libqblock indeed needs to compile these files to .lo.  However,
regeneration of the C source code and header shouldn't be needed there.
 I think you're missing a dependency in the toplevel Makefile's
"libqblock.la" rule.

By the way, do not name that rule "libqblock.la".  It doesn't build
libqblock.la, it builds libqblock/libqblock.la.  Instead, name it
subdir-libqblock.

Paolo
Wayne Xia Nov. 18, 2012, 12:56 p.m. UTC | #4
于 2012-11-16 19:12, Paolo Bonzini 写道:
> Il 16/11/2012 11:58, Wenchao Xia ha scritto:
>>>>     Sub Makefile may need qapi generated files, so move them to
>>>> Makefile.objs,
>>>> In this way Makfile.objs control file auto generation.
>>>
>>> No objection in principle, but why are you doing this?  Does it fix
>>> anything?
>>
>>    It seems tools or block objects files are depending on qapi files,
>
> Yes, block files are.
>
>> and libqblock needs tools. So without it out of tree build of libqblock
>> would fail.
>
> The effect of this patch is to include the rules in libqblock's own
> Makefile.
>
> libqblock indeed needs to compile these files to .lo.  However,
> regeneration of the C source code and header shouldn't be needed there.
>   I think you're missing a dependency in the toplevel Makefile's
> "libqblock.la" rule.
>
   yes, I'll try avoid generation of those C files in sub directory.
Still moving generation rules all into Makefile.obs seems right to me.

> By the way, do not name that rule "libqblock.la".  It doesn't build
> libqblock.la, it builds libqblock/libqblock.la.  Instead, name it
> subdir-libqblock.
   OK.

>
> Paolo
>
Paolo Bonzini Nov. 18, 2012, 2:55 p.m. UTC | #5
Il 18/11/2012 13:56, Wenchao Xia ha scritto:
> 于 2012-11-16 19:12, Paolo Bonzini 写道:
>> Il 16/11/2012 11:58, Wenchao Xia ha scritto:
>>>>>     Sub Makefile may need qapi generated files, so move them to
>>>>> Makefile.objs,
>>>>> In this way Makfile.objs control file auto generation.
>>>>
>>>> No objection in principle, but why are you doing this?  Does it fix
>>>> anything?
>>>
>>>    It seems tools or block objects files are depending on qapi files,
>>
>> Yes, block files are.
>>
>>> and libqblock needs tools. So without it out of tree build of libqblock
>>> would fail.
>>
>> The effect of this patch is to include the rules in libqblock's own
>> Makefile.
>>
>> libqblock indeed needs to compile these files to .lo.  However,
>> regeneration of the C source code and header shouldn't be needed there.
>>   I think you're missing a dependency in the toplevel Makefile's
>> "libqblock.la" rule.
>>
>   yes, I'll try avoid generation of those C files in sub directory.
> Still moving generation rules all into Makefile.obs seems right to me.

Makefile.objs rules are common to all subdirectories, including
*-softmmu and *-linux-user.  This is not what you want in this case.

Paolo
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 8201e80..2cde430 100644
--- a/Makefile
+++ b/Makefile
@@ -207,28 +207,6 @@  ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/tests/Makefile
 endif
 
-qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
-
-qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
-$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
-qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
-$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
-qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
-$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
-
-qapi-types.c qapi-types.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
-qapi-visit.c qapi-visit.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
-qmp-commands.h qmp-marshal.c :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
-
 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
 
diff --git a/Makefile.objs b/Makefile.objs
index 37be7e2..9da96ea 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -224,6 +224,28 @@  common-obj-y += qmp.o hmp.o
 
 universal-obj-y += $(qapi-obj-y)
 
+qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
+
+qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
+$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
+qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
+$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
+qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
+$(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, "  GEN   $@")
+
+qapi-types.c qapi-types.h :\
+$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py $(gen-out-type) -o "." < $<, "  GEN   $@")
+qapi-visit.c qapi-visit.h :\
+$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py $(gen-out-type) -o "."  < $<, "  GEN   $@")
+qmp-commands.h qmp-marshal.c :\
+$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py $(gen-out-type) -m -o "." < $<, "  GEN   $@")
+
 ######################################################################
 # guest agent