From ecdffe2e41f13cc245e2e7cfab18486ea66330a7 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Sat, 2 Jun 2012 13:14:31 +0000
Subject: [PATCH] Remove any variables in the optional build variable list that
 are marked as mandatory by one or more included build system modules in the
 CORE build system module. Alter DOXYGEN build system module to by default
 override the Doxygen configuration file stylesheet and replace it with the
 LUFA Doxygen stylesheet.

---
 LUFA/Build/lufa.build.in   | 14 +++++++-------
 LUFA/Build/lufa.core.in    |  4 ++--
 LUFA/Build/lufa.doxygen.in | 15 +++++++++------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in
index e76f5c3f9..d1b82d824 100644
--- a/LUFA/Build/lufa.build.in
+++ b/LUFA/Build/lufa.build.in
@@ -92,16 +92,16 @@ OBJECT_FILES = $(filter %.o, $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.cpp=%.o) $(ASM_S
 
 # Create a list of flags to pass to the compiler
 ifeq ($(ARCH), AVR8)
- CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
- CROSS     = avr-
+   CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
+   CROSS     = avr-
 else ifeq ($(ARCH), XMEGA)
- CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
- CROSS     = avr-
+   CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
+   CROSS     = avr-
 else ifeq ($(ARCH), UC3)
- CC_FLAGS += -mpart=$(MCU) -g3 -masm-addr-pseudos
- CROSS     = avr32-
+   CC_FLAGS += -mpart=$(MCU) -g3 -masm-addr-pseudos
+   CROSS     = avr32-
 else
-  $(error Unsupported architecture.)
+    $(error Unsupported architecture.)
 endif
 CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
 CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/..
diff --git a/LUFA/Build/lufa.core.in b/LUFA/Build/lufa.core.in
index e4cc36407..bc07a940a 100644
--- a/LUFA/Build/lufa.core.in
+++ b/LUFA/Build/lufa.core.in
@@ -76,7 +76,7 @@ help: info
 	@echo "                                                                   "
 	@echo "  Optional variables required by the selected build Modules:       "
 	@echo "                                                                   "
-	@echo "    [" $(sort $(LUFA_BUILD_OPTIONAL_VARS)) "]"
+	@echo "    [" $(filter-out $(LUFA_BUILD_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS))) "]"
 	@echo "                                                                   "
 	@echo "==================================================================="
 	@echo "        The LUFA BuildSystem 2.0 - Powered By Unicorns (tm)        "
@@ -92,4 +92,4 @@ list_mandatory:
 	@echo Mandatory Variables for Included Modules: $(sort $(LUFA_BUILD_MANDATORY_VARS))
 	
 list_optional:
-	@echo Optional Variables for Included Modules: $(sort $(LUFA_BUILD_OPTIONAL_VARS))
+	@echo Optional Variables for Included Modules: $(filter-out $(LUFA_BUILD_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
diff --git a/LUFA/Build/lufa.doxygen.in b/LUFA/Build/lufa.doxygen.in
index 13055fc74..f1b9a9d6e 100644
--- a/LUFA/Build/lufa.doxygen.in
+++ b/LUFA/Build/lufa.doxygen.in
@@ -8,7 +8,7 @@
 
 LUFA_BUILD_MODULES        += DOXYGEN
 LUFA_BUILD_TARGETS        += doxygen
-LUFA_BUILD_MANDATORY_VARS += 
+LUFA_BUILD_MANDATORY_VARS += LUFA_PATH
 LUFA_BUILD_OPTIONAL_VARS  += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS
 
 # -----------------------------------------------------------------------------
@@ -24,7 +24,7 @@ LUFA_BUILD_OPTIONAL_VARS  += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
 #
 # MANDATORY PARAMETERS:
 #
-#    (None)
+#    LUFA_PATH                 - Path to the LUFA library core
 #
 # OPTIONAL PARAMETERS:
 #
@@ -35,20 +35,23 @@ LUFA_BUILD_OPTIONAL_VARS  += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
 #                                configuration file
 # -----------------------------------------------------------------------------
 
+# Sanity-check values of mandatory user-supplied variables
+LUFA_PATH               ?= $(error Makefile LUFA_PATH value not set.)
+
 # Default values of optionally user-supplied variables
 DOXYGEN_CONF            ?= Doxygen.conf
 DOXYGEN_FAIL_ON_WARNING ?= Y
-DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES
+DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
 
 # Output Messages
 MSG_DOXYGEN_CMD          = ' [DOXYGEN] :'
 
 # Determine Doxygen invocation command
-BASE_DOXYGEN_CMD = ( cat Doxygen.conf ; $(DOXYGEN_OVERRIDE_PARAMS:%=echo "%") ) | doxygen -
+BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
 ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
-    DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
+   DOXYGEN_CMD = if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi;
 else
-    DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
+   DOXYGEN_CMD = $(BASE_DOXYGEN_CMD)
 endif
 
 doxygen:
-- 
GitLab