From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 1/3] Makefile: clean auto-generated *.c files properly
Date: Tue, 23 Apr 2024 16:41:48 +0100 [thread overview]
Message-ID: <88d05469-2fd1-40df-b8bf-0fb6652ea76d@gmail.com> (raw)
In-Reply-To: <4ebdca94-8f4a-452f-9607-0029676b12b2@codethink.co.uk>
On 4/23/24 16:26, Ben Dooks wrote:
> On 23/04/2024 16:20, Ben Dooks wrote:
>> On 23/04/2024 15:58, Ivan Orlov wrote:
>>> On 4/22/24 16:19, Andrew Jones wrote:
>>>> On Mon, Apr 01, 2024 at 10:34:36PM +0100, Ivan Orlov wrote:
>>>>> Currently, `make clean` doesn't remove auto-generated .c files in the
>>>>> `build/` directory. It means that we don't have a reliable way of
>>>>> regenerating these files except from removing the `build/` directory
>>>>> manually.
>>>>>
>>>>> Update the `clean` target in order to remove these files as well.
>>>>>
>>>>> In the discussion of the "[PATCH v2 3/5] Makefile: clean '.c' files
>>>>> generated by carray", Andrew Jones <ajones@ventanamicro.com> suggested
>>>>> placing the auto-generated .c files into the `build/generated/`
>>>>> folder.
>>>>> However, I believe it may not be necessary as in fact all of the files
>>>>> in `build/` are auto-generated.
>>>>
>>>> Since the Makefile enforces that the build dir is not the same as the
>>>> source dir and the only C files we currently generate are carray files,
>>>> then OK. I still think it would be nice to be more specific about what
>>>> we clean, though.
>>>>
>>>
>>> Hi Andrew,
>>>
>>> Thank you very much for the review!
>>>
>>> I see a few approaches how we could make the CArray-generated files
>>> cleaning more clear. I believe we could either put all of the
>>> CArray-generated files into a subdirectory of `build/` (as you
>>> suggested) or add a suffix to a filename of an auto-generated .c file
>>> (for instance, sbi_unit_tests.carray -> sbi_unit_tests_carray.c, and
>>> the pattern for `make clean` would be like "rm -rf build/*_carray.c").
>>>
>>> The former would probably need significant update of the Makefile.
>>> The latter, on the other hand, seems more flaky... What do you think
>>> of that?
>>
>> I did a quick shell command to find all the object basenames, via:
>>
>> $ find . -type f -name "*.carray" | xargs grep NAME | cut -d ' ' -f 2
>> sbi_unit_tests
>> sbi_ecall_exts
>> fdt_irqchip_drivers
>> fdt_timer_drivers
>> fdt_serial_drivers
>> fdt_i2c_adapter_drivers
>> fdt_ipi_drivers
>> fdt_gpio_drivers
>> fdt_regmap_drivers
>> fdt_reset_drivers
>> platform_override_modules
>>
>> so doing:
>>
>> $ find . -type f -name "*.carray" | xargs grep NAME | cut -d ' ' -f 2
>> | sed? 's/$/.o/g'? | xargs -n1 find build -name
>> build/lib/sbi/sbi_ecall_exts.o
>> build/platform/generic/lib/utils/irqchip/fdt_irqchip_drivers.o
>> build/platform/generic/lib/utils/timer/fdt_timer_drivers.o
>> build/platform/generic/lib/utils/serial/fdt_serial_drivers.o
>> build/platform/generic/lib/utils/i2c/fdt_i2c_adapter_drivers.o
>> build/platform/generic/lib/utils/ipi/fdt_ipi_drivers.o
>> build/platform/generic/lib/utils/gpio/fdt_gpio_drivers.o
>> build/platform/generic/lib/utils/regmap/fdt_regmap_drivers.o
>> build/platform/generic/lib/utils/reset/fdt_reset_drivers.o
>> build/platform/generic/platform_override_modules.o
>>
>> finds all the carray build files
>
> of course, i meant? sed -e 's/$/.c/g' to find the .c files not their
> outputs which would have been removed anyway
>
Sounds like an another solution, thanks! I'm not sure if it should be
done now, though... There is a chance that it could make the Makefile
less readable. But it is definitely more clean than removing the
entirety of build/.c files
--
Kind regards,
Ivan Orlov
next prev parent reply other threads:[~2024-04-23 15:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 21:34 [PATCH 0/3] CArray improvements Ivan Orlov
2024-04-01 21:34 ` [PATCH 1/3] Makefile: clean auto-generated *.c files properly Ivan Orlov
2024-04-22 15:19 ` Andrew Jones
2024-04-23 14:58 ` Ivan Orlov
2024-04-23 15:15 ` Ben Dooks
2024-04-23 15:18 ` Andrew Jones
2024-04-23 15:20 ` Ben Dooks
2024-04-23 15:24 ` Ben Dooks
2024-04-23 15:26 ` Ben Dooks
2024-04-23 15:41 ` Ivan Orlov [this message]
2024-04-26 16:25 ` Ben Dooks
2024-04-29 8:52 ` Andrew Jones
2024-04-29 12:16 ` Ben Dooks
2024-04-29 13:11 ` Ben Dooks
2024-04-01 21:34 ` [PATCH 2/3] scripts/carray.sh: Add comment to generated files Ivan Orlov
2024-04-22 15:21 ` Andrew Jones
2024-04-23 15:25 ` Ben Dooks
2024-04-01 21:34 ` [PATCH 3/3] docs: writing tests: update cleaning instructions Ivan Orlov
2024-04-22 15:22 ` Andrew Jones
2024-05-07 6:06 ` [PATCH 0/3] CArray improvements Anup Patel
2024-05-10 15:56 ` Ivan Orlov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88d05469-2fd1-40df-b8bf-0fb6652ea76d@gmail.com \
--to=ivan.orlov0322@gmail.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox