Re: [PATCH V2] docs: rust: Clarify that 'rustup override' applies to build directory

From: Masahiro Yamada
Date: Mon Dec 18 2023 - 07:07:12 EST


On Fri, Dec 15, 2023 at 8:53 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Fri, Dec 15, 2023 at 12:24 PM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> >
> > I thought people aren't required to enter the build directory now (but
> > just source code directory) and simply do:
> >
> > make LLVM=1 O=<builddir> rustupoverride
>
> Yeah, that is correct, but we don't need to write the `O=` in the
> commands themselves. The idea is that 1) the commands can be easily
> copy-pasted, 2) commands look simple (i.e. there are many other
> variations and options you may pass), 3) newcomers do not need to care
> about `O=` (so it is extra simple for them).
>
> > Will this still work if we are in the build directory ?
>
> Both should work (as long as the initial setup in the build folder is
> done, of course), so I think we can simply remove the mention about
> "enter ..." now and simply give the command.
>
> In fact, even if Kbuild did not support that, we could still remove
> the "enter ...", because then the `make` would need to be run like any
> other target from the source tree.



FWIW.

Kbuild is designed to be able to initiate 'make' from anywhere,
even if the build directory is not set up.

In that case, you need to use -f option to point to the top Makefile.



You can enter a build directory, then do this:

$ make -f <path/to/source/tree>/Makefile defconfig all




Likewise, both of the following should work.


1) Enter the source directory, and

$ make O=<path-to-build-directory> rustupoverride


2) Enter the build directory, and


$ make -f <path-to-source-directory>/Makefile rustupoverride






> In other words, regardless of the
> answer, we could remove it thanks to the new target, unless I am
> missing something.
>
> Cheers,
> Miguel
>


--
Best Regards
Masahiro Yamada