Skip to contentSkip to conversation

Buildsystem fix

PATCH Superseded Wenchao Xia 4 participants 14 messages Nov 16, 2012 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Buildsystem fix

Following patch fix a problem and adjust build system, to make it more
modulized and easier to extend.

Wenchao Xia (2):
Buildsystem fix distclean error in pixman
Buildsystem clean tests directory clearly

 Makefile       |    7 +++++--
 configure      |    2 +-
 tests/Makefile |    7 +++++++
 3 files changed, 13 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/2 Buildsystem fix distclean error in pixman

Currently if pixman have no config.log inside, make file still
try to clean it resulting error. This patch fix it.

---
 Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Makefile +4 -1
index 81c660f..f40885b 100644
@@ -278,7 +278,10 @@ distclean: clean
 	for d in $(TARGET_DIRS) $(QEMULIBS); do \
 	rm -rf $$d || exit 1 ; \
         done
-	test -f pixman/config.log && make -C pixman distclean
+	@if test -f pixman/config.log; \
+	then \
+		make -C pixman distclean;\
+	fi
 
 KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv \
 ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
Signature · 1 line
1.7.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Makefile distclean: clean · line 284

Quoted 8 lines · Wenchao Xia

Currently if pixman have no config.log inside, make file still
try to clean it resulting error. This patch fix it.

Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi

These two bits of shellscript both do the same thing, don't they?

-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 10 lines · Peter Maydell

Makefile distclean: clean · line 284

Quoted 8 lines · Wenchao Xia

Currently if pixman have no config.log inside, make file still
try to clean it resulting error. This patch fix it.

Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 4 lines

These two bits of shellscript both do the same thing, don't they?

-- PMM

Looks the same, but on my machine
make -C pixman distclean
got executed resulting error, I guess that is what original author wants to avoid.
I'll conclude this patch into my libqblock patch serials to make
it easier to be reviwed.

Signature · 3 lines
Best Regards

Wenchao Xia
#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 8 lines · Wenchao Xia
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Wenchao Xia
Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 6 lines
Quoted 1 line

These two bits of shellscript both do the same thing, don't they?

Looks the same, but on my machine
make -C pixman distclean
got executed resulting error, I guess that is what original author wants to avoid.

If your shell executes Y in "X && Y" even if X fails, then your shell is badly badly broken. More likely, there is some other problem, and you need to find out what it is.
I don't think this patch should be applied, I'm afraid.

-- PMM

#5 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 16 lines · Peter Maydell
Quoted 8 lines · Wenchao Xia
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Wenchao Xia
Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 6 lines
Quoted 1 line

These two bits of shellscript both do the same thing, don't they?

Looks the same, but on my machine
make -C pixman distclean
got executed resulting error, I guess that is what original author wants to avoid.

Quoted 7 lines

If your shell executes Y in "X && Y" even if X fails, then your shell is badly badly broken. More likely, there is some other problem, and you need to find out what it is.
I don't think this patch should be applied, I'm afraid.

-- PMM

My shell is OK, I missed the error reporting source before,
in my test I think it is first part reporting error, that is "test -f pixman/config.log" directly report error.
This patch would eliminate this error.

Signature · 3 lines
Best Regards

Wenchao Xia
#6 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

In reply to Peter Maydell

Il 16/11/2012 10:27, Peter Maydell ha scritto:

Quoted 11 lines · Wenchao Xia

Makefile distclean: clean · line 284

Quoted 8 lines

Currently if pixman have no config.log inside, make file still
try to clean it resulting error. This patch fix it.

Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi

These two bits of shellscript both do the same thing, don't they?

No, when "test" fails the && exits with a failure. The "if" exits with a success (not the most portable thing ever, but we assume a decent shell elsewhere).

I think this patch is ok, but why the "@"?

#7 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 8 lines · Paolo Bonzini

Il 16/11/2012 10:27, Peter Maydell ha scritto:

Quoted 7 lines · Wenchao Xia
Quoted 5 lines
Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 5 lines
Quoted 1 line

These two bits of shellscript both do the same thing, don't they?

No, when "test" fails the && exits with a failure. The "if" exits with a success (not the most portable thing ever, but we assume a decent shell elsewhere).

Aha. I love shell. (This detail could usefully have been provided in the commit message...)

thanks
-- PMM

#8 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 9 lines · Peter Maydell
Quoted 8 lines · Paolo Bonzini

Il 16/11/2012 10:27, Peter Maydell ha scritto:

Quoted 7 lines · Wenchao Xia
Quoted 5 lines
Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

These two bits of shellscript both do the same thing, don't they?

No, when "test" fails the && exits with a failure. The "if" exits with a success (not the most portable thing ever, but we assume a decent shell elsewhere).

Aha. I love shell. (This detail could usefully have been provided in the commit message...)

Agree. Can I get a version with an updated commit message for the pixman patch queue?

thanks,
Gerd

#9 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

Quoted 16 lines · Gerd Hoffmann
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

Il 16/11/2012 10:27, Peter Maydell ha scritto:

Quoted 8 lines · Wenchao Xia

Makefile distclean: clean · line 284

Quoted 5 lines
Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi

These two bits of shellscript both do the same thing, don't they?

No, when "test" fails the && exits with a failure. The "if" exits with a success (not the most portable thing ever, but we assume a decent shell elsewhere).

Quoted 9 lines
Quoted 2 lines

Aha. I love shell. (This detail could usefully have been provided in the commit message...)

Agree. Can I get a version with an updated commit message for the pixman patch queue?

thanks,
Gerd

Sure,I'll resend according to more comments later.

Signature · 3 lines
Best Regards

Wenchao Xia
#10 lore raw

Re: [Qemu-devel] [PATCH 1/2] Buildsystem fix distclean error in pixman

In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini

Il 16/11/2012 10:27, Peter Maydell ha scritto:

Quoted 10 lines · Wenchao Xia
Quoted 8 lines

Currently if pixman have no config.log inside, make file still
try to clean it resulting error. This patch fix it.

Makefile +4 -1
-       test -f pixman/config.log && make -C pixman distclean
+       @if test -f pixman/config.log; \
+       then \
+               make -C pixman distclean;\
+       fi
Quoted 8 lines
Quoted 1 line

These two bits of shellscript both do the same thing, don't they?

No, when "test" fails the && exits with a failure. The "if" exits with a success (not the most portable thing ever, but we assume a decent shell elsewhere).

I think this patch is ok, but why the "@"?

print out seems ugly :|, maybe I should cancel @ and adjust the
format.

Signature · 3 lines
Best Regards

Wenchao Xia
#11 lore raw

PATCH 2/2 Buildsystem clean tests directory clearly

In reply to Wenchao Xia

Currently make clean only clean tests/tcg and hard to extend.
This patch added command make check-clean, which clean all generated files used in tests. With this command root Makefile do not care tests clean method any more, it simply calls the command to do it, so any more clean script could be added in tests/Makefile make it easier to extend.

---
 Makefile       |    2 +-
 configure      |    2 +-
 tests/Makefile |    7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)
Makefile +1 -1
index f40885b..8201e80 100644
@@ -251,7 +251,7 @@ clean:
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
-	$(MAKE) -C tests/tcg clean
+	MAKEFILES=./tests/Makefile $(MAKE) check-clean
 	for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
 	rm -f $$d/qemu-options.def; \
configure +1 -1
index f847ee2..a18e267 100755
@@ -4163,7 +4163,7 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
 DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS qapi-generated"
 DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
-FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
+FILES="Makefile tests/Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
tests/Makefile +7 -0
index 9bf0765..a286622 100644
@@ -94,6 +94,7 @@ check-help:
 	@echo " make check-unit           Run qobject tests"
 	@echo " make check-block          Run block tests"
 	@echo " make check-report.html    Generates an HTML test report"
+	@echo " make check-clean          Clean the tests"
 	@echo
 	@echo "Please note that HTML reports do not regenerate if the unit tests"
 	@echo "has not changed."
@@ -148,4 +149,10 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-unit check-qtest
 
+check-clean:
+	$(MAKE) -C tests/tcg clean
+	rm -f $(check-unit-y)
+	rm -f $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y)
+	rm -f tests/*.o
+
 -include $(wildcard tests/*.d)
Signature · 1 line
1.7.1
#12 lore raw

Re: [Qemu-devel] [PATCH 2/2] Buildsystem clean tests directory clearly

Il 16/11/2012 06:05, Wenchao Xia ha scritto:

Quoted 19 lines

Currently make clean only clean tests/tcg and hard to extend.
This patch added command make check-clean, which clean all generated files used in tests. With this command root Makefile do not care tests clean method any more, it simply calls the command to do it, so any more clean script could be added in tests/Makefile make it easier to extend.

---
 Makefile       |    2 +-
 configure      |    2 +-
 tests/Makefile |    7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)
Makefile +0 -0
index f40885b..8201e80 100644

Makefile clean: · line 254

Quoted 5 lines
Makefile +1 -1
@@ -251,7 +251,7 @@ clean:
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
-	$(MAKE) -C tests/tcg clean
+	MAKEFILES=./tests/Makefile $(MAKE) check-clean

What is MAKEFILES?

Paolo

Quoted 40 lines
Makefile +0 -0
 	for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
 	rm -f $$d/qemu-options.def; \
configure +1 -1
index f847ee2..a18e267 100755
@@ -4163,7 +4163,7 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
 DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS qapi-generated"
 DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
-FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
+FILES="Makefile tests/Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
tests/Makefile +7 -0
index 9bf0765..a286622 100644
@@ -94,6 +94,7 @@ check-help:
 	@echo " make check-unit           Run qobject tests"
 	@echo " make check-block          Run block tests"
 	@echo " make check-report.html    Generates an HTML test report"
+	@echo " make check-clean          Clean the tests"
 	@echo
 	@echo "Please note that HTML reports do not regenerate if the unit tests"
 	@echo "has not changed."
@@ -148,4 +149,10 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-unit check-qtest
 
+check-clean:
+	$(MAKE) -C tests/tcg clean
+	rm -f $(check-unit-y)
+	rm -f $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y)
+	rm -f tests/*.o
+
 -include $(wildcard tests/*.d)
#13 lore raw

Re: [Qemu-devel] [PATCH 2/2] Buildsystem clean tests directory clearly

Quoted 5 lines · Paolo Bonzini

Il 16/11/2012 06:05, Wenchao Xia ha scritto:

Makefile clean: · line 254

Quoted 2 lines
Makefile +1 -1
-     $(MAKE) -C tests/tcg clean
+     MAKEFILES=./tests/Makefile $(MAKE) check-clean

What is MAKEFILES?

make uses it as a list of additional makefiles to be read, as if they were 'include'd at the start of whatever makefile it actually reads. This is almost certainly not what is meant here, because this $(MAKE) invocation will reread the makefile we're currently executing, prepend tests/Makefile (gratuitously since our Makefile explicitly includes it anyway) and then invoke the check-clean target, which happens to work OK because tests/Makefile expects to be included rather than standalone.

If this roundabout approach is intentional and not accidental it needs a comment explaining why it's needed.

-- PMM