[PATCH 2/4] Makefile; change to using .carray.c for carray files

Ben Dooks ben.dooks at codethink.co.uk
Thu Jul 4 03:15:47 PDT 2024


On 04/07/2024 07:43, Anup Patel wrote:
> On Mon, Jul 1, 2024 at 7:41 PM Ben Dooks <ben.dooks at codethink.co.uk> wrote:
>>
>> We would like to clean any files generated by the carray
>> scripts by just searching for the filename as the current
>> make system turns f.carray into f.o. Change to make the
>> make system turn f.carray into f.carray.o
>>
>> note, command to go through .mk files changing the .o
>> in the .mk files is:
>> find . -type f -name "*.carray" | xargs -t -I fname /bin/bash -x -c ' fn=`basename -s .carray fname`; echo "$fn"; sed -i `dirname fname `/objects.mk -e s/"$fn".o/"$fn".carray.o/g'
>>
>> Link: https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322@gmail.com/
>> Reported-by: Ivan Orlov <ivan.orlov0322 at gmail.com>
>> Suggested-bu: Andrew Jones <ajones at ventanamicro.com>
>> Signed-off-by: Ben Dooks <ben.dooks at codethink.co.uk>
>> ---
>>   Makefile                     | 6 +++---
>>   lib/sbi/objects.mk           | 2 +-
>>   lib/sbi/tests/objects.mk     | 2 +-
>>   lib/utils/gpio/objects.mk    | 2 +-
>>   lib/utils/i2c/objects.mk     | 2 +-
>>   lib/utils/ipi/objects.mk     | 2 +-
>>   lib/utils/irqchip/objects.mk | 2 +-
>>   lib/utils/regmap/objects.mk  | 2 +-
>>   lib/utils/reset/objects.mk   | 2 +-
>>   lib/utils/serial/objects.mk  | 2 +-
>>   lib/utils/timer/objects.mk   | 2 +-
>>   platform/generic/objects.mk  | 2 +-
>>   12 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 7df39b4..2d964ec 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -519,7 +519,7 @@ $(build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_AUTOHEADER)
>>          $(call compile_gen_dep,$@,.c,$< $(KCONFIG_AUTOHEADER))
>>          $(call compile_gen_dep,$@,.o,$(@:.dep=.c))
>>
>> -$(build_dir)/%.c: $(src_dir)/%.carray
>> +$(build_dir)/%.carray.c: $(src_dir)/%.carray
>>          $(call compile_carray,$@,$<)
>>
>>   $(build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_AUTOHEADER)
>> @@ -547,7 +547,7 @@ $(platform_build_dir)/%.dep: $(platform_src_dir)/%.carray $(KCONFIG_AUTOHEADER)
>>          $(call compile_gen_dep,$@,.c,$< $(KCONFIG_AUTOHEADER))
>>          $(call compile_gen_dep,$@,.o,$(@:.dep=.c))
>>
>> -$(platform_build_dir)/%.c: $(platform_src_dir)/%.carray
>> +$(platform_build_dir)/%.carray.c: $(platform_src_dir)/%.carray
>>          $(call compile_carray,$@,$<)
>>
>>   $(platform_build_dir)/%.dep: $(platform_src_dir)/%.c $(KCONFIG_AUTOHEADER)
>> @@ -590,7 +590,7 @@ $(platform_build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_AUTOHEADER)
>>          $(call compile_gen_dep,$@,.c,$< $(KCONFIG_AUTOHEADER))
>>          $(call compile_gen_dep,$@,.o,$(@:.dep=.c))
>>
>> -$(platform_build_dir)/%.c: $(src_dir)/%.carray
>> +$(platform_build_dir)/%.carray.c: $(src_dir)/%.carray
>>          $(call compile_carray,$@,$<)
>>
>>   $(platform_build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_AUTOHEADER)
> 
> The top-level Makefile also needs the following change otherwise OpenSBI breaks:
> 
> diff --git a/Makefile b/Makefile
> index 2d964ec..55523b1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -489,7 +489,7 @@ compile_d2c = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
>               $(src_dir)/scripts/d2c.sh -i $(6) -a $(D2C_ALIGN_BYTES)
> -p $(D2C_NAME_PREFIX) -t $(D2C_PADDING_BYTES) > $(1)
>   compile_carray = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
>               echo " CARRAY    $(subst $(build_dir)/,,$(1))"; \
> -            $(eval CARRAY_VAR_LIST := $(carray-$(subst .c,,$(shell
> basename $(1)))-y)) \
> +            $(eval CARRAY_VAR_LIST := $(carray-$(subst
> .carray.c,,$(shell basename $(1)))-y)) \
>               $(src_dir)/scripts/carray.sh -i $(2) -l "$(CARRAY_VAR_LIST)" > $(1)
>   compile_gen_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
>               echo " GEN-DEP   $(subst $(build_dir)/,,$(1))"; \
> 
> I have squashed the above change in this patch and pushed it again.

Thank you.

I didn't see any issues without this, so not sure whether I didn't clean
properly or something else was going on.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html




More information about the opensbi mailing list