A brief overview of the files in this repo, and the make-targets in the Makefile
, and how it all hangs together to build the final output html files from the initial adoc input files.
TL;DR version: To build the 'regular' documentation site, run make clean; make
. To build the documentation site with pico-sdk API docs included, run make clean; make build_doxygen_adoc; make
.
documentation/asciidoc/
all our "regular" asciidoc documentation (referred to as$(ASCIIDOC_DIR)
in theMakefile
)documentation/images/
the images shown on the "boxes"documentation/pico-sdk/
pico-sdk submodule (initially empty) (referred to as$(PICO_SDK_DIR)
in theMakefile
)documentation/pico-examples/
pico-examples submodule (initially empty) (referred to as$(PICO_EXAMPLES_DIR)
in theMakefile
)jekyll-assets/
various styling stuff used by the jekyll build (referred to as$(JEKYLL_ASSETS_DIR)
in theMakefile
)scripts/
various Python build-scripts (referred to as$(SCRIPTS_DIR)
in theMakefile
)Makefile
top-level Makefile that runs the build
.DEFAULT_GOAL := html
is set in theMakefile
, which means thatmake
actually doesmake html
.- The
html
target has therun_ninja
target as a prerequisite- The
run_ninja
target has$(AUTO_NINJABUILD)
(i.e.build/autogenerated.ninja
) as a prerequisitebuild/autogenerated.ninja
has$(BUILD_DIR)
(i.e.build/
) as a prerequisite- So the
build/
directory gets created
- So the
- Then
build/autogenerated.ninja
gets created
- Then
ninja
gets invoked, which usesbuild.ninja
(which includesbuild/autogenerated.ninja
) to create a whole bunch of files in thebuild/
directory
- The
- Then
jekyll
gets invoked, which uses all the files in thebuild/
directory to create all the final output files in the$(HTML_DIR)
(i.e.documentation/html/
) directory
- The
If you run make
a second time, then make
and ninja
will spot that everything is up to date, and only re-run the jekyll
stage.
- The
clean
target has theclean_html
andclean_doxygen_adoc
targets as prerequisites- In this case
clean_doxygen_adoc
doesn't do anything, butclean_html
deletes thedocumentation/html/
directory
- In this case
- Then the
build/
directory is deleted
- The
build_doxygen_adoc
target has$(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
(i.e.documentation/asciidoc/pico-sdk/index_doxygen.adoc
) as a prerequisitedocumentation/asciidoc/pico-sdk/index_doxygen.adoc
has$(DOXYGEN_HTML_DIR)
(i.e.build-pico-sdk-docs/docs/doxygen/html/
) and$(ASCIIDOC_DOXYGEN_DIR)
(i.e.documentation/asciidoc/pico-sdk/
) as prerequisites- So the
documentation/asciidoc/pico-sdk/
directory gets created build-pico-sdk-docs/docs/doxygen/html/
has$(ALL_SUBMODULE_CMAKELISTS)
(i.e.documentation/pico-sdk/CMakeLists.txt
anddocumentation/pico-examples/CMakeLists.txt
) and$(DOXYGEN_PICO_SDK_BUILD_DIR)
(i.e.build-pico-sdk-docs/
) as prerequisites- So the
build-pico-sdk-docs/
directory gets created documentation/pico-sdk/CMakeLists.txt
gets created by initialising thepico-sdk
submoduledocumentation/pico-examples/CMakeLists.txt
gets created by initialising thepico-examples
submodule
- So the
- Then
cmake
gets invoked forpico-sdk/
, which createsbuild-pico-sdk-docs/Makefile
- Then we run the
docs
target inbuild-pico-sdk-docs/Makefile
which runsdoxygen
and creates a bunch of HTML files inbuild-pico-sdk-docs/docs/doxygen/html/
(referred to as$(DOXYGEN_HTML_DIR)
in theMakefile
)
- So the
- Then we run the new
scripts/transform_doxygen_html.py
to convert the HTML files frombuild-pico-sdk-docs/docs/doxygen/html/
into adoc files indocumentation/asciidoc/pico-sdk/
If you run make build_doxygen_adoc
a second time, then make
will detect that everything is already up to date, and so not do anything.
If we now run make
(see the make html
description above), it will now find documentation/asciidoc/pico-sdk/
and include that in the "tabs" in the output html files in documentation/html/
.
And if we then run a make clean
, the presence of documentation/asciidoc/pico-sdk/
will cause the clean_doxygen_adoc
target to delete the files in the build/
directory (to prevent things getting into an "invalid state"), and then delete the documentation/asciidoc/pico-sdk/
directory.
Note that build-pico-sdk-docs/
(the raw Doxygen output) isn't deleted by make clean
, because it's basically "static content" which can take a while to regenerate. To also get rid of build-pico-sdk-docs/
you can either make clean_doxygen_html
or make clean_everything
(with the latter also deinitialising the submodules).
Targets which might be useful for getting things to / from a particular state.
make fetch_submodules
populates (initialises) thedocumentation/pico-sdk/
anddocumentation/pico-examples/
submodule directoriesmake clean_submodules
deinitialises the submodule directories, i.e. is the opposite offetch_submodules
make build_doxygen_html
runs thecmake
andmake
steps required to create the Doxygen HTML files (inbuild-pico-sdk-docs/docs/doxygen/html/
) from thepico-sdk
submodulemake clean_doxygen_html
deletes thebuild-pico-sdk-docs/
directory i.e. is the opposite ofbuild_doxygen_html
make build_doxygen_adoc
described in an earlier section, converts html files frombuild-pico-sdk-docs/docs/doxygen/html/
to adoc files indocumentation/asciidoc/pico-sdk/
make clean_doxygen_adoc
deletes thedocumentation/asciidoc/pico-sdk/
directory i.e. is the opposite ofbuild_doxygen_adoc
make run_ninja
converts adoc files fromdocumentation/asciidoc/
into adoc files inbuild/
make clean_ninja
deletes the files inbuild/
i.e. is the opposite ofrun_ninja
make html
described in an earlier section, converts adoc files frombuild/
into html files indocumentation/html/
. The default target invoked when no explicit target is given.make clean_html
deletes thedocumentation/html/
directory, i.e. is the opposite ofhtml
make serve_html
converts adoc files frombuild/
into html files indocumentation/html/
and then runs a mini webserver so that you can preview the outputmake clean
runs both ofclean_html
&clean_doxygen_adoc
and also deletesbuild/
make clean_everything
runs all ofclean_submodules
,clean_doxygen_html
andclean
i.e. returns your local directory to a fairly pristine state
Note that for day-to-day usage, you'll typically only use the make clean
, make
, make build_doxygen_adoc
and make serve_html
commands - the dependencies in the Makefile
are all set up so that any necessary intermediate steps are performed automatically.
Bad ASCII-art time:
+---------------+
| 'clean' state |--> make build_doxygen_adoc
+---------------+ |
| | ^ V
| V | +-----------------------------------------+
| make make clean <---| documentation/asciidoc/pico-sdk/ exists |
| | ^ +-----------------------------------------+
| | | | |
| | | V |
| V | make |
| +----------------------------+ | |
| | documentation/html/ exists |<---+ |
| +----------------------------+ |
| | ^ |
| V | |
+---> make serve_html <-----------------------+
| |
| Ctrl-C
| ^
V |
+----------------------------------------------------------+
| documentation/html/ exists and preview webserver running |
+----------------------------------------------------------+