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 # -----------------------------------------------------------------------------
 
  48 ERROR_IF_UNSET   = $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
 
  49 ERROR_IF_EMPTY   = $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
 
  50 ERROR_IF_NONBOOL = $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
 
  52 # Default values of optionally user-supplied variables
 
  53 DOXYGEN_CONF            ?= Doxygen.conf
 
  54 DOXYGEN_FAIL_ON_WARNING ?= Y
 
  55 DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_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)
 
  64 MSG_DOXYGEN_CMD         := ' [DOXYGEN] :'
 
  66 # Determine Doxygen invocation command
 
  67 BASE_DOXYGEN_CMD = ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
 
  68 ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
 
  69    DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
 
  71    DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
 
  75         @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
 
  78 # Phony build targets for this module