public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvmtool] Makefile: 'lvm version' works incorrect. Because CFLAGS can not get sub-make variable $(KVMTOOLS_VERSION)
@ 2021-12-04  6:14 haibiao.xiao
  2021-12-08 16:38 ` Alexandru Elisei
  2021-12-09 15:57 ` Andre Przywara
  0 siblings, 2 replies; 9+ messages in thread
From: haibiao.xiao @ 2021-12-04  6:14 UTC (permalink / raw)
  To: kvm; +Cc: will, julien.thierry.kdev, haibiao.xiao

From: "haibiao.xiao" <xiaohaibiao331@outlook.com>

Command 'lvm version' works incorrect.
It is expected to print:

    # ./lvm version
    # kvm tool [KVMTOOLS_VERSION]

but the KVMTOOLS_VERSION is missed:

    # ./lvm version
    # kvm tool

The KVMTOOLS_VERSION is defined in the KVMTOOLS-VERSION-FILE file which
is included at the end of Makefile. Since the CFLAGS is a 'Simply
expanded variables' which means CFLAGS is only scanned once. So the
definetion of KVMTOOLS_VERSION at the end of Makefile would not scanned
by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.

I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE'
before the CFLAGS.

Signed-off-by: haibiao.xiao <xiaohaibiao331@outlook.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bb7ad3e..9afb5e3 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ export E Q
 
 include config/utilities.mak
 include config/feature-tests.mak
+-include $(OUTPUT)KVMTOOLS-VERSION-FILE
 
 CC	:= $(CROSS_COMPILE)gcc
 CFLAGS	:=
@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean)
 
 KVMTOOLS-VERSION-FILE:
 	@$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT)
--include $(OUTPUT)KVMTOOLS-VERSION-FILE
-endif
+endif
\ No newline at end of file
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH kvmtool] Makefile: 'lvm version' works incorrect. Because CFLAGS can not get sub-make variable $(KVMTOOLS_VERSION)
@ 2021-07-05  4:46 haibiao.xiao
  0 siblings, 0 replies; 9+ messages in thread
From: haibiao.xiao @ 2021-07-05  4:46 UTC (permalink / raw)
  To: kvm; +Cc: haibiao.xiao

From: "haibiao.xiao" <xiaohaibiao331@outlook.com>

Command 'lvm version' works incorrect.
It is expected to print:

    # ./lvm version
    # kvm tool [KVMTOOLS_VERSION]

but the KVMTOOLS_VERSION is missed:

    # ./lvm version
    # kvm tool

The KVMTOOLS_VERSION is defined in the KVMTOOLS-VERSION-FILE file which
is included at the end of Makefile. Since the CFLAGS is a 'Simply
expanded variables' which means CFLAGS is only scanned once. So the
definetion of KVMTOOLS_VERSION at the end of Makefile would not scanned
by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.

I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE'
before the CFLAGS.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bb7ad3e..9afb5e3 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ export E Q
 
 include config/utilities.mak
 include config/feature-tests.mak
+-include $(OUTPUT)KVMTOOLS-VERSION-FILE
 
 CC	:= $(CROSS_COMPILE)gcc
 CFLAGS	:=
@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean)
 
 KVMTOOLS-VERSION-FILE:
 	@$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT)
--include $(OUTPUT)KVMTOOLS-VERSION-FILE
-endif
+endif
\ No newline at end of file
-- 
2.30.2


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

end of thread, other threads:[~2021-12-13  3:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-04  6:14 [PATCH kvmtool] Makefile: 'lvm version' works incorrect. Because CFLAGS can not get sub-make variable $(KVMTOOLS_VERSION) haibiao.xiao
2021-12-08 16:38 ` Alexandru Elisei
2021-12-09  3:31   ` haibiao.xiao
2021-12-09 11:00     ` Alexandru Elisei
2021-12-09 15:57 ` Andre Przywara
2021-12-10  2:55   ` haibiao.xiao
2021-12-10 11:00     ` Andre Przywara
2021-12-13  3:19       ` haibiao.xiao
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05  4:46 haibiao.xiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox