Re: [PATCH 3/4] nsdeps: remove stale .ns_deps files before generating new ones

Masahiro Yamada
2019-10-29T10:45:52Z

On Tue, Oct 29, 2019 at 12:14 AM Jessica Yu <jeyu@kernel.org> wrote:
>
> When adding or removing namespaces, calling `make` does not necessarily
> remove existing stale .ns_deps files. That is, one could remove a
> namespace, call make, and while modpost writes the correct, new .ns_deps
> files, stale ones are not removed from the source tree, thus producing
> incorrect results when running `make nsdeps`, i.e., inserting
> MODULE_IMPORT_NS() statements for namespaces that have been removed.
> Clean up old .ns_deps files before generating new ones with modpost.

Hmm, correct.

But, removing *.ns_deps every time is not an elegant solution.

I want to try a different approach.

>
> Signed-off-by: Jessica Yu <jeyu@kernel.org>
> ---
> Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index ffd7a912fc46..22f9894b346b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1685,6 +1685,8 @@ tags TAGS cscope gtags: FORCE
> PHONY += nsdeps
>
> nsdeps: modules
> + @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
> + -name '*.ns_deps' -type f -print | xargs rm -f
> $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps
> $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
>
> --
> 2.16.4