Commit 29874f6d authored by Dean Camera's avatar Dean Camera
Browse files

Simplify build system mandatory parameter/variable sanity checks.

parent 276eb35d
......@@ -36,20 +36,16 @@ LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
# -----------------------------------------------------------------------------
# Output Messages
MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
# Default values of user-supplied variables
AVRDUDE_PROGRAMMER ?= jtagicemkii
AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex
AVRDUDE_PROGRAMMER ?= jtagicemkii
AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?= -U flash:w:$(TARGET).hex
# Sanity check the user MCU and TARGET makefile options
ifeq ($(MCU),)
$(error Makefile MCU value not set.)
endif
ifeq ($(TARGET),)
$(error Makefile TARGET value not set.)
endif
MCU ?= $(error Makefile MCU value not set.)
TARGET ?= $(error Makefile TARGET value not set.)
program: $(TARGET).hex
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
......
......@@ -56,43 +56,31 @@ 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] :'
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
ifeq ($(TARGET),)
$(error Makefile TARGET value not set.)
endif
ifeq ($(ARCH),)
$(error Makefile ARCH value not set.)
endif
ifeq ($(MCU),)
$(error Makefile MCU value not set.)
endif
ifeq ($(SRC),)
$(error Makefile SRC value not set.)
endif
ifeq ($(F_USB),)
$(error Makefile F_USB value not set.)
endif
ifeq ($(LUFA_PATH),)
$(error Makefile LUFA_PATH value not set.)
endif
MCU ?= $(error Makefile MCU value not set.)
TARGET ?= $(error Makefile TARGET value not set.)
ARCH ?= $(error Makefile ARCH value not set.)
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
BOARD ?= NONE
OPTIMIZATION ?= s
F_CPU ?=
C_STANDARD ?= gnu99
CPP_STANDARD ?= gnu++98
C_FLAGS ?=
CPP_FLAGS ?=
ASM_FLAGS ?=
CC_FLAGS ?=
BOARD ?= NONE
OPTIMIZATION ?= s
F_CPU ?=
C_STANDARD ?= gnu99
CPP_STANDARD ?= gnu++98
C_FLAGS ?=
CPP_FLAGS ?=
ASM_FLAGS ?=
CC_FLAGS ?=
# Convert input source file list to differentiate them by type
C_SOURCE = $(filter %.c, $(SRC))
......
......@@ -37,15 +37,13 @@ LUFA_BUILD_OPTIONAL_VARS +=
# -----------------------------------------------------------------------------
# Output Messages
MSG_DFU_CMD = ' [DFU] :'
MSG_COPY_CMD = ' [CP] :'
MSG_REMOVE_CMD = ' [RM] :'
MSG_DFU_CMD = ' [DFU] :'
# Sanity check the user MCU and TARGET makefile options
ifeq ($(MCU),)
$(error Makefile MCU value not set.)
endif
ifeq ($(TARGET),)
$(error Makefile TARGET value not set.)
endif
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\"
......@@ -54,11 +52,13 @@ flip: $(TARGET).hex
batchisp -hardware usb -device $(MCU) -operation start reset 0
flip-ee: $(TARGET).eep
@echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$(TARGET)eep.hex\"
cp $(TARGET).eep $(TARGET)eep.hex
@echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$(TARGET).eep\"
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
batchisp -hardware usb -device $(MCU) -operation start reset 0
@echo $(MSG_DFU_CMD) Removing temporary file \"$(TARGET)eep.hex\"
rm $(TARGET)eep.hex
dfu: $(TARGET).hex
......
......@@ -36,7 +36,7 @@ LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRI
# -----------------------------------------------------------------------------
# Output Messages
MSG_DOXYGEN_CMD = ' [DOXYGEN] :'
MSG_DOXYGEN_CMD = ' [DOXYGEN] :'
# Default values of user-supplied variables
DOXYGEN_CONF ?= Doxygen.conf
......
......@@ -36,12 +36,8 @@ LUFA_BUILD_OPTIONAL_VARS +=
# -----------------------------------------------------------------------------
# Sanity check the user LUFA_PATH and ARCH makefile options
ifeq ($(LUFA_PATH),)
$(error Makefile LUFA_PATH value not set.)
endif
ifeq ($(ARCH),)
$(error Makefile ARCH value not set.)
endif
ARCH ?= $(error Makefile ARCH value not set.)
LUFA_PATH ?= $(error Makefile LUFA_PATH value not set.)
# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
LUFA_ROOT_PATH ?= $(LUFA_PATH)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment