From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Date: Tue, 23 Apr 2024 17:18:05 +0200 Subject: [PATCH 1/3] Makefile: clean auto-generated *.c files properly In-Reply-To: <420f589f-78d2-4f16-a0ae-850488b5279c@gmail.com> References: <20240401213438.590209-1-ivan.orlov0322@gmail.com> <20240401213438.590209-2-ivan.orlov0322@gmail.com> <20240422-57f6d7d8e00b7b11cf364cb1@orel> <420f589f-78d2-4f16-a0ae-850488b5279c@gmail.com> Message-ID: <20240423-f4f8660d5f1d58450bf43e2a@orel> List-Id: To: opensbi@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tue, Apr 23, 2024 at 03:58:26PM +0100, 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 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? The filename change idea crossed my mind, but, when I saw we currently don't generate any other types of C files, I didn't think it'd be worth the churn [yet]. Thanks, drew