From 29874f6db7db635e3cb6ee39a595334fc1c6514a Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 2 Jun 2012 12:00:51 +0000 Subject: Simplify build system mandatory parameter/variable sanity checks. --- LUFA/Build/lufa.avrdude.in | 16 ++++++-------- LUFA/Build/lufa.build.in | 54 ++++++++++++++++++---------------------------- LUFA/Build/lufa.dfu.in | 14 ++++++------ LUFA/Build/lufa.doxygen.in | 2 +- LUFA/Build/lufa.sources.in | 8 ++----- 5 files changed, 37 insertions(+), 57 deletions(-) (limited to 'LUFA') diff --git a/LUFA/Build/lufa.avrdude.in b/LUFA/Build/lufa.avrdude.in index e2b8e5730..fdc5bc1d7 100644 --- a/LUFA/Build/lufa.avrdude.in +++ b/LUFA/Build/lufa.avrdude.in @@ -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)\" diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in index 1cdb75a6d..6c9133f83 100644 --- a/LUFA/Build/lufa.build.in +++ b/LUFA/Build/lufa.build.in @@ -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)) diff --git a/LUFA/Build/lufa.dfu.in b/LUFA/Build/lufa.dfu.in index ac5edeadc..8c478db84 100644 --- a/LUFA/Build/lufa.dfu.in +++ b/LUFA/Build/lufa.dfu.in @@ -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 diff --git a/LUFA/Build/lufa.doxygen.in b/LUFA/Build/lufa.doxygen.in index 26cd40d7e..039967cad 100644 --- a/LUFA/Build/lufa.doxygen.in +++ b/LUFA/Build/lufa.doxygen.in @@ -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 diff --git a/LUFA/Build/lufa.sources.in b/LUFA/Build/lufa.sources.in index 37263b602..a2e02e979 100644 --- a/LUFA/Build/lufa.sources.in +++ b/LUFA/Build/lufa.sources.in @@ -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) -- cgit v1.2.3