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
 
  14 # -----------------------------------------------------------------------------
 
  15 #                 LUFA Doxygen Buildsystem Makefile Module.
 
  16 # -----------------------------------------------------------------------------
 
  18 #   Provides a set of targets to automatically build Doxygen documentation for
 
  19 #   a project (see www.doxygen.org).
 
  20 # -----------------------------------------------------------------------------
 
  23 #    doxygen                   - Build Doxygen Documentation
 
  25 # MANDATORY PARAMETERS:
 
  27 #    LUFA_PATH                 - Path to the LUFA library core
 
  29 # OPTIONAL PARAMETERS:
 
  31 #    DOXYGEN_CONF              - Doxygen configuration filename
 
  32 #    DOXYGEN_FAIL_ON_WARNING   - Set to Y to fail the build on Doxygen warnings,
 
  33 #                                N to continue even if warnings occur
 
  34 #    DOXYGEN_OVERRIDE_PARAMS   - Parameters to override in the doxygen
 
  36 # -----------------------------------------------------------------------------
 
  38 # Sanity-check values of mandatory user-supplied variables
 
  39 LUFA_PATH               ?= $(error Makefile LUFA_PATH value not set)
 
  41 # Default values of optionally user-supplied variables
 
  42 DOXYGEN_CONF            ?= Doxygen.conf
 
  43 DOXYGEN_FAIL_ON_WARNING ?= Y
 
  44 DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
 
  47 MSG_DOXYGEN_CMD         := ' [DOXYGEN] :'
 
  49 # Determine Doxygen invocation command
 
  50 BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
 
  51 ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
 
  52    DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
 
  53 else ifeq ($(DOXYGEN_FAIL_ON_WARNING), N)
 
  54    DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
 
  56         $(error DOXYGEN_FAIL_ON_WARNING must be Y or N.)
 
  60         @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\"
 
  63 # Phony build targets for this module