[PATCH v2 3/5] Makefile: clean '.c' files generated by carray

Andrew Jones ajones at ventanamicro.com
Wed Feb 28 08:32:52 PST 2024


On Wed, Feb 28, 2024 at 04:18:28PM +0000, Ivan Orlov wrote:
> On 2/28/24 14:23, Andrew Jones wrote:
> > On Thu, Feb 15, 2024 at 04:16:23PM +0000, Ivan Orlov wrote:
> > > `make clean` doesn't clear the '*.c' files generated by carray.sh
> > > in the 'build' directory. Fix it by extending the 'clean' makefile
> > > target.
> > > 
> > > This is the only way we are able to regenerate the carray .c file in
> > > case if we add a new test to the 'carray-sbi_unit_tests-y' Makefile
> > > variable. However, running `make clear` every time we add a new test
> > > is not really convenient, so the mechanics should be changed in the
> > > future.
> > > 
> > > Signed-off-by: Ivan Orlov <ivan.orlov0322 at gmail.com>
> > > ---
> > >   Makefile | 2 ++
> > >   1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index 680c19a..4519277 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -684,6 +684,8 @@ clean:
> > >   	$(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} +
> > >   	$(if $(V), @echo " RM        $(build_dir)/*.dtb")
> > >   	$(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} +
> > > +	$(if $(V), @echo " RM        $(build_dir)/*.c")
> > > +	$(CMD_PREFIX)find $(build_dir) -type f -name "*.c" -exec rm -rf {} +
> > 
> > I realize these *.c files are in $build_dir, so they're supposed to be
> > generated files, but it still looks scary to remove source files. I
> > think we should try to be more specific. Maybe we should put all generated
> > source files in directories named 'generated' or something and then only
> > remove files in those directories.
> > 
> 
> Hmm, maybe it would be better to do this in the separate patch series? I was
> thinking about upgrading carrays in general: now the generated .c files
> don't get updated when we change the corresponding Makefile variable. It
> produces inconvenience and these variables should be tracked somehow.

Yes, a separate series is a good idea. For this series, I'd just make the
new carrays behave like the rest, even if that behavior isn't ideal.

Thanks,
drew

> 
> For instance, we could possibly move the carray entries to the separate
> files instead of keeping them in the Makefile variables: this way they will
> be tracked by 'make'.
> 
> -- 
> Kind regards,
> Ivan Orlov
> 



More information about the opensbi mailing list