[V14,02/10] build: use check-clean in root Makefile

Submitted by Wayne Xia on Jan. 23, 2013, 11:17 a.m.

Details

Message ID 1358939887-22533-3-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia Jan. 23, 2013, 11:17 a.m.
Now root Makefile simply calls the command and do not care
the details of it any more. $SUBDIR_CLEAN_RULES is used for the
case that a sub-dir's Makefile is included by root Makefile,
in which case 'clean' in subdir's Makefile will cause confict. So
If sub-dir's Makefile want to be cleaned, it should extend
$SUBDIR_CLEAN_RULES, just like tests/Makefile.

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

Comments

Paolo Bonzini Jan. 23, 2013, 11:32 a.m.
Il 23/01/2013 12:17, Wenchao Xia ha scritto:
>   Now root Makefile simply calls the command and do not care
> the details of it any more. $SUBDIR_CLEAN_RULES is used for the
> case that a sub-dir's Makefile is included by root Makefile,
> in which case 'clean' in subdir's Makefile will cause confict. So
> If sub-dir's Makefile want to be cleaned, it should extend
> $SUBDIR_CLEAN_RULES, just like tests/Makefile.
> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  Makefile |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 73adf42..69472b7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -210,7 +210,7 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
>  qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
>  	$(call LINK, $^)
>  
> -clean:
> +clean: $(SUBDIR_CLEAN_RULES)
>  # avoid old build problems by removing potentially incorrect old files
>  	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
>  	rm -f qemu-options.def
> @@ -226,7 +226,6 @@ clean:
>  	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
>  	rm -rf qapi-generated
>  	rm -rf qga/qapi-generated
> -	$(MAKE) -C tests/tcg clean
>  	for d in $(ALL_SUBDIRS); do \
>  	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
>  	rm -f $$d/qemu-options.def; \
> 

Just use "clean: check-clean" and squash this with patch 1.

Paolo
Wayne Xia Jan. 23, 2013, 11:35 a.m.
于 2013-1-23 19:32, Paolo Bonzini 写道:
> Il 23/01/2013 12:17, Wenchao Xia ha scritto:
>>    Now root Makefile simply calls the command and do not care
>> the details of it any more. $SUBDIR_CLEAN_RULES is used for the
>> case that a sub-dir's Makefile is included by root Makefile,
>> in which case 'clean' in subdir's Makefile will cause confict. So
>> If sub-dir's Makefile want to be cleaned, it should extend
>> $SUBDIR_CLEAN_RULES, just like tests/Makefile.
>>
>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>> ---
>>   Makefile |    3 +--
>>   1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 73adf42..69472b7 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -210,7 +210,7 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
>>   qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
>>   	$(call LINK, $^)
>>
>> -clean:
>> +clean: $(SUBDIR_CLEAN_RULES)
>>   # avoid old build problems by removing potentially incorrect old files
>>   	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
>>   	rm -f qemu-options.def
>> @@ -226,7 +226,6 @@ clean:
>>   	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
>>   	rm -rf qapi-generated
>>   	rm -rf qga/qapi-generated
>> -	$(MAKE) -C tests/tcg clean
>>   	for d in $(ALL_SUBDIRS); do \
>>   	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
>>   	rm -f $$d/qemu-options.def; \
>>
>
> Just use "clean: check-clean" and squash this with patch 1.
>
> Paolo
>
   That have a problem if test/Makefile is not included, which will
happen if make distclean is called once, then error will be shown
if make clean called again. It is also used by libqblock clean.
Paolo Bonzini Jan. 23, 2013, 11:43 a.m.
Il 23/01/2013 12:35, Wenchao Xia ha scritto:
>>>
>>
>> Just use "clean: check-clean" and squash this with patch 1.
>>
>> Paolo
>>
>   That have a problem if test/Makefile is not included, which will
> happen if make distclean is called once, then error will be shown
> if make clean called again. It is also used by libqblock clean.

You can put the dependency in tests/Makefile.

Paolo
Wayne Xia Jan. 24, 2013, 1:51 a.m.
于 2013-1-23 19:43, Paolo Bonzini 写道:
> Il 23/01/2013 12:35, Wenchao Xia ha scritto:
>>>>
>>>
>>> Just use "clean: check-clean" and squash this with patch 1.
>>>
>>> Paolo
>>>
>>    That have a problem if test/Makefile is not included, which will
>> happen if make distclean is called once, then error will be shown
>> if make clean called again. It is also used by libqblock clean.
>
> You can put the dependency in tests/Makefile.
>
> Paolo
>
   tests/Makefile would not be included, so it will directly fail.
Actually I use this variable as a bridge between root Makefile and
sub Makefile which would be included by root Makefile, just like
$TOOL. In this way root Makefile can stay unchanged when new subdir
is added, subdir's Makefile can add the step if it want been cleaned
automatically when "make clean" is called in root dir.
Paolo Bonzini Jan. 24, 2013, 8:27 a.m.
Il 24/01/2013 02:51, Wenchao Xia ha scritto:
>>
>> You can put the dependency in tests/Makefile.
>>
>> Paolo
>>
>   tests/Makefile would not be included, so it will directly fail.
> Actually I use this variable as a bridge between root Makefile and
> sub Makefile which would be included by root Makefile, just like
> $TOOL. In this way root Makefile can stay unchanged when new subdir
> is added, subdir's Makefile can add the step if it want been cleaned
> automatically when "make clean" is called in root dir.

What I mean is: add

    clean: check-unit

in tests/Makefile.  You don't need a variable as an intermediate step.

Paolo
Wayne Xia Jan. 25, 2013, 2:40 a.m.
于 2013-1-24 16:27, Paolo Bonzini 写道:
> Il 24/01/2013 02:51, Wenchao Xia ha scritto:
>>>
>>> You can put the dependency in tests/Makefile.
>>>
>>> Paolo
>>>
>>    tests/Makefile would not be included, so it will directly fail.
>> Actually I use this variable as a bridge between root Makefile and
>> sub Makefile which would be included by root Makefile, just like
>> $TOOL. In this way root Makefile can stay unchanged when new subdir
>> is added, subdir's Makefile can add the step if it want been cleaned
>> automatically when "make clean" is called in root dir.
>
> What I mean is: add
>
>      clean: check-unit
>
> in tests/Makefile.  You don't need a variable as an intermediate step.
>
> Paolo
>

OK, got your point, will fix.

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 73adf42..69472b7 100644
--- a/Makefile
+++ b/Makefile
@@ -210,7 +210,7 @@  $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
 qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
 	$(call LINK, $^)
 
-clean:
+clean: $(SUBDIR_CLEAN_RULES)
 # avoid old build problems by removing potentially incorrect old files
 	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 	rm -f qemu-options.def
@@ -226,7 +226,6 @@  clean:
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
-	$(MAKE) -C tests/tcg clean
 	for d in $(ALL_SUBDIRS); do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
 	rm -f $$d/qemu-options.def; \