diff mbox

[2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

Message ID b39e21f8c47318d82be999aae310bdf6bcfc9bb9.1492815938.git.shuahkh@osg.samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Shuah Khan April 21, 2017, 11:14 p.m. UTC
Define CLEAN macro to allow Makefiles to override common clean target
in lib.mk. This will help fix the following failures:

warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/lib.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michael Ellerman April 22, 2017, 5:38 a.m. UTC | #1
Shuah Khan <shuahkh@osg.samsung.com> writes:

> Define CLEAN macro to allow Makefiles to override common clean target
> in lib.mk. This will help fix the following failures:
>
> warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>

Should probably have:

Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target")


In hindsight I'm not sure moving the clean target into lib.mk was
the best idea, but anyway it's a bit late to change our mind on that.

This patch is a good solution to fix the warnings.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers
David Laight April 24, 2017, 3:45 p.m. UTC | #2
From: Shuah Khan
> Sent: 22 April 2017 00:15
> Define CLEAN macro to allow Makefiles to override common clean target
> in lib.mk. This will help fix the following failures:
> 
> warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/testing/selftests/lib.mk | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 775c589..959273c 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -51,8 +51,12 @@ endef
>  emit_tests:
>  	$(EMIT_TESTS)
> 
> -clean:
> +define CLEAN
>  	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
> +endef
> +
> +clean:
> +	$(CLEAN)

If might be easier to do something like:

ifneq($(NO_CLEAN),y)
clean:
	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
endif

	David
shuah April 24, 2017, 7:46 p.m. UTC | #3
On 04/24/2017 09:45 AM, David Laight wrote:
> From: Shuah Khan
>> Sent: 22 April 2017 00:15
>> Define CLEAN macro to allow Makefiles to override common clean target
>> in lib.mk. This will help fix the following failures:
>>
>> warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/lib.mk | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
>> index 775c589..959273c 100644
>> --- a/tools/testing/selftests/lib.mk
>> +++ b/tools/testing/selftests/lib.mk
>> @@ -51,8 +51,12 @@ endef
>>  emit_tests:
>>  	$(EMIT_TESTS)
>>
>> -clean:
>> +define CLEAN
>>  	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
>> +endef
>> +
>> +clean:
>> +	$(CLEAN)
> 
> If might be easier to do something like:
> 
> ifneq($(NO_CLEAN),y)
> clean:
> 	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
> endif
> 
> 	David
> 

I am not sure that it is easier. Defining a macro would work well
in this case to override and also works well with what we are doing
for other overrides we already have such as EMIT_TESTS.

thanks,
-- Shuah
Shuah Khan April 25, 2017, 1:36 p.m. UTC | #4
On 04/21/2017 11:38 PM, Michael Ellerman wrote:
> Shuah Khan <shuahkh@osg.samsung.com> writes:
> 
>> Define CLEAN macro to allow Makefiles to override common clean target
>> in lib.mk. This will help fix the following failures:
>>
>> warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> 
> Should probably have:
> 
> Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target")

Amended the change log to add the above.

> 
> 
> In hindsight I'm not sure moving the clean target into lib.mk was
> the best idea, but anyway it's a bit late to change our mind on that.

Yeah. Moving clean target to lib.mk ended up to be problematic. However,
there are some advantages as well. It will simplify some Makefiles. One
thing that was missed was that not finding the Makefiles that require
overrides. Anyway live and learn.

> 
> This patch is a good solution to fix the warnings.
> 
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> 

Thanks. I plan to apply the patch with the amended changelog and your
Ack. Please let me know if you want to see v2 with the change sent out.

thanks,
-- Shuah
Michael Ellerman April 26, 2017, 10:55 a.m. UTC | #5
Shuah Khan <shuahkh@osg.samsung.com> writes:
> On 04/21/2017 11:38 PM, Michael Ellerman wrote:
>> Shuah Khan <shuahkh@osg.samsung.com> writes:

>> This patch is a good solution to fix the warnings.
>> 
>> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
>
> Thanks. I plan to apply the patch with the amended changelog and your
> Ack. Please let me know if you want to see v2 with the change sent out.

I don't really mind if you send it or not.

cheers
diff mbox

Patch

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 775c589..959273c 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -51,8 +51,12 @@  endef
 emit_tests:
 	$(EMIT_TESTS)
 
-clean:
+define CLEAN
 	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
+endef
+
+clean:
+	$(CLEAN)
 
 $(OUTPUT)/%:%.c
 	$(LINK.c) $^ $(LDLIBS) -o $@