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)Makefiletop-level Makefile that runs the build
.DEFAULT_GOAL := htmlis set in theMakefile, which means thatmakeactually doesmake html.- The
htmltarget has therun_ninjatarget as a prerequisite- The
run_ninjatarget has$(AUTO_NINJABUILD)(i.e.build/autogenerated.ninja) as a prerequisitebuild/autogenerated.ninjahas$(BUILD_DIR)(i.e.build/) as a prerequisite- So the
build/directory gets created
- So the
- Then
build/autogenerated.ninjagets created
- Then
ninjagets invoked, which usesbuild.ninja(which includesbuild/autogenerated.ninja) to create a whole bunch of files in thebuild/directory
- The
- Then
jekyllgets 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
cleantarget has theclean_htmlandclean_doxygen_adoctargets as prerequisites- In this case
clean_doxygen_adocdoesn't do anything, butclean_htmldeletes thedocumentation/html/directory
- In this case
- Then the
build/directory is deleted
- The
build_doxygen_adoctarget has$(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc(i.e.documentation/asciidoc/pico-sdk/index_doxygen.adoc) as a prerequisitedocumentation/asciidoc/pico-sdk/index_doxygen.adochas$(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.txtanddocumentation/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.txtgets created by initialising thepico-sdksubmoduledocumentation/pico-examples/CMakeLists.txtgets created by initialising thepico-examplessubmodule
- So the
- Then
cmakegets invoked forpico-sdk/, which createsbuild-pico-sdk-docs/Makefile - Then we run the
docstarget inbuild-pico-sdk-docs/Makefilewhich runsdoxygenand 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.pyto 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_submodulespopulates (initialises) thedocumentation/pico-sdk/anddocumentation/pico-examples/submodule directoriesmake clean_submodulesdeinitialises the submodule directories, i.e. is the opposite offetch_submodulesmake build_doxygen_htmlruns thecmakeandmakesteps required to create the Doxygen HTML files (inbuild-pico-sdk-docs/docs/doxygen/html/) from thepico-sdksubmodulemake clean_doxygen_htmldeletes thebuild-pico-sdk-docs/directory i.e. is the opposite ofbuild_doxygen_htmlmake build_doxygen_adocdescribed in an earlier section, converts html files frombuild-pico-sdk-docs/docs/doxygen/html/to adoc files indocumentation/asciidoc/pico-sdk/make clean_doxygen_adocdeletes thedocumentation/asciidoc/pico-sdk/directory i.e. is the opposite ofbuild_doxygen_adocmake run_ninjaconverts adoc files fromdocumentation/asciidoc/into adoc files inbuild/make clean_ninjadeletes the files inbuild/i.e. is the opposite ofrun_ninjamake htmldescribed 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_htmldeletes thedocumentation/html/directory, i.e. is the opposite ofhtmlmake serve_htmlconverts adoc files frombuild/into html files indocumentation/html/and then runs a mini webserver so that you can preview the outputmake cleanruns both ofclean_html&clean_doxygen_adocand also deletesbuild/make clean_everythingruns all ofclean_submodules,clean_doxygen_htmlandcleani.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 |
+----------------------------------------------------------+