Message ID | 1481285870-3396-2-git-send-email-thuth@redhat.com |
---|---|
State | New |
Headers | show |
Le 09/12/2016 à 13:17, Thomas Huth a écrit : > To be able to compile the CPU targets from within a subfolder > of the target/ folder, we've got to adapt the Makefile.target > a little bit first. After this change, target CPUs can either > reside in a target/xxx folder or continue to use the target-xxx > scheme. The latter will be disabled once all targets have been > moved. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > Makefile.target | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/Makefile.target b/Makefile.target > index 7a5080e..90b25ae 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -7,11 +7,17 @@ include config-target.mak > include config-devices.mak > include $(SRC_PATH)/rules.mak > > +ifneq ($(wildcard $(SRC_PATH)/target/$(TARGET_BASE_ARCH)),) > +TARGET_FOLDER=target/$(TARGET_BASE_ARCH) > +else > +TARGET_FOLDER=target-$(TARGET_BASE_ARCH) > +endif Perhaps you should consider to use ':=' instead of '='. Laurent
On 09.12.2016 13:24, Laurent Vivier wrote: > Le 09/12/2016 à 13:17, Thomas Huth a écrit : >> To be able to compile the CPU targets from within a subfolder >> of the target/ folder, we've got to adapt the Makefile.target >> a little bit first. After this change, target CPUs can either >> reside in a target/xxx folder or continue to use the target-xxx >> scheme. The latter will be disabled once all targets have been >> moved. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> Makefile.target | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/Makefile.target b/Makefile.target >> index 7a5080e..90b25ae 100644 >> --- a/Makefile.target >> +++ b/Makefile.target >> @@ -7,11 +7,17 @@ include config-target.mak >> include config-devices.mak >> include $(SRC_PATH)/rules.mak >> >> +ifneq ($(wildcard $(SRC_PATH)/target/$(TARGET_BASE_ARCH)),) >> +TARGET_FOLDER=target/$(TARGET_BASE_ARCH) >> +else >> +TARGET_FOLDER=target-$(TARGET_BASE_ARCH) >> +endif > > Perhaps you should consider to use ':=' instead of '='. Most of the other variables in that file seem to be set with '=' instead of ':=', so using '=' sounds more consistent to me ... is there a real benefit of using ':=' here? Thomas
Le 09/12/2016 à 17:51, Thomas Huth a écrit : > On 09.12.2016 13:24, Laurent Vivier wrote: >> Le 09/12/2016 à 13:17, Thomas Huth a écrit : >>> To be able to compile the CPU targets from within a subfolder >>> of the target/ folder, we've got to adapt the Makefile.target >>> a little bit first. After this change, target CPUs can either >>> reside in a target/xxx folder or continue to use the target-xxx >>> scheme. The latter will be disabled once all targets have been >>> moved. >>> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> Makefile.target | 10 ++++++++-- >>> 1 file changed, 8 insertions(+), 2 deletions(-) >>> >>> diff --git a/Makefile.target b/Makefile.target >>> index 7a5080e..90b25ae 100644 >>> --- a/Makefile.target >>> +++ b/Makefile.target >>> @@ -7,11 +7,17 @@ include config-target.mak >>> include config-devices.mak >>> include $(SRC_PATH)/rules.mak >>> >>> +ifneq ($(wildcard $(SRC_PATH)/target/$(TARGET_BASE_ARCH)),) >>> +TARGET_FOLDER=target/$(TARGET_BASE_ARCH) >>> +else >>> +TARGET_FOLDER=target-$(TARGET_BASE_ARCH) >>> +endif >> >> Perhaps you should consider to use ':=' instead of '='. > > Most of the other variables in that file seem to be set with '=' instead > of ':=', so using '=' sounds more consistent to me ... is there a real > benefit of using ':=' here? With ':=' your variable is expanded once, with '=' it is expanded whenever it is used. I think this is not needed in your case. https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors Thanks, Laurent
On Sat, Dec 10, 2016 at 11:59:09AM +0100, Laurent Vivier wrote: > Le 09/12/2016 à 17:51, Thomas Huth a écrit : > > On 09.12.2016 13:24, Laurent Vivier wrote: > >> Le 09/12/2016 à 13:17, Thomas Huth a écrit : > >>> To be able to compile the CPU targets from within a subfolder > >>> of the target/ folder, we've got to adapt the Makefile.target > >>> a little bit first. After this change, target CPUs can either > >>> reside in a target/xxx folder or continue to use the target-xxx > >>> scheme. The latter will be disabled once all targets have been > >>> moved. > >>> > >>> Signed-off-by: Thomas Huth <thuth@redhat.com> > >>> --- > >>> Makefile.target | 10 ++++++++-- > >>> 1 file changed, 8 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/Makefile.target b/Makefile.target > >>> index 7a5080e..90b25ae 100644 > >>> --- a/Makefile.target > >>> +++ b/Makefile.target > >>> @@ -7,11 +7,17 @@ include config-target.mak > >>> include config-devices.mak > >>> include $(SRC_PATH)/rules.mak > >>> > >>> +ifneq ($(wildcard $(SRC_PATH)/target/$(TARGET_BASE_ARCH)),) > >>> +TARGET_FOLDER=target/$(TARGET_BASE_ARCH) > >>> +else > >>> +TARGET_FOLDER=target-$(TARGET_BASE_ARCH) > >>> +endif > >> > >> Perhaps you should consider to use ':=' instead of '='. > > > > Most of the other variables in that file seem to be set with '=' instead > > of ':=', so using '=' sounds more consistent to me ... is there a real > > benefit of using ':=' here? > > With ':=' your variable is expanded once, with '=' it is expanded > whenever it is used. I think this is not needed in your case. > > https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors I tend to thing '=' is the safer default option unless you're really hitting performance problems that ':=' can alleviate. Not re-expanding can lead to confusing bugs later if the definition is changed so that re-expansion matters in future.
diff --git a/Makefile.target b/Makefile.target index 7a5080e..90b25ae 100644 --- a/Makefile.target +++ b/Makefile.target @@ -7,11 +7,17 @@ include config-target.mak include config-devices.mak include $(SRC_PATH)/rules.mak +ifneq ($(wildcard $(SRC_PATH)/target/$(TARGET_BASE_ARCH)),) +TARGET_FOLDER=target/$(TARGET_BASE_ARCH) +else +TARGET_FOLDER=target-$(TARGET_BASE_ARCH) +endif + $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) ifdef CONFIG_LINUX QEMU_CFLAGS += -I../linux-headers endif -QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H +QEMU_CFLAGS += -I.. -I$(SRC_PATH)/$(TARGET_FOLDER) -DNEED_CPU_H QEMU_CFLAGS+=-I$(SRC_PATH)/include @@ -92,7 +98,7 @@ obj-$(CONFIG_TCG_INTERPRETER) += tci.o obj-y += tcg/tcg-common.o obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o obj-y += fpu/softfloat.o -obj-y += target-$(TARGET_BASE_ARCH)/ +obj-y += $(TARGET_FOLDER)/ obj-y += disas.o obj-y += tcg-runtime.o obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
To be able to compile the CPU targets from within a subfolder of the target/ folder, we've got to adapt the Makefile.target a little bit first. After this change, target CPUs can either reside in a target/xxx folder or continue to use the target-xxx scheme. The latter will be disabled once all targets have been moved. Signed-off-by: Thomas Huth <thuth@redhat.com> --- Makefile.target | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)