From fc3768733ee6204967234e2f0dabde6d6d80882e Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Sat, 2 Jun 2012 12:04:34 +0000
Subject: [PATCH] Clean up ordering of build system module sanity checks.

---
 LUFA/Build/lufa.avrdude.in | 12 +++---
 LUFA/Build/lufa.build.in   | 24 ++++++------
 LUFA/Build/lufa.dfu.in     |  8 ++--
 LUFA/Build/lufa.doxygen.in |  8 ++--
 LUFA/Build/lufa.sources.in | 76 +++++++++++++++++++-------------------
 5 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/LUFA/Build/lufa.avrdude.in b/LUFA/Build/lufa.avrdude.in
index fdc5bc1d78..9586ae211d 100644
--- a/LUFA/Build/lufa.avrdude.in
+++ b/LUFA/Build/lufa.avrdude.in
@@ -35,17 +35,17 @@ LUFA_BUILD_OPTIONAL_VARS  += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
 #
 # -----------------------------------------------------------------------------
 
-# Output Messages
-MSG_AVRDUDE_CMD     = ' [AVRDUDE] :'
+# Sanity-check values of mandatory user-supplied variables
+MCU                ?= $(error Makefile MCU value not set.)
+TARGET             ?= $(error Makefile TARGET value not set.)
 
-# Default values of user-supplied variables
+# Default values of optionally user-supplied variables
 AVRDUDE_PROGRAMMER ?= jtagicemkii
 AVRDUDE_PORT       ?= usb
 AVRDUDE_FLAGS      ?= -U flash:w:$(TARGET).hex
 
-# Sanity check the user MCU and TARGET makefile options
-MCU                ?= $(error Makefile MCU value not set.)
-TARGET             ?= $(error Makefile TARGET value not set.)
+# Output Messages
+MSG_AVRDUDE_CMD     = ' [AVRDUDE] :'
 
 program: $(TARGET).hex
 	@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in
index 6c9133f837..e43996d8e7 100644
--- a/LUFA/Build/lufa.build.in
+++ b/LUFA/Build/lufa.build.in
@@ -53,17 +53,7 @@ LUFA_BUILD_OPTIONAL_VARS  += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_
 #
 # -----------------------------------------------------------------------------
 
-# Output Messages
-MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"...
-MSG_BUILD_END   = Finished building project \"$(TARGET)\"...
-MSG_COMPILE_CMD = ' [CC]      :'
-MSG_REMOVE_CMD  = ' [RM]      :'
-MSG_LINKER_CMD  = ' [LNK]     :'
-MSG_SIZE_CMD    = ' [SIZE]    :'
-MSG_OBJCPY_CMD  = ' [OBJCPY]  :'
-MSG_OBJDMP_CMD  = ' [OBJDMP]  :'
-
-# Sanity check the user MCU, TARGET, ARCH, SRC, F_USB and LUFA_PATH makefile options
+# Sanity-check values of mandatory user-supplied variables
 MCU            ?= $(error Makefile MCU value not set.)
 TARGET         ?= $(error Makefile TARGET value not set.)
 ARCH           ?= $(error Makefile ARCH value not set.)
@@ -71,7 +61,7 @@ SRC            ?= $(error Makefile SRC value not set.)
 F_USB          ?= $(error Makefile F_USB value not set.)
 LUFA_PATH      ?= $(error Makefile LUFA_PATH value not set.)
 
-# Default values of user-supplied variables
+# Default values of optionally user-supplied variables
 BOARD          ?= NONE
 OPTIMIZATION   ?= s
 F_CPU          ?=
@@ -82,6 +72,16 @@ CPP_FLAGS      ?=
 ASM_FLAGS      ?=
 CC_FLAGS       ?=
 
+# Output Messages
+MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"...
+MSG_BUILD_END   = Finished building project \"$(TARGET)\"...
+MSG_COMPILE_CMD = ' [CC]      :'
+MSG_REMOVE_CMD  = ' [RM]      :'
+MSG_LINKER_CMD  = ' [LNK]     :'
+MSG_SIZE_CMD    = ' [SIZE]    :'
+MSG_OBJCPY_CMD  = ' [OBJCPY]  :'
+MSG_OBJDMP_CMD  = ' [OBJDMP]  :'
+
 # Convert input source file list to differentiate them by type
 C_SOURCE   = $(filter %.c, $(SRC))
 CPP_SOURCE = $(filter %.cpp, $(SRC))
diff --git a/LUFA/Build/lufa.dfu.in b/LUFA/Build/lufa.dfu.in
index 8c478db842..c3a102be82 100644
--- a/LUFA/Build/lufa.dfu.in
+++ b/LUFA/Build/lufa.dfu.in
@@ -36,15 +36,15 @@ LUFA_BUILD_OPTIONAL_VARS  +=
 #
 # -----------------------------------------------------------------------------
 
+# Sanity-check values of mandatory user-supplied variables
+MCU            ?= $(error Makefile MCU value not set.)
+TARGET         ?= $(error Makefile TARGET value not set.)
+
 # Output Messages
 MSG_COPY_CMD    = ' [CP]      :'
 MSG_REMOVE_CMD  = ' [RM]      :'
 MSG_DFU_CMD     = ' [DFU]     :'
 
-# Sanity check the user MCU and TARGET makefile options
-MCU            ?= $(error Makefile MCU value not set.)
-TARGET         ?= $(error Makefile TARGET value not set.)
-
 flip: $(TARGET).hex
 	@echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"
 	batchisp -hardware usb -device $(MCU) -operation erase f
diff --git a/LUFA/Build/lufa.doxygen.in b/LUFA/Build/lufa.doxygen.in
index 039967cad1..532bde5bd5 100644
--- a/LUFA/Build/lufa.doxygen.in
+++ b/LUFA/Build/lufa.doxygen.in
@@ -35,14 +35,14 @@ LUFA_BUILD_OPTIONAL_VARS  += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
 #                                configuration file
 # -----------------------------------------------------------------------------
 
-# Output Messages
-MSG_DOXYGEN_CMD          = ' [DOXYGEN] :'
-
-# Default values of user-supplied variables
+# Default values of optionally user-supplied variables
 DOXYGEN_CONF            ?= Doxygen.conf
 DOXYGEN_FAIL_ON_WARNING ?= Y
 DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES
 
+# Output Messages
+MSG_DOXYGEN_CMD          = ' [DOXYGEN] :'
+
 # Determine Doxygen invocation command
 DOXYGEN_CMD = ( cat Doxygen.conf ; $(DOXYGEN_OVERRIDE_PARAMS:%=echo "%";)) | doxygen -
 ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y)
diff --git a/LUFA/Build/lufa.sources.in b/LUFA/Build/lufa.sources.in
index a2e02e9799..ee74a48a03 100644
--- a/LUFA/Build/lufa.sources.in
+++ b/LUFA/Build/lufa.sources.in
@@ -35,7 +35,7 @@ LUFA_BUILD_OPTIONAL_VARS  +=
 #
 # -----------------------------------------------------------------------------
 
-# Sanity check the user LUFA_PATH and ARCH makefile options
+# Sanity-check values of mandatory user-supplied variables
 ARCH           ?= $(error Makefile ARCH value not set.)
 LUFA_PATH      ?= $(error Makefile LUFA_PATH value not set.)
 
@@ -43,42 +43,42 @@ LUFA_PATH      ?= $(error Makefile LUFA_PATH value not set.)
 LUFA_ROOT_PATH ?= $(LUFA_PATH)
 
 # Construct LUFA module source variables
-LUFA_SRC_USB           = $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c          \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c        \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c            \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c            \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c   \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c    \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c  \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c      \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptor.c                \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c               \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c                          \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c                 \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c                         \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c
-LUFA_SRC_USBCLASS      = $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c        \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c          \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c          \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c  \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c         \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c        \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c            \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c              \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c              \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c      \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c             \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c          \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c            \
-                         $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c
-LUFA_SRC_TEMPERATURE   = $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c
-LUFA_SRC_SERIAL        = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c
-LUFA_SRC_TWI           = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c
+LUFA_SRC_USB         = $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c          \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c        \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c            \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c            \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c   \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c    \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c  \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c      \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptor.c                \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c               \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c                          \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c                 \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c                         \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c
+LUFA_SRC_USBCLASS    = $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c        \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c          \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c          \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c  \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c         \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c        \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c            \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c              \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c              \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c      \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c             \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c          \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c            \
+                       $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c
+LUFA_SRC_TEMPERATURE = $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c
+LUFA_SRC_SERIAL      = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c
+LUFA_SRC_TWI         = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c
 
 # Build a list of all available module sources
-LUFA_SRC_ALL_FILES     = $(LUFA_SRC_USB)            \
-                         $(LUFA_SRC_USBCLASS)       \
-                         $(LUFA_SRC_TEMPERATURE)    \
-                         $(LUFA_SRC_SERIAL)         \
-                         $(LUFA_SRC_TWI)
\ No newline at end of file
+LUFA_SRC_ALL_FILES   = $(LUFA_SRC_USB)            \
+                       $(LUFA_SRC_USBCLASS)       \
+                       $(LUFA_SRC_TEMPERATURE)    \
+                       $(LUFA_SRC_SERIAL)         \
+                       $(LUFA_SRC_TWI)
\ No newline at end of file