Simplify build system mandatory parameter/variable sanity checks.
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 2 Jun 2012 12:00:51 +0000 (12:00 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 2 Jun 2012 12:00:51 +0000 (12:00 +0000)
LUFA/Build/lufa.avrdude.in
LUFA/Build/lufa.build.in
LUFA/Build/lufa.dfu.in
LUFA/Build/lufa.doxygen.in
LUFA/Build/lufa.sources.in

index e2b8e57..fdc5bc1 100644 (file)
@@ -36,20 +36,16 @@ LUFA_BUILD_OPTIONAL_VARS  += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
 # -----------------------------------------------------------------------------\r
 \r
 # Output Messages\r
-MSG_AVRDUDE_CMD   = '  [AVRDUDE]  :'\r
+MSG_AVRDUDE_CMD     = ' [AVRDUDE] :'\r
 \r
 # Default values of user-supplied variables\r
-AVRDUDE_PROGRAMMER  ?= jtagicemkii\r
-AVRDUDE_PORT        ?= usb\r
-AVRDUDE_FLAGS       ?= -U flash:w:$(TARGET).hex\r
+AVRDUDE_PROGRAMMER ?= jtagicemkii\r
+AVRDUDE_PORT       ?= usb\r
+AVRDUDE_FLAGS      ?= -U flash:w:$(TARGET).hex\r
 \r
 # Sanity check the user MCU and TARGET makefile options\r
-ifeq ($(MCU),)\r
-   $(error Makefile MCU value not set.)\r
-endif\r
-ifeq ($(TARGET),)\r
-   $(error Makefile TARGET value not set.)\r
-endif\r
+MCU                ?= $(error Makefile MCU value not set.)\r
+TARGET             ?= $(error Makefile TARGET value not set.)\r
 \r
 program: $(TARGET).hex\r
        @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"\r
index 1cdb75a..6c9133f 100644 (file)
@@ -56,43 +56,31 @@ LUFA_BUILD_OPTIONAL_VARS  += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_
 # Output Messages\r
 MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"...\r
 MSG_BUILD_END   = Finished building project \"$(TARGET)\"...\r
-MSG_COMPILE_CMD = '  [CC]      :'\r
-MSG_REMOVE_CMD  = '  [RM]      :'\r
-MSG_LINKER_CMD  = '  [LNK]     :'\r
-MSG_SIZE_CMD    = '  [SIZE]    :'\r
-MSG_OBJCPY_CMD  = '  [OBJCPY]  :'\r
-MSG_OBJDMP_CMD  = '  [OBJDMP]  :'\r
+MSG_COMPILE_CMD = ' [CC]      :'\r
+MSG_REMOVE_CMD  = ' [RM]      :'\r
+MSG_LINKER_CMD  = ' [LNK]     :'\r
+MSG_SIZE_CMD    = ' [SIZE]    :'\r
+MSG_OBJCPY_CMD  = ' [OBJCPY]  :'\r
+MSG_OBJDMP_CMD  = ' [OBJDMP]  :'\r
 \r
 # Sanity check the user MCU, TARGET, ARCH, SRC, F_USB and LUFA_PATH makefile options\r
-ifeq ($(TARGET),)\r
-   $(error Makefile TARGET value not set.)\r
-endif\r
-ifeq ($(ARCH),)\r
-   $(error Makefile ARCH value not set.)\r
-endif\r
-ifeq ($(MCU),)\r
-   $(error Makefile MCU value not set.)\r
-endif\r
-ifeq ($(SRC),)\r
-   $(error Makefile SRC value not set.)\r
-endif\r
-ifeq ($(F_USB),)\r
-   $(error Makefile F_USB value not set.)\r
-endif\r
-ifeq ($(LUFA_PATH),)\r
-   $(error Makefile LUFA_PATH value not set.)\r
-endif\r
+MCU            ?= $(error Makefile MCU value not set.)\r
+TARGET         ?= $(error Makefile TARGET value not set.)\r
+ARCH           ?= $(error Makefile ARCH value not set.)\r
+SRC            ?= $(error Makefile SRC value not set.)\r
+F_USB          ?= $(error Makefile F_USB value not set.)\r
+LUFA_PATH      ?= $(error Makefile LUFA_PATH value not set.)\r
 \r
 # Default values of user-supplied variables\r
-BOARD         ?= NONE\r
-OPTIMIZATION  ?= s\r
-F_CPU         ?=\r
-C_STANDARD    ?= gnu99\r
-CPP_STANDARD  ?= gnu++98\r
-C_FLAGS       ?=\r
-CPP_FLAGS     ?=\r
-ASM_FLAGS     ?=\r
-CC_FLAGS      ?=\r
+BOARD          ?= NONE\r
+OPTIMIZATION   ?= s\r
+F_CPU          ?=\r
+C_STANDARD     ?= gnu99\r
+CPP_STANDARD   ?= gnu++98\r
+C_FLAGS        ?=\r
+CPP_FLAGS      ?=\r
+ASM_FLAGS      ?=\r
+CC_FLAGS       ?=\r
 \r
 # Convert input source file list to differentiate them by type\r
 C_SOURCE   = $(filter %.c, $(SRC))\r
index ac5edea..8c478db 100644 (file)
@@ -37,15 +37,13 @@ LUFA_BUILD_OPTIONAL_VARS  +=
 # -----------------------------------------------------------------------------\r
 \r
 # Output Messages\r
-MSG_DFU_CMD   = '  [DFU]     :'\r
+MSG_COPY_CMD    = ' [CP]      :'\r
+MSG_REMOVE_CMD  = ' [RM]      :'\r
+MSG_DFU_CMD     = ' [DFU]     :'\r
 \r
 # Sanity check the user MCU and TARGET makefile options\r
-ifeq ($(MCU),)\r
-   $(error Makefile MCU value not set.)\r
-endif\r
-ifeq ($(TARGET),)\r
-   $(error Makefile TARGET value not set.)\r
-endif\r
+MCU            ?= $(error Makefile MCU value not set.)\r
+TARGET         ?= $(error Makefile TARGET value not set.)\r
 \r
 flip: $(TARGET).hex\r
        @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"\r
@@ -54,11 +52,13 @@ flip: $(TARGET).hex
        batchisp -hardware usb -device $(MCU) -operation start reset 0\r
 \r
 flip-ee: $(TARGET).eep\r
+       @echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$(TARGET)eep.hex\"\r
        cp $(TARGET).eep $(TARGET)eep.hex\r
        @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$(TARGET).eep\"\r
        batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase\r
        batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program\r
        batchisp -hardware usb -device $(MCU) -operation start reset 0\r
+       @echo $(MSG_DFU_CMD) Removing temporary file \"$(TARGET)eep.hex\"\r
        rm $(TARGET)eep.hex\r
        \r
 dfu: $(TARGET).hex\r
index 26cd40d..039967c 100644 (file)
@@ -36,7 +36,7 @@ LUFA_BUILD_OPTIONAL_VARS  += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
 # -----------------------------------------------------------------------------\r
 \r
 # Output Messages\r
-MSG_DOXYGEN_CMD   = '  [DOXYGEN] :'\r
+MSG_DOXYGEN_CMD          = ' [DOXYGEN] :'\r
 \r
 # Default values of user-supplied variables\r
 DOXYGEN_CONF            ?= Doxygen.conf\r
index 37263b6..a2e02e9 100644 (file)
@@ -36,12 +36,8 @@ LUFA_BUILD_OPTIONAL_VARS  +=
 # -----------------------------------------------------------------------------\r
 \r
 # Sanity check the user LUFA_PATH and ARCH makefile options\r
-ifeq ($(LUFA_PATH),)\r
-   $(error Makefile LUFA_PATH value not set.)\r
-endif\r
-ifeq ($(ARCH),)\r
-   $(error Makefile ARCH value not set.)\r
-endif\r
+ARCH           ?= $(error Makefile ARCH value not set.)\r
+LUFA_PATH      ?= $(error Makefile LUFA_PATH value not set.)\r
 \r
 # Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles\r
 LUFA_ROOT_PATH ?= $(LUFA_PATH)\r