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