[v3,2/2] docs: Integrate rustdoc generation into htmldocs

Message ID 20221206153151.771038-3-carlos.bilbao@amd.com
State New
Headers
Series docs: Integrate rustdoc into Rust documentation |

Commit Message

Carlos Bilbao Dec. 6, 2022, 3:31 p.m. UTC
  Change target `make htmldocs` to combine RST Sphinx and the
generation of Rust documentation, when support is available.

Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
---
 Documentation/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Akira Yokosawa Dec. 6, 2022, 11:11 p.m. UTC | #1
On Tue, 6 Dec 2022 09:31:51 -0600, Carlos Bilbao wrote:
> Change target `make htmldocs` to combine RST Sphinx and the
> generation of Rust documentation, when support is available.
> 
> Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
> ---
>  Documentation/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 64d44c1ecad3..f537cf558af6 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
>  	fi
>  
>  htmldocs:
> +# If Rust support is available, add rustdoc generated contents
> +ifdef CONFIG_RUST
> +	$(Q)$(MAKE) rustdoc
> +endif
>  	@$(srctree)/scripts/sphinx-pre-install --version-check
>  	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
>  

What about patch below on top of this?
This way, it is possible to skip rustdoc generation by saying:

    make CONFIG_RUST=n SPHINXDIRS=doc-guide htmldocs

The reordering is to complete Sphinx runs even if rustdoc generation
ends up in error.

With this applied on top,

Reviewed-by: Akira Yokosawa <akiyks@gmail.com>

        Thanks, Akira

------
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 2cf3e0fd7839..4d334468aaaf 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -92,12 +92,12 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
 	fi
 
 htmldocs:
+	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
 # If Rust support is available, add rustdoc generated contents
-ifdef CONFIG_RUST
+ifeq ($(CONFIG_RUST),y)
 	$(Q)$(MAKE) rustdoc
 endif
-	@$(srctree)/scripts/sphinx-pre-install --version-check
-	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
 
 texinfodocs:
 	@$(srctree)/scripts/sphinx-pre-install --version-check
--
  
Randy Dunlap Dec. 7, 2022, 12:06 a.m. UTC | #2
On 12/6/22 15:11, Akira Yokosawa wrote:
> On Tue, 6 Dec 2022 09:31:51 -0600, Carlos Bilbao wrote:
>> Change target `make htmldocs` to combine RST Sphinx and the
>> generation of Rust documentation, when support is available.
>>
>> Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
>> ---
>>  Documentation/Makefile | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/Makefile b/Documentation/Makefile
>> index 64d44c1ecad3..f537cf558af6 100644
>> --- a/Documentation/Makefile
>> +++ b/Documentation/Makefile
>> @@ -92,6 +92,10 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
>>  	fi
>>  
>>  htmldocs:
>> +# If Rust support is available, add rustdoc generated contents
>> +ifdef CONFIG_RUST
>> +	$(Q)$(MAKE) rustdoc
>> +endif
>>  	@$(srctree)/scripts/sphinx-pre-install --version-check
>>  	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
>>  
> 
> What about patch below on top of this?
> This way, it is possible to skip rustdoc generation by saying:
> 
>     make CONFIG_RUST=n SPHINXDIRS=doc-guide htmldocs
> 
> The reordering is to complete Sphinx runs even if rustdoc generation
> ends up in error.
> 
> With this applied on top,
> 
> Reviewed-by: Akira Yokosawa <akiyks@gmail.com>
> 
>         Thanks, Akira
> 

Oh yes, I like both of those changes.
Thanks.

> ------
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 2cf3e0fd7839..4d334468aaaf 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -92,12 +92,12 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
>  	fi
>  
>  htmldocs:
> +	@$(srctree)/scripts/sphinx-pre-install --version-check
> +	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
>  # If Rust support is available, add rustdoc generated contents
> -ifdef CONFIG_RUST
> +ifeq ($(CONFIG_RUST),y)
>  	$(Q)$(MAKE) rustdoc
>  endif
> -	@$(srctree)/scripts/sphinx-pre-install --version-check
> -	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
>  
>  texinfodocs:
>  	@$(srctree)/scripts/sphinx-pre-install --version-check
  

Patch

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 64d44c1ecad3..f537cf558af6 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -92,6 +92,10 @@  quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
 	fi
 
 htmldocs:
+# If Rust support is available, add rustdoc generated contents
+ifdef CONFIG_RUST
+	$(Q)$(MAKE) rustdoc
+endif
 	@$(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))