Re: [PATCH] kbuild: Split up DT binding build targets

From: Rob Herring
Date: Sun Aug 28 2022 - 21:08:40 EST


On Fri, Aug 26, 2022 at 2:31 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Thu, Aug 25, 2022 at 5:39 AM Rob Herring <robh@xxxxxxxxxx> wrote:
> >
> > The DT binding validation target, dt_binding_check, is composed of
> > multiple steps which can't be run individually. This resulted in
> > the passing of make variables to control which steps were run for
> > 'dtbs_check'. Some steps are also doing multiple things in a single rule
> > which is error prone[1].
> >
> > Rework the build to split each of the steps into its own make target.
> > This allows users more fine grained control over what's run and makes
> > for easier make dependencies.
>
>
> I do not think it makes the code easier.
>
>
> A tricky case is that multiple targets run in parallel.
>
>
> "make -j$(nproc) dtbs_check dt_binding_examples"
>
>
> Two different threads dive into Documentation/devicetree/bindings/Makefile,
> and try to build the same file simultaneously.
>
> If you run the command above, you will see two lines of
>
> SCHEMA Documentation/devicetree/bindings/processed-schema.json
>
> processed-schema.json may result in a corrupted file.

Indeed... :(

>
> > The new targets are:
> >
> > dt_binding_lint - Runs yamllint on the bindings
> > dt_binding_schemas - Validates the binding schemas
> > dt_binding_examples - Builds and validates the binding examples
>
>
> I still do not understand why so many phony targets are necessary.

I thought that's what you were suggesting, but I guess you meant just
separate internal targets. Separate targets exposed to the user are
useful as well. I've had some requests to be able to skip running
yamllint for example. The processed schema can be used for a few other
tools now, so being able to just build it is useful.

Rob