upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

lufa_doxygen.mk 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #
  2. # LUFA Library
  3. # Copyright (C) Dean Camera, 2014.
  4. #
  5. # dean [at] fourwalledcubicle [dot] com
  6. # www.lufa-lib.org
  7. #
  8. LUFA_BUILD_MODULES += DOXYGEN
  9. LUFA_BUILD_TARGETS += doxygen doxygen_upgrade doxygen_create
  10. LUFA_BUILD_MANDATORY_VARS += LUFA_PATH
  11. LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
  12. LUFA_BUILD_PROVIDED_VARS +=
  13. LUFA_BUILD_PROVIDED_MACROS +=
  14. # -----------------------------------------------------------------------------
  15. # LUFA Doxygen Buildsystem Makefile Module.
  16. # -----------------------------------------------------------------------------
  17. # DESCRIPTION:
  18. # Provides a set of targets to automatically build Doxygen documentation for
  19. # a project (see www.doxygen.org).
  20. # -----------------------------------------------------------------------------
  21. # TARGETS:
  22. #
  23. # doxygen - Build Doxygen Documentation
  24. # doxygen_create - Create a new Doxygen configuration file using
  25. # the latest template
  26. # doxygen_upgrade - Upgrade an existing Doxygen configuration file
  27. # to the latest template
  28. #
  29. # MANDATORY PARAMETERS:
  30. #
  31. # LUFA_PATH - Path to the LUFA library core
  32. #
  33. # OPTIONAL PARAMETERS:
  34. #
  35. # DOXYGEN_CONF - Doxygen configuration filename
  36. # DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings,
  37. # N to continue even if warnings occur
  38. # DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen
  39. # configuration file
  40. # PROVIDED VARIABLES:
  41. #
  42. # (None)
  43. #
  44. # PROVIDED MACROS:
  45. #
  46. # (None)
  47. #
  48. # -----------------------------------------------------------------------------
  49. SHELL = /bin/sh
  50. ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
  51. ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
  52. ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
  53. # Default values of optionally user-supplied variables
  54. DOXYGEN_CONF ?= doxyfile
  55. DOXYGEN_FAIL_ON_WARNING ?= Y
  56. DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_EXTRA_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
  57. # Sanity check user supplied values
  58. $(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
  59. $(call ERROR_IF_EMPTY, DOXYGEN_CONF)
  60. $(call ERROR_IF_EMPTY, LUFA_PATH)
  61. $(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
  62. # Output Messages
  63. MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
  64. # Determine Doxygen invocation command
  65. BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
  66. ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
  67. DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
  68. else
  69. DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
  70. endif
  71. # Error if the specified Doxygen configuration file does not exist
  72. $(DOXYGEN_CONF):
  73. $(error Doxygen configuration file $@ does not exist)
  74. # Builds the project documentation using the specified configuration file and the DOXYGEN tool
  75. doxygen: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
  76. @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
  77. $(DOXYGEN_CMD)
  78. # Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
  79. doxygen_upgrade: $(DOXYGEN_CONF) $(MAKEFILE_LIST)
  80. @echo $(MSG_DOXYGEN_CMD) Upgrading configuration file \"$(DOXYGEN_CONF)\" with latest template
  81. doxygen -u $(DOXYGEN_CONF) > /dev/null
  82. # Creates a new Doxygen configuration file with the set file name
  83. doxygen_create: $(MAKEFILE_LIST)
  84. @echo $(MSG_DOXYGEN_CMD) Creating new configuration file \"$(DOXYGEN_CONF)\" with latest template
  85. doxygen -g $(DOXYGEN_CONF) > /dev/null
  86. # Phony build targets for this module
  87. .PHONY: doxygen doxygen_upgrade doxygen_create