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 # Conditionally import the CORE module of DMBS if it is not already imported
17 DMBS_MODULE_PATH
:= $(patsubst %/,%,$(dir $(lastword
$(MAKEFILE_LIST
))))
18 ifeq ($(findstring CORE
, $(DMBS_BUILD_MODULES
)),)
19 include $(DMBS_MODULE_PATH
)/core.mk
22 # Default values of optionally user-supplied variables
23 DOXYGEN_CONF ?
= doxyfile
24 DOXYGEN_FAIL_ON_WARNING ?
= Y
25 DOXYGEN_OVERRIDE_PARAMS ?
= QUIET
=YES
27 # Sanity check user supplied values
28 $(foreach MANDATORY_VAR
, $(DMBS_BUILD_MANDATORY_VARS
), $(call ERROR_IF_UNSET
, $(MANDATORY_VAR
)))
29 $(call ERROR_IF_EMPTY
, DOXYGEN_CONF
)
30 $(call ERROR_IF_NONBOOL
, DOXYGEN_FAIL_ON_WARNING
)
33 MSG_DOXYGEN_CMD
:= ' [DOXYGEN] :'
35 # Determine Doxygen invocation command
36 BASE_DOXYGEN_CMD
:= ( cat
$(DOXYGEN_CONF
) $(DOXYGEN_OVERRIDE_PARAMS
:%=; echo
"%") ) | doxygen
-
37 ifeq ($(DOXYGEN_FAIL_ON_WARNING
), Y
)
38 DOXYGEN_CMD
:= if
( $(BASE_DOXYGEN_CMD
) 2>&1 | grep
-v
"warning: ignoring unsupported tag" ;); then exit
1; fi
;
40 DOXYGEN_CMD
:= $(BASE_DOXYGEN_CMD
)
43 # Error if the specified Doxygen configuration file does not exist
45 $(error Doxygen configuration file
$@ does not exist
)
47 # Builds the project documentation using the specified configuration file and the DOXYGEN tool
48 doxygen
: $(DOXYGEN_CONF
) $(MAKEFILE_LIST
)
49 @echo
$(MSG_DOXYGEN_CMD
) Configuration file
\"$(DOXYGEN_CONF
)\" with parameters
\"$(DOXYGEN_OVERRIDE_PARAMS
)\"
52 # Upgrades an existing Doxygen configuration file to the latest Doxygen template, preserving settings
53 doxygen-upgrade
: $(DOXYGEN_CONF
) $(MAKEFILE_LIST
)
54 @echo
$(MSG_DOXYGEN_CMD
) Upgrading configuration file
\"$(DOXYGEN_CONF
)\" with latest template
55 doxygen
-u
$(DOXYGEN_CONF
) > /dev
/null
57 # Creates a new Doxygen configuration file with the set file name
58 doxygen-create
: $(MAKEFILE_LIST
)
59 @echo
$(MSG_DOXYGEN_CMD
) Creating new configuration file
\"$(DOXYGEN_CONF
)\" with latest template
60 doxygen
-g
$(DOXYGEN_CONF
) > /dev
/null