[2/2] images/Makefile: sanitize cleaning

Submitted by Kir Kolyshkin on Feb. 8, 2017, 5:06 a.m.

Details

Message ID 20170208050656.27571-3-kir@openvz.org
State New
Series "Add gcov files to 'make clean'"
Headers show

Commit Message

Kir Kolyshkin Feb. 8, 2017, 5:06 a.m.
Instead of removing everything by means of a few wildcards,
let's properly generate the file names to be removed.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
---
 images/Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/images/Makefile b/images/Makefile
index 86a7a01..e37d988 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -105,6 +105,7 @@  $(obj)/%.o: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
 $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
 	$(E) "  LINK    " $@
 	$(Q) $(LD) $(ldflags-y) -r -o $@ $^
+clean-y += $(obj)/built-in.o
 
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),mrproper)
@@ -112,9 +113,7 @@  ifneq ($(MAKECMDGOALS),mrproper)
 endif
 endif
 
-mrproper-y += $(obj)/*.pb-c.c $(obj)/*.pb-c.h
-cleanup-y += $(obj)/*.o $(obj)/*.d $(obj)/*.s $(obj)/*.i
-cleanup-y += $(obj)/google/protobuf/*.d
-cleanup-y += $(obj)/google/protobuf/*.h
-cleanup-y += $(obj)/google/protobuf/*.c
-cleanup-y += $(obj)/google/protobuf/*.o
+cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y)))
+cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.o)))
+mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.c))
+mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.h))

Comments

Dmitry Safonov Feb. 8, 2017, 12:20 p.m.
2017-02-08 8:06 GMT+03:00 Kir Kolyshkin <kir@openvz.org>:
> Instead of removing everything by means of a few wildcards,
> let's properly generate the file names to be removed.
>
> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
> ---
>  images/Makefile | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/images/Makefile b/images/Makefile
> index 86a7a01..e37d988 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -105,6 +105,7 @@ $(obj)/%.o: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
>  $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
>         $(E) "  LINK    " $@
>         $(Q) $(LD) $(ldflags-y) -r -o $@ $^
> +clean-y += $(obj)/built-in.o

A typo:
cleanup-y += ..
And Travis tests fail cause of this.

>
>  ifneq ($(MAKECMDGOALS),clean)
>  ifneq ($(MAKECMDGOALS),mrproper)
> @@ -112,9 +113,7 @@ ifneq ($(MAKECMDGOALS),mrproper)
>  endif
>  endif
>
> -mrproper-y += $(obj)/*.pb-c.c $(obj)/*.pb-c.h
> -cleanup-y += $(obj)/*.o $(obj)/*.d $(obj)/*.s $(obj)/*.i
> -cleanup-y += $(obj)/google/protobuf/*.d
> -cleanup-y += $(obj)/google/protobuf/*.h
> -cleanup-y += $(obj)/google/protobuf/*.c
> -cleanup-y += $(obj)/google/protobuf/*.o
> +cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y)))
> +cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.o)))
> +mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.c))
> +mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.h))
> --
> 2.9.3
Kir Kolyshkin Feb. 8, 2017, 5:10 p.m.
On 02/08/2017 04:20 AM, Dmitry Safonov wrote:
> 2017-02-08 8:06 GMT+03:00 Kir Kolyshkin <kir@openvz.org>:
>> Instead of removing everything by means of a few wildcards,
>> let's properly generate the file names to be removed.
>>
>> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
>> ---
>>   images/Makefile | 11 +++++------
>>   1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/images/Makefile b/images/Makefile
>> index 86a7a01..e37d988 100644
>> --- a/images/Makefile
>> +++ b/images/Makefile
>> @@ -105,6 +105,7 @@ $(obj)/%.o: $(obj)/%.pb-c.c $(obj)/%.pb-c.h
>>   $(obj)/built-in.o: $(addprefix $(obj)/,$(proto-obj-y))
>>          $(E) "  LINK    " $@
>>          $(Q) $(LD) $(ldflags-y) -r -o $@ $^
>> +clean-y += $(obj)/built-in.o
> A typo:
> cleanup-y += ..
> And Travis tests fail cause of this.

right, I must have fixed it but forgot to commit. will resend
>
>>   ifneq ($(MAKECMDGOALS),clean)
>>   ifneq ($(MAKECMDGOALS),mrproper)
>> @@ -112,9 +113,7 @@ ifneq ($(MAKECMDGOALS),mrproper)
>>   endif
>>   endif
>>
>> -mrproper-y += $(obj)/*.pb-c.c $(obj)/*.pb-c.h
>> -cleanup-y += $(obj)/*.o $(obj)/*.d $(obj)/*.s $(obj)/*.i
>> -cleanup-y += $(obj)/google/protobuf/*.d
>> -cleanup-y += $(obj)/google/protobuf/*.h
>> -cleanup-y += $(obj)/google/protobuf/*.c
>> -cleanup-y += $(obj)/google/protobuf/*.o
>> +cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y)))
>> +cleanup-y += $(call cleanify,$(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.o)))
>> +mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.c))
>> +mrproper-y += $(addprefix $(obj)/,$(proto-obj-y:.o=.pb-c.h))
>> --
>> 2.9.3