3 #     Copyright (C) Dean Camera, 2012.
 
   5 #  dean [at] fourwalledcubicle [dot] com
 
   9 LUFA_BUILD_MODULES         += DOXYGEN
 
  10 LUFA_BUILD_TARGETS         += doxygen
 
  11 LUFA_BUILD_MANDATORY_VARS  += LUFA_PATH
 
  12 LUFA_BUILD_OPTIONAL_VARS   += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
 
  13 LUFA_BUILD_PROVIDED_VARS   += 
 
  14 LUFA_BUILD_PROVIDED_MACROS += 
 
  16 # -----------------------------------------------------------------------------
 
  17 #                 LUFA Doxygen Buildsystem Makefile Module.
 
  18 # -----------------------------------------------------------------------------
 
  20 #   Provides a set of targets to automatically build Doxygen documentation for
 
  21 #   a project (see www.doxygen.org).
 
  22 # -----------------------------------------------------------------------------
 
  25 #    doxygen                   - Build Doxygen Documentation
 
  27 # MANDATORY PARAMETERS:
 
  29 #    LUFA_PATH                 - Path to the LUFA library core
 
  31 # OPTIONAL PARAMETERS:
 
  33 #    DOXYGEN_CONF              - Doxygen configuration filename
 
  34 #    DOXYGEN_FAIL_ON_WARNING   - Set to Y to fail the build on Doxygen warnings,
 
  35 #                                N to continue even if warnings occur
 
  36 #    DOXYGEN_OVERRIDE_PARAMS   - Parameters to override in the doxygen
 
  46 # -----------------------------------------------------------------------------
 
  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))
 
  54 # Default values of optionally user-supplied variables
 
  55 DOXYGEN_CONF            ?= Doxygen.conf
 
  56 DOXYGEN_FAIL_ON_WARNING ?= Y
 
  57 DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
 
  59 # Sanity check user supplied values
 
  60 $(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
 
  61 $(call ERROR_IF_EMPTY, DOXYGEN_CONF)
 
  62 $(call ERROR_IF_EMPTY, LUFA_PATH)
 
  63 $(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING)
 
  66 MSG_DOXYGEN_CMD         := ' [DOXYGEN] :'
 
  68 # Determine Doxygen invocation command
 
  69 BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
 
  70 ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
 
  71    DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
 
  73    DOXYGEN_CMD := $(BASE_DOXYGEN_CMD)
 
  77         @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
 
  80 # Phony build targets for this module