diff mbox

[v3,8/8] hw/misc/edu: Compile the edu device as common object

Message ID 1497937927-19738-9-git-send-email-thuth@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Huth June 20, 2017, 5:52 a.m. UTC
edu.c does not contain any target-specific code, so we can put
it into common-obj-y to compile it only once for all targets.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/misc/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Henderson June 20, 2017, 6:14 p.m. UTC | #1
On 06/19/2017 10:52 PM, Thomas Huth wrote:
> edu.c does not contain any target-specific code, so we can put
> it into common-obj-y to compile it only once for all targets.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Isn't CONFIG_EDU defined by the target, via pci.conf?
Would it ever be set generically?


r~
Thomas Huth June 21, 2017, 1:40 a.m. UTC | #2
On 20.06.2017 20:14, Richard Henderson wrote:
> On 06/19/2017 10:52 PM, Thomas Huth wrote:
>> edu.c does not contain any target-specific code, so we can put
>> it into common-obj-y to compile it only once for all targets.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> Isn't CONFIG_EDU defined by the target, via pci.conf?
> Would it ever be set generically?

This is about Makefiles, not #defines in C sources ... so if I
understand our build-system correctly, the variable is set for the
Makefiles of the targets that use pci.mak. As far as I see, it gets
compiled correctly here.
And we've got plenty of those common-obj-$(CONFIG_xxx) statements
elsewhere in this file (e.g. for CONFIG_PCI_TESTDEV which is also
declared in default-configs/pci.mak), so this is just normal, no problem
here, as far as I can tell.

 Thomas
Paolo Bonzini June 22, 2017, 7:59 a.m. UTC | #3
----- Original Message -----
> From: "Thomas Huth" <thuth@redhat.com>
> To: "Richard Henderson" <rth@twiddle.net>, qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
> Sent: Wednesday, June 21, 2017 3:40:31 AM
> Subject: Re: [PATCH v3 8/8] hw/misc/edu: Compile the edu device as common object
> 
> On 20.06.2017 20:14, Richard Henderson wrote:
> > On 06/19/2017 10:52 PM, Thomas Huth wrote:
> >> edu.c does not contain any target-specific code, so we can put
> >> it into common-obj-y to compile it only once for all targets.
> >>
> >> Signed-off-by: Thomas Huth <thuth@redhat.com>
> > 
> > Isn't CONFIG_EDU defined by the target, via pci.conf?
> > Would it ever be set generically?
> 
> This is about Makefiles, not #defines in C sources ... so if I
> understand our build-system correctly, the variable is set for the
> Makefiles of the targets that use pci.mak. As far as I see, it gets
> compiled correctly here.
> And we've got plenty of those common-obj-$(CONFIG_xxx) statements
> elsewhere in this file (e.g. for CONFIG_PCI_TESTDEV which is also
> declared in default-configs/pci.mak), so this is just normal, no problem
> here, as far as I can tell.

Yes, the variable is evaluated once during the main directory build,
where it comes from config-all-devices.mak.  Then it is evaluated again
during the per-target build, where it comes from target-specific
configuration.

config-all-devices.mak should be documented in docs/devel/build-system.txt.

Paolo
Paolo
diff mbox

Patch

diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 2019846..7fc4e41 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -6,6 +6,7 @@  common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o
 common-obj-$(CONFIG_SGA) += sga.o
 common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o
 common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o
+common-obj-$(CONFIG_EDU) += edu.o
 
 common-obj-y += unimp.o
 
@@ -53,7 +54,6 @@  obj-$(CONFIG_MIPS_CPS) += mips_cpc.o
 obj-$(CONFIG_MIPS_ITU) += mips_itu.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
-obj-$(CONFIG_EDU) += edu.o
 obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o