Commit 2270f4b1 authored by Marc Herbert's avatar Marc Herbert Committed by Carles Cufi
Browse files

Instant doc/ gratification: do not re-run doxygen when not needed



Use file(GLOB_RECURSE ...) to generate a superset of doxygen input
files. Use this list as a dependency for a new empty file
doc/_build/last_doxy_run_tstamp.

The incremental build time to re-run "make htmldocs-fast" after a small
.rst doc change is brought down from from ~8s to ~4s on my Linux system
and from ~30s to less than 10s on my MacBook.

(Doxygen changes are still slow for a couple reasons recently isolated
and documented in doc/CMakeLists.txt)

Signed-off-by: default avatarMarc Herbert <marc.herbert@intel.com>
parent fc64481b
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -112,10 +112,25 @@ add_custom_target(
  COMMENT "Copying files to ${RST_OUT}"
)

# For incremental builds not to miss any source change this MUST be kept
# a superset of INPUT= and FILE_PATTERNS= in zephyr.doxyfile.in
file(GLOB_RECURSE  DOXY_SOURCES
  ${ZEPHYR_BASE}/include/*.[c,h,S]
  ${ZEPHYR_BASE}/lib/libc/*.[c,h,S]
  ${ZEPHYR_BASE}/tests/*.[h,c,S]
  )
# For debug. Also find generated list in doc/_build/(build.ninja|CMakeFiles/)
# message("DOXY_SOURCES= " ${DOXY_SOURCES})

set(ARGS ${DOXYFILE_OUT})
set(DOXY_RUN_TSTAMP ${CMAKE_CURRENT_BINARY_DIR}/last_doxy_run_tstamp)

add_custom_target(
  doxy

# Create timestamp first so we re-run if source files are edited while
# doxygen is running
add_custom_command(
  OUTPUT ${DOXY_RUN_TSTAMP}
  COMMAND cmake -E touch ${DOXY_RUN_TSTAMP}
  COMMAND ${CMAKE_COMMAND}
    -DCOMMAND=${DOXYGEN_EXECUTABLE}
    -DARGS="${ARGS}"
@@ -123,6 +138,7 @@ add_custom_target(
    -DERROR_FILE=${DOXY_LOG}
    -DWORKING_DIRECTORY=${CMAKE_CURRENT_LIST_DIR}
    -P ${ZEPHYR_BASE}/cmake/util/execute_process.cmake
  DEPENDS ${DOXY_SOURCES}
  COMMENT "Running ${DOXYGEN_EXECUTABLE}"
)

@@ -138,10 +154,10 @@ add_custom_target(
    ${PYTHON_EXECUTABLE} scripts/restore_modification_times.py
    --loglevel  WARN  ${DOXY_OUT}/xml
  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
  DEPENDS ${DOXY_RUN_TSTAMP}
  COMMENT "Fixing modification times of ${DOXY_OUT}/xml/ output"
)

add_dependencies(doxy_real_modified_times doxy)

add_custom_target(
  pristine
  COMMAND ${CMAKE_COMMAND} -P ${ZEPHYR_BASE}/cmake/pristine.cmake
+4 −0
Original line number Diff line number Diff line
@@ -750,6 +750,8 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

# This MUST be kept in sync with DOXY_SOURCES in doc/CMakeLists.txt
# for incremental (and faster) builds to work correctly.
INPUT                  = @ZEPHYR_BASE@/include/ \
                         @ZEPHYR_BASE@/include/misc/ \
                         @ZEPHYR_BASE@/include/arch/x86/ \
@@ -786,6 +788,8 @@ INPUT_ENCODING = UTF-8
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.

# This MUST be kept in sync with DOXY_SOURCES in doc/CMakeLists.txt
# for incremental (and faster) builds to work correctly.
FILE_PATTERNS          = "*.c" \
                         "*.h" \
                         "*.S"