Re: [PATCH v1 1/1] scripts/tags.sh: Fix gtags generation for O= kernel builds

Masahiro Yamada
2023-05-05T05:14:24Z

On Fri, May 5, 2023 at 12:00 AM Ahmed S. Darwish <darwi@linutronix.de> wrote:
>
> Hi Nathan,
>
> On Thu, 04 May 2023, Nathan Chancellor wrote:
> >
> > On Thu, May 04, 2023 at 10:18:33PM +0200, Ahmed S. Darwish wrote:
> ...
> > > + suffixparams=
> > > + if [ -v O ]; then
> >
> > I think
> >
> > if [ -n "$O" ]; then
> >
> > would match the style preferred by Kbuild (though that is usually for
> > portability sake, which probably does not matter here since bash is
> > explicitly requested). Perhaps not worth addressing if there is no other
> > reason for a v2.
> >
>
> Thanks, I'll do it. I've just discovered that a v2 is necessary anyway.
>
> If O= has a "~", for example as in:
>
> make O=~/build/ gtags
>
> the snippet below:
>
> > > + suffixparams="-C $tree $O"
> > > + fi
> > > + all_target_sources | gtags -i -f - $suffixparams
> ^
> will fail since the "~" in the O= directory path won't get dereferenced
> before getting passed to the gtags call (an eval is needed).
>
> I'll submit a v2 shortly.
>
> Kind regards,
>
> --
> Ahmed S. Darwish
> Linutronix GmbH

It is wrong to check whether you are building out of the
source tree. See line 159 of the Makefile.

BTW, this patch does not work for me.
It spits a ton of "not found" warnings, then generates
empty tags.

$ make O=build gtags
make[1]: Entering directory '/home/masahiro/ref/linux/build'
GEN gtags
Warning: '../arch/x86/include/asm/vmalloc.h' not found. ignored.
Warning: '../arch/x86/include/asm/pgtable-3level_types.h' not found. ignored.
Warning: '../arch/x86/include/asm/paravirt.h' not found. ignored.
Warning: '../arch/x86/include/asm/text-patching.h' not found. ignored.
Warning: '../arch/x86/include/asm/softirq_stack.h' not found. ignored.
Warning: '../arch/x86/include/asm/intel_ds.h' not found. ignored.
Warning: '../arch/x86/include/asm/resctrl.h' not found. ignored.
Warning: '../arch/x86/include/asm/setup_arch.h' not found. ignored.
Warning: '../arch/x86/include/asm/simd.h' not found. ignored.
Warning: '../arch/x86/include/asm/mmconfig.h' not found. ignored.
Warning: '../arch/x86/include/asm/pgtable_types.h' not found. ignored.
Warning: '../arch/x86/include/asm/mem_encrypt.h' not found. ignored.
Warning: '../arch/x86/include/asm/dmi.h' not found. ignored.
Warning: '../arch/x86/include/asm/thermal.h' not found. ignored.

...

--
Best Regards
Masahiro Yamada