Updated carray and other build improvements
cover Updated carray and other build improvements
This is an updated series which deals with some build issues such as the carray file cleaning. This was originally submitted by Ivan Orlov and has been updated post various discussions about how to do this.
This series now renames the carray .c files to .carray.c so they can be found during cleaning and removed from the build directory. This seems to be easier than trying to look through all the make files for the carray code or to just remove all .c files in the build directory (which could also be a bit dangerous if someone left a .c file in there)
ML: https://lists.infradead.org/pipermail/opensbi/2024-April/006740.html
Github: https://github.com/bendooks/opensbi/tree/bjdooks/ivan-build3
Ben Dooks (2):
Makefile; change to using .carray.c for carray files
Makefile: remove any .carray.c during clean
Ivan Orlov (2):
scripts/carray.sh: Add comment to generated files
docs: writing tests: update cleaning instructions
Makefile | 8 +++++--- docs/writing_tests.md | 4 +--- 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 +- scripts/carray.sh | 1 + 14 files changed, 18 insertions(+), 17 deletions(-)
Signature · 1 line
2.37.2.352.g3c44437643
PATCH 1/4 scripts/carray.sh: Add comment to generated files
From: Ivan Orlov <[email protected]>
Add a comment about where auto-generated file came from to the carray.sh output. This should help avoiding confusion for the developers looking at the build artifacts and finding .c files there.
--- scripts/carray.sh | 1 + 1 file changed, 1 insertion(+)
scripts/carray.sh +1 -0
@@ -61,6 +61,7 @@ if [ -z "${ARRAY_NAME}" ]; then usage fi +printf "// Generated with $(basename $0) from $(basename ${CONFIG_FILE})\n" printf "#include <%s>\n\n" "${TYPE_HEADER}" for VAR in ${VAR_LIST}; do
Signature · 1 line
2.37.2.352.g3c44437643
Anup Patel
AppliedPATCH 1/4 scripts/carray.sh: Add comment to generated files
Quoted 10 lines · On Mon, Jul 1, 2024 at 7:57?PM Ben Dooks <[email protected]> wrote:
From: Ivan Orlov <[email protected]>
Add a comment about where auto-generated file came from to the
carray.shoutput. This should help avoiding confusion for the developers looking at the build artifacts and finding .c files there.Signed-off-by Ivan Orlov <[email protected]>Reviewed-by Andrew Jones <[email protected]>Signed-off-by Ben Dooks <[email protected]>
LGTM.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 24 lines
--- scripts/carray.sh | 1 + 1 file changed, 1 insertion(+)scripts/carray.sh +1
-1@@ -61,6 +61,7 @@ if [ -z "${ARRAY_NAME}" ]; then usage fi +printf "// Generated with $(basename $0) from $(basename ${CONFIG_FILE})\n" printf "#include <%s>\n\n" "${TYPE_HEADER}" for VAR in ${VAR_LIST}; do --2.37.2.352.g3c44437643
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 2/4 Makefile; change to using .carray.c for carray files
In reply to Ben DooksWe 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'
Suggested-bu: Andrew Jones <[email protected]>
--- 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(-)
Makefile +3 -3
@@ -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)
lib/sbi/objects.mk +1 -1
@@ -13,7 +13,7 @@ libsbi-objs-y += riscv_hardfp.o libsbi-objs-y += riscv_locks.o libsbi-objs-y += sbi_ecall.o -libsbi-objs-y += sbi_ecall_exts.o +libsbi-objs-y += sbi_ecall_exts.carray.o # The order of below extensions is performance optimized carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_TIME) += ecall_time
lib/sbi/tests/objects.mk +1 -1
@@ -1,5 +1,5 @@ libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_test.o -libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.o +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.carray.o carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.o
lib/utils/gpio/objects.mk +1 -1
@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio.o -libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.o +libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.carray.o carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_DESIGNWARE) += fdt_gpio_designware libsbiutils-objs-$(CONFIG_FDT_GPIO_DESIGNWARE) += gpio/fdt_gpio_designware.o
lib/utils/i2c/objects.mk +1 -1
@@ -10,7 +10,7 @@ libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o -libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o +libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.carray.o carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.o
lib/utils/ipi/objects.mk +1 -1
@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_IPI_MSWI) += ipi/aclint_mswi.o libsbiutils-objs-$(CONFIG_IPI_PLICSW) += ipi/andes_plicsw.o libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi.o -libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.carray.o carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_MSWI) += fdt_ipi_mswi libsbiutils-objs-$(CONFIG_FDT_IPI_MSWI) += ipi/fdt_ipi_mswi.o
lib/utils/irqchip/objects.mk +1 -1
@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip.o -libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.carray.o carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_APLIC) += fdt_irqchip_aplic libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_APLIC) += irqchip/fdt_irqchip_aplic.o
lib/utils/regmap/objects.mk +1 -1
@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap.o -libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.o +libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.carray.o carray-fdt_regmap_drivers-$(CONFIG_FDT_REGMAP_SYSCON) += fdt_regmap_syscon libsbiutils-objs-$(CONFIG_FDT_REGMAP_SYSCON) += regmap/fdt_regmap_syscon.o
lib/utils/reset/objects.mk +1 -1
@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o -libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o +libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.carray.o carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200 libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.o
lib/utils/serial/objects.mk +1 -1
@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o -libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o +libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.carray.o carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_CADENCE) += fdt_serial_cadence libsbiutils-objs-$(CONFIG_FDT_SERIAL_CADENCE) += serial/fdt_serial_cadence.o
lib/utils/timer/objects.mk +1 -1
@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_TIMER_MTIMER) += timer/aclint_mtimer.o libsbiutils-objs-$(CONFIG_TIMER_PLMT) += timer/andes_plmt.o libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer.o -libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.o +libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.carray.o carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_MTIMER) += fdt_timer_mtimer libsbiutils-objs-$(CONFIG_FDT_TIMER_MTIMER) += timer/fdt_timer_mtimer.o
platform/generic/objects.mk +1 -1
@@ -19,7 +19,7 @@ platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -m 256M \ # Objects to build platform-objs-y += platform.o -platform-objs-y += platform_override_modules.o +platform-objs-y += platform_override_modules.carray.o # Blobs to build FW_DYNAMIC=y
Signature · 1 line
2.37.2.352.g3c44437643
PATCH 2/4 Makefile; change to using .carray.c for carray files
Quoted 5 lines · Ben Dooks
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
Quoted 7 lines
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 -idirname fname/objects.mk -e s/"$fn".o/"$fn".carray.o/g'Link https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322 at gmail.com/Reported-by Ivan Orlov <[email protected]>Suggested-bu: Andrew Jones <[email protected]>
^ by
Quoted 191 lines
Signed-off-by Ben Dooks <[email protected]>--- 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(-)Makefile +3
-3@@ -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)lib/sbi/objects.mk +1
-1@@ -13,7 +13,7 @@ libsbi-objs-y += riscv_hardfp.o libsbi-objs-y += riscv_locks.o libsbi-objs-y += sbi_ecall.o -libsbi-objs-y += sbi_ecall_exts.o +libsbi-objs-y += sbi_ecall_exts.carray.o # The order of below extensions is performance optimized carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_TIME) += ecall_timelib/sbi/tests/objects.mk +1
-1@@ -1,5 +1,5 @@ libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_test.o -libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.o +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.carray.o carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.olib/utils/gpio/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio.o -libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.o +libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.carray.o carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_DESIGNWARE) += fdt_gpio_designware libsbiutils-objs-$(CONFIG_FDT_GPIO_DESIGNWARE) += gpio/fdt_gpio_designware.olib/utils/i2c/objects.mk +1
-1@@ -10,7 +10,7 @@ libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o -libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o +libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.carray.o carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.olib/utils/ipi/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_IPI_MSWI) += ipi/aclint_mswi.o libsbiutils-objs-$(CONFIG_IPI_PLICSW) += ipi/andes_plicsw.o libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi.o -libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.carray.o carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_MSWI) += fdt_ipi_mswi libsbiutils-objs-$(CONFIG_FDT_IPI_MSWI) += ipi/fdt_ipi_mswi.olib/utils/irqchip/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip.o -libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.carray.o carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_APLIC) += fdt_irqchip_aplic libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_APLIC) += irqchip/fdt_irqchip_aplic.olib/utils/regmap/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap.o -libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.o +libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.carray.o carray-fdt_regmap_drivers-$(CONFIG_FDT_REGMAP_SYSCON) += fdt_regmap_syscon libsbiutils-objs-$(CONFIG_FDT_REGMAP_SYSCON) += regmap/fdt_regmap_syscon.olib/utils/reset/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o -libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o +libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.carray.o carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200 libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.olib/utils/serial/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o -libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o +libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.carray.o carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_CADENCE) += fdt_serial_cadence libsbiutils-objs-$(CONFIG_FDT_SERIAL_CADENCE) += serial/fdt_serial_cadence.olib/utils/timer/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_TIMER_MTIMER) += timer/aclint_mtimer.o libsbiutils-objs-$(CONFIG_TIMER_PLMT) += timer/andes_plmt.o libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer.o -libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.o +libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.carray.o carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_MTIMER) += fdt_timer_mtimer libsbiutils-objs-$(CONFIG_FDT_TIMER_MTIMER) += timer/fdt_timer_mtimer.oplatform/generic/objects.mk +1
-1@@ -19,7 +19,7 @@ platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -m 256M \ # Objects to build platform-objs-y += platform.o -platform-objs-y += platform_override_modules.o +platform-objs-y += platform_override_modules.carray.o # Blobs to build FW_DYNAMIC=ySignature · 1 line
2.37.2.352.g3c44437643
Anup Patel
AppliedPATCH 2/4 Makefile; change to using .carray.c for carray files
In reply to Ben DooksQuoted 6 lines · On Mon, Jul 1, 2024 at 7:41?PM Ben Dooks <[email protected]> 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
Quoted 8 lines
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 -idirname fname/objects.mk -e s/"$fn".o/"$fn".carray.o/g'Link https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322 at gmail.com/Reported-by Ivan Orlov <[email protected]>Suggested-bu: Andrew Jones <[email protected]>
Signed-off-by Ben Dooks <[email protected]>
I have taken care of the typo pointed by Drew.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 195 lines
--- 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(-)Makefile +3
-3@@ -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)lib/sbi/objects.mk +1
-1@@ -13,7 +13,7 @@ libsbi-objs-y += riscv_hardfp.o libsbi-objs-y += riscv_locks.o libsbi-objs-y += sbi_ecall.o -libsbi-objs-y += sbi_ecall_exts.o +libsbi-objs-y += sbi_ecall_exts.carray.o # The order of below extensions is performance optimized carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_TIME) += ecall_timelib/sbi/tests/objects.mk +1
-1@@ -1,5 +1,5 @@ libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_test.o -libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.o +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.carray.o carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.olib/utils/gpio/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio.o -libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.o +libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.carray.o carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_DESIGNWARE) += fdt_gpio_designware libsbiutils-objs-$(CONFIG_FDT_GPIO_DESIGNWARE) += gpio/fdt_gpio_designware.olib/utils/i2c/objects.mk +1
-1@@ -10,7 +10,7 @@ libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o -libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o +libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.carray.o carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.olib/utils/ipi/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_IPI_MSWI) += ipi/aclint_mswi.o libsbiutils-objs-$(CONFIG_IPI_PLICSW) += ipi/andes_plicsw.o libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi.o -libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.carray.o carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_MSWI) += fdt_ipi_mswi libsbiutils-objs-$(CONFIG_FDT_IPI_MSWI) += ipi/fdt_ipi_mswi.olib/utils/irqchip/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip.o -libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.carray.o carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_APLIC) += fdt_irqchip_aplic libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_APLIC) += irqchip/fdt_irqchip_aplic.olib/utils/regmap/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap.o -libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.o +libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.carray.o carray-fdt_regmap_drivers-$(CONFIG_FDT_REGMAP_SYSCON) += fdt_regmap_syscon libsbiutils-objs-$(CONFIG_FDT_REGMAP_SYSCON) += regmap/fdt_regmap_syscon.olib/utils/reset/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o -libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o +libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.carray.o carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200 libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.olib/utils/serial/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o -libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o +libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.carray.o carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_CADENCE) += fdt_serial_cadence libsbiutils-objs-$(CONFIG_FDT_SERIAL_CADENCE) += serial/fdt_serial_cadence.olib/utils/timer/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_TIMER_MTIMER) += timer/aclint_mtimer.o libsbiutils-objs-$(CONFIG_TIMER_PLMT) += timer/andes_plmt.o libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer.o -libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.o +libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.carray.o carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_MTIMER) += fdt_timer_mtimer libsbiutils-objs-$(CONFIG_FDT_TIMER_MTIMER) += timer/fdt_timer_mtimer.oplatform/generic/objects.mk +1
-2@@ -19,7 +19,7 @@ platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -m 256M \ # Objects to build platform-objs-y += platform.o -platform-objs-y += platform_override_modules.o +platform-objs-y += platform_override_modules.carray.o # Blobs to build FW_DYNAMIC=y --2.37.2.352.g3c44437643
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 2/4 Makefile; change to using .carray.c for carray files
In reply to Ben DooksQuoted 52 lines · On Mon, Jul 1, 2024 at 7:41?PM Ben Dooks <[email protected]> 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 -idirname fname/objects.mk -e s/"$fn".o/"$fn".carray.o/g'Link https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322 at gmail.com/Reported-by Ivan Orlov <[email protected]>Suggested-bu: Andrew Jones <[email protected]>
Signed-off-by Ben Dooks <[email protected]>--- 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(-)Makefile +2
-2@@ -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)
Makefile $(platform_build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_AUTOHEADER) · line 596
Quoted 8 lines
Makefile +1
-1@@ -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:
Makefile +0 -2
@@ -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.
Regards,
Anup
Quoted 149 lines
lib/sbi/objects.mk +1
-1@@ -13,7 +13,7 @@ libsbi-objs-y += riscv_hardfp.o libsbi-objs-y += riscv_locks.o libsbi-objs-y += sbi_ecall.o -libsbi-objs-y += sbi_ecall_exts.o +libsbi-objs-y += sbi_ecall_exts.carray.o # The order of below extensions is performance optimized carray-sbi_ecall_exts-$(CONFIG_SBI_ECALL_TIME) += ecall_timelib/sbi/tests/objects.mk +1
-1@@ -1,5 +1,5 @@ libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_test.o -libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.o +libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_unit_tests.carray.o carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += bitmap_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_bitmap_test.olib/utils/gpio/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio.o -libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.o +libsbiutils-objs-$(CONFIG_FDT_GPIO) += gpio/fdt_gpio_drivers.carray.o carray-fdt_gpio_drivers-$(CONFIG_FDT_GPIO_DESIGNWARE) += fdt_gpio_designware libsbiutils-objs-$(CONFIG_FDT_GPIO_DESIGNWARE) += gpio/fdt_gpio_designware.olib/utils/i2c/objects.mk +1
-1@@ -10,7 +10,7 @@ libsbiutils-objs-$(CONFIG_I2C) += i2c/i2c.o libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c.o -libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.o +libsbiutils-objs-$(CONFIG_FDT_I2C) += i2c/fdt_i2c_adapter_drivers.carray.o carray-fdt_i2c_adapter_drivers-$(CONFIG_FDT_I2C_SIFIVE) += fdt_i2c_adapter_sifive libsbiutils-objs-$(CONFIG_FDT_I2C_SIFIVE) += i2c/fdt_i2c_sifive.olib/utils/ipi/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_IPI_MSWI) += ipi/aclint_mswi.o libsbiutils-objs-$(CONFIG_IPI_PLICSW) += ipi/andes_plicsw.o libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi.o -libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IPI) += ipi/fdt_ipi_drivers.carray.o carray-fdt_ipi_drivers-$(CONFIG_FDT_IPI_MSWI) += fdt_ipi_mswi libsbiutils-objs-$(CONFIG_FDT_IPI_MSWI) += ipi/fdt_ipi_mswi.olib/utils/irqchip/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip.o -libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.o +libsbiutils-objs-$(CONFIG_FDT_IRQCHIP) += irqchip/fdt_irqchip_drivers.carray.o carray-fdt_irqchip_drivers-$(CONFIG_FDT_IRQCHIP_APLIC) += fdt_irqchip_aplic libsbiutils-objs-$(CONFIG_FDT_IRQCHIP_APLIC) += irqchip/fdt_irqchip_aplic.olib/utils/regmap/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap.o -libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.o +libsbiutils-objs-$(CONFIG_FDT_REGMAP) += regmap/fdt_regmap_drivers.carray.o carray-fdt_regmap_drivers-$(CONFIG_FDT_REGMAP_SYSCON) += fdt_regmap_syscon libsbiutils-objs-$(CONFIG_FDT_REGMAP_SYSCON) += regmap/fdt_regmap_syscon.olib/utils/reset/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset.o -libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.o +libsbiutils-objs-$(CONFIG_FDT_RESET) += reset/fdt_reset_drivers.carray.o carray-fdt_reset_drivers-$(CONFIG_FDT_RESET_ATCWDT200) += fdt_reset_atcwdt200 libsbiutils-objs-$(CONFIG_FDT_RESET_ATCWDT200) += reset/fdt_reset_atcwdt200.olib/utils/serial/objects.mk +1
-1@@ -8,7 +8,7 @@ # libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial.o -libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.o +libsbiutils-objs-$(CONFIG_FDT_SERIAL) += serial/fdt_serial_drivers.carray.o carray-fdt_serial_drivers-$(CONFIG_FDT_SERIAL_CADENCE) += fdt_serial_cadence libsbiutils-objs-$(CONFIG_FDT_SERIAL_CADENCE) += serial/fdt_serial_cadence.olib/utils/timer/objects.mk +1
-1@@ -11,7 +11,7 @@ libsbiutils-objs-$(CONFIG_TIMER_MTIMER) += timer/aclint_mtimer.o libsbiutils-objs-$(CONFIG_TIMER_PLMT) += timer/andes_plmt.o libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer.o -libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.o +libsbiutils-objs-$(CONFIG_FDT_TIMER) += timer/fdt_timer_drivers.carray.o carray-fdt_timer_drivers-$(CONFIG_FDT_TIMER_MTIMER) += fdt_timer_mtimer libsbiutils-objs-$(CONFIG_FDT_TIMER_MTIMER) += timer/fdt_timer_mtimer.oplatform/generic/objects.mk +1
-2@@ -19,7 +19,7 @@ platform-runcmd = qemu-system-riscv$(PLATFORM_RISCV_XLEN) -M virt -m 256M \ # Objects to build platform-objs-y += platform.o -platform-objs-y += platform_override_modules.o +platform-objs-y += platform_override_modules.carray.o # Blobs to build FW_DYNAMIC=y --2.37.2.352.g3c44437643
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 2/4 Makefile; change to using .carray.c for carray files
Quoted 81 lines · Anup Patel
Quoted 52 lines · On Mon, Jul 1, 2024 at 7:41?PM Ben Dooks <[email protected]> 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 -idirname fname/objects.mk -e s/"$fn".o/"$fn".carray.o/g'Link https://patchwork.ozlabs.org/project/opensbi/patch/20240401213438.590209-2-ivan.orlov0322 at gmail.com/Reported-by Ivan Orlov <[email protected]>Suggested-bu: Andrew Jones <[email protected]>
Signed-off-by Ben Dooks <[email protected]>--- 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(-)Makefile +2
-2@@ -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)Makefile $(platform_build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_AUTOHEADER) · line 596
Quoted 8 lines
Makefile +1
-1@@ -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
Makefilealso needs the following change otherwise OpenSBI breaks:Makefile +1
-2@@ -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))"; \
Quoted 1 line
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.
Signature · 4 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html
PATCH 3/4 Makefile: remove any .carray.c during clean
In reply to Ben DooksNow we've renamed the carray output files to .carray.c we can now use find to remove them.
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)
Makefile +2 -0
@@ -687,6 +687,8 @@ clean: $(CMD_PREFIX)mkdir -p $(build_dir) $(if $(V), @echo " RM $(build_dir)/*.o") $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.carray.c") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.carray.c" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.a") $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.elf")
Signature · 1 line
2.37.2.352.g3c44437643
PATCH 3/4 Makefile: remove any .carray.c during clean
Quoted 24 lines · Ben Dooks
Now we've renamed the carray output files to
.carray.cwe can now use find to remove them.Signed-off-by Ben Dooks <[email protected]>--- Makefile | 2 ++ 1 file changed, 2 insertions(+)Makefile +2
-0@@ -687,6 +687,8 @@ clean: $(CMD_PREFIX)mkdir -p $(build_dir) $(if $(V), @echo " RM $(build_dir)/*.o") $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.carray.c") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.carray.c" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.a") $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.elf")Signature · 1 line
2.37.2.352.g3c44437643
PATCH 3/4 Makefile: remove any .carray.c during clean
Quoted 19 lines · Andrew Jones
Quoted 18 lines · Ben Dooks
Now we've renamed the carray output files to
.carray.cwe can now use find to remove them.Signed-off-by Ben Dooks <[email protected]>--- Makefile | 2 ++ 1 file changed, 2 insertions(+)Makefile +2
-0@@ -687,6 +687,8 @@ clean: $(CMD_PREFIX)mkdir -p $(build_dir) $(if $(V), @echo " RM $(build_dir)/*.o") $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.carray.c") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.carray.c" -exec rm -rf {} +
Quoted 8 lines
Quoted 6 lines
Makefile +0
-0$(if $(V), @echo " RM $(build_dir)/*.a") $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.elf")Signature · 1 line
2.37.2.352.g3c44437643Reviewed-by Andrew Jones <[email protected]>
Thanks, given the minor typo fix and adding reviewed-by, shall I sort those and issue a pull request against opensbi github?
Signature · 4 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html
Anup Patel
AppliedPATCH 3/4 Makefile: remove any .carray.c during clean
In reply to Ben DooksQuoted 5 lines · On Mon, Jul 1, 2024 at 7:57?PM Ben Dooks <[email protected]> wrote:
Now we've renamed the carray output files to
.carray.cwe can now use find to remove them.Signed-off-by Ben Dooks <[email protected]>
LGTM.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 25 lines
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)Makefile +2
-1@@ -687,6 +687,8 @@ clean: $(CMD_PREFIX)mkdir -p $(build_dir) $(if $(V), @echo " RM $(build_dir)/*.o") $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.carray.c") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.carray.c" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.a") $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.elf") --2.37.2.352.g3c44437643
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 4/4 docs: writing tests: update cleaning instructions
In reply to Ben DooksFrom: Ivan Orlov <[email protected]>
After the changes introduced by the previous patches are applied, there is no need of the manual removal of the build/ directory every time new test is added. Running make clean should be enough to regenerate the carray-related files.
Update the documentation correspondingly.
--- docs/writing_tests.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
docs/writing_tests.md +1 -3
@@ -57,9 +57,7 @@ carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += string_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_string_test.o ``` -If you compiled OpenSBI with CONFIG_SBIUNIT enabled before, you may need to -manually remove the build folder in order to regenerate the carray files: -`rm -rf build/`. +Now, run `make clean` in order to regenerate the carray-related files. Recompile OpenSBI with the CONFIG_SBIUNIT option enabled and run it in QEMU. You will see something like this:
Signature · 1 line
2.37.2.352.g3c44437643
Anup Patel
AppliedPATCH 4/4 docs: writing tests: update cleaning instructions
Quoted 8 lines · On Mon, Jul 1, 2024 at 7:41?PM Ben Dooks <[email protected]> wrote:
From: Ivan Orlov <[email protected]>
After the changes introduced by the previous patches are applied, there is no need of the manual removal of the
build/directory every time new test is added. Runningmake cleanshould be enough to regenerate the carray-related files.
Quoted 5 lines
Update the documentation correspondingly.
Signed-off-by Ivan Orlov <[email protected]>Reviewed-by Andrew Jones <[email protected]>Signed-off-by Ben Dooks <[email protected]>
LGTM.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 27 lines
--- docs/writing_tests.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)docs/writing_tests.md +1
-4@@ -57,9 +57,7 @@ carray-sbi_unit_tests-$(CONFIG_SBIUNIT) += string_test_suite libsbi-objs-$(CONFIG_SBIUNIT) += tests/sbi_string_test.o ``` -If you compiled OpenSBI with CONFIG_SBIUNIT enabled before, you may need to -manually remove the build folder in order to regenerate the carray files: -`rm -rf build/`. +Now, run `make clean` in order to regenerate the carray-related files. Recompile OpenSBI with the CONFIG_SBIUNIT option enabled and run it in QEMU. You will see something like this: --2.37.2.352.g3c44437643
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
cover Updated carray and other build improvements
In reply to Ben DooksQuoted 4 lines · Ben Dooks
This is an updated series which deals with some build issues such as the carray file cleaning. This was originally submitted by Ivan Orlov and has been updated post various discussions about how to do this.
Quoted 8 lines
This series now renames the carray .c files to
.carray.cso they can be found during cleaning and removed from the build directory. This seems to be easier than trying to look through all the make files for the carray code or to just remove all .c files in the build directory (which could also be a bit dangerous if someone left a .c file in there)ML: https://lists.infradead.org/pipermail/opensbi/2024-April/006740.html
Github: https://github.com/bendooks/opensbi/tree/bjdooks/ivan-build3
New branch and merge request at:
https://github.com/bjdooks-ct/opensbi/tree/bjdooks/ivan-build3-fix1
https://github.com/riscv-software-src/opensbi/pull/360
Quoted 24 lines
Ben Dooks (2):
Makefile; change to using.carray.cfor carray files
Makefile: remove any.carray.cduring cleanIvan Orlov (2):
scripts/carray.sh: Add comment to generated files
docs: writing tests: update cleaning instructionsMakefile | 8 +++++--- docs/writing_tests.md | 4 +--- 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 +- scripts/carray.sh | 1 + 14 files changed, 18 insertions(+), 17 deletions(-)
Signature · 4 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html