2
0

doxygen.mk 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #
  2. # DMBS Build System
  3. # Released into the public domain.
  4. #
  5. # dean [at] fourwalledcubicle [dot] com
  6. # www.fourwalledcubicle.com
  7. #
  8. DMBS_BUILD_MODULES += DOXYGEN
  9. DMBS_BUILD_TARGETS += doxygen doxygen-upgrade doxygen-create
  10. DMBS_BUILD_MANDATORY_VARS +=
  11. DMBS_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
  12. DMBS_BUILD_PROVIDED_VARS +=
  13. DMBS_BUILD_PROVIDED_MACROS +=
  14. # Conditionally import the CORE module of DMBS if it is not already imported
  15. DMBS_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
  16. ifeq ($(findstring CORE, $(DMBS_BUILD_MODULES)),)
  17. include $(DMBS_MODULE_PATH)/core.mk
  18. endif
  19. # Default values of optionally user-supplied variables
  20. DOXYGEN_CONF ?= doxyfile
  21. DOXYGEN_FAIL_ON_WARNING ?= Y
  22. DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES
  23. # Sanity check user supplied values
  24. $(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
  25. $(call ERROR_IF_EMPTY, DOXYGEN_CONF)
  26. $(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
  27. # Output Messages
  28. MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
  29. # Determine Doxygen invocation command
  30. BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
  31. ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
  32. DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
  33. else
  34. DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
  35. endif
  36. # Error if the specified Doxygen configuration file does not exist
  37. $(DOXYGEN_CONF):
  38. $(error Doxygen configuration file $@ does not exist)
  39. # Builds the project documentation using the specified configuration file and the DOXYGEN tool
  40. doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
  41. @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
  42. $(DOXYGEN_CMD)
  43. # Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
  44. doxygen-upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
  45. @echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
  46. doxygen -u $(DOXYGEN_CONF) > /dev/null
  47. # Creates a new Doxygen configuration file with the set file name
  48. doxygen-create: $(MAKEFILE_LIST)
  49. @echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
  50. doxygen -g $(DOXYGEN_CONF) > /dev/null