Commit 7655205a authored by Dean Camera's avatar Dean Camera
Browse files

Clean up CORE build system module, use simple rather than recursive make...

Clean up CORE build system module, use simple rather than recursive make variables for internal constants and $(shell) derived values.
parent 450ff51b
......@@ -14,14 +14,14 @@
#
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 8
FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application
# API jump table (for more information on the latter, see the bootloader documentation). These formulas
# should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead.
BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
BOOT_START := 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287
ARCH = AVR8
......
......@@ -14,14 +14,14 @@
#
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 8
FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application
# API jump table (for more information on the latter, see the bootloader documentation). These formulas
# should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead.
BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
BOOT_START := 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287
ARCH = AVR8
......
......@@ -14,14 +14,14 @@
#
# Note that the bootloader size and start address given in AVRStudio is in words and not
# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128
BOOT_SECTION_SIZE_KB = 8
FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application
# API jump table (for more information on the latter, see the bootloader documentation). These formulas
# should not need to be altered - modify the FLASH_SIZE_KB and BOOT_SECTION_KB values above instead.
BOOT_START = 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART = 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
BOOT_START := 0x$(shell echo "obase=16; ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024" | bc)
BOOT_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287
ARCH = AVR8
......
......@@ -48,7 +48,7 @@ AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?=
# Output Messages
MSG_AVRDUDE_CMD = ' [AVRDUDE] :'
MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS)
AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS)
......
......@@ -76,24 +76,24 @@ CC_FLAGS ?=
# Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8)
CROSS = avr-
CROSS := avr-
else ifeq ($(ARCH), XMEGA)
CROSS = avr-
CROSS := avr-
else ifeq ($(ARCH), UC3)
CROSS = avr32-
CROSS := avr32-
else
$(error Unsupported architecture.)
endif
# 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_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))
......@@ -138,8 +138,8 @@ ifneq ($(UNKNOWN_SOURCE),)
endif
# Determine flags to pass to the size utility based on its reported features
SIZE_MCU_FLAG = $(shell $(CROSS)size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
SIZE_FORMAT_FLAG = $(shell $(CROSS)size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
SIZE_MCU_FLAG := $(shell $(CROSS)size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
SIZE_FORMAT_FLAG := $(shell $(CROSS)size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
begin:
......
......@@ -7,7 +7,7 @@
#
LUFA_BUILD_MODULES += CORE
LUFA_BUILD_TARGETS += info help list_targets list_modules list_mandatory list_optional
LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional
LUFA_BUILD_MANDATORY_VARS +=
LUFA_BUILD_OPTIONAL_VARS +=
......@@ -19,7 +19,6 @@ LUFA_BUILD_OPTIONAL_VARS +=
# -----------------------------------------------------------------------------
# TARGETS:
#
# info - Build system information
# help - Build system help
# list_targets - List all build targets
# list_modules - List all build modules
......@@ -38,14 +37,17 @@ LUFA_BUILD_OPTIONAL_VARS +=
#
# -----------------------------------------------------------------------------
info:
# Build sorted and filtered lists of the included build module data
SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES))
SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS))
SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS))
SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
help:
@echo "==================================================================="
@echo " LUFA Build System 2.0 "
@echo " (C) Dean Camera { dean @ fourwalledcubicle . com } "
@echo " LUFA Build System 2.0 "
@echo " (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com } "
@echo "==================================================================="
.PHONY: info
help: info
@echo "DESCRIPTION: "
@echo " This build system is a set of makefile modules for (GNU) Make, to "
@echo " provide a simple system for building LUFA powered applications. "
......@@ -61,35 +63,35 @@ help: info
@echo "==================================================================="
@echo " Currently used modules in this application: "
@echo " "
@echo " [" $(sort $(LUFA_BUILD_MODULES)) "]"
@echo " [" $(SORTED_LUFA_BUILD_MODULES) "]"
@echo " "
@echo " "
@echo " Currently available build targets in this application: "
@echo " "
@echo " [" $(sort $(LUFA_BUILD_TARGETS)) "]"
@echo " [" $(SORTED_LUFA_BUILD_TARGETS) "]"
@echo " "
@echo " "
@echo " Mandatory variables required by the selected build Modules: "
@echo " "
@echo " [" $(sort $(LUFA_BUILD_MANDATORY_VARS)) "]"
@echo " [" $(SORTED_LUFA_MANDATORY_VARS) "]"
@echo " "
@echo " "
@echo " Optional variables required by the selected build Modules: "
@echo " "
@echo " [" $(filter-out $(LUFA_BUILD_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS))) "]"
@echo " [" $(SORTED_LUFA_OPTIONAL_VARS) "]"
@echo " "
@echo "==================================================================="
@echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) "
@echo "==================================================================="
list_targets:
@echo Currently Available Build Targets: $(sort $(LUFA_BUILD_TARGETS))
list_modules:
@echo Currently Build Modules: $(sort $(LUFA_BUILD_MODULES))
@echo Currently Build Modules: $(SORTED_LUFA_BUILD_MODULES)
list_targets:
@echo Currently Available Build Targets: $(SORTED_LUFA_BUILD_TARGETS)
list_mandatory:
@echo Mandatory Variables for Included Modules: $(sort $(LUFA_BUILD_MANDATORY_VARS))
@echo Mandatory Variables for Included Modules: $(SORTED_LUFA_MANDATORY_VARS)
list_optional:
@echo Optional Variables for Included Modules: $(filter-out $(LUFA_BUILD_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS)))
@echo Optional Variables for Included Modules: $(SORTED_LUFA_OPTIONAL_VARS)
......@@ -41,9 +41,9 @@ 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] :'
MSG_COPY_CMD := ' [CP] :'
MSG_REMOVE_CMD := ' [RM] :'
MSG_DFU_CMD := ' [DFU] :'
flip: $(TARGET).hex
@echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"
......
......@@ -44,7 +44,7 @@ DOXYGEN_FAIL_ON_WARNING ?= Y
DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
# Output Messages
MSG_DOXYGEN_CMD = ' [DOXYGEN] :'
MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
# Determine Doxygen invocation command
BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
......
......@@ -9,8 +9,9 @@
# Makefile for the LUFA library itself.
# ---------------------------------------
LUFA_VERSION_NUM = $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2)
EXCLUDE_FROM_EXPORT = Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.lss *.lst *.hex *.elf *.bin
LUFA_VERSION_NUM := $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2)
EXCLUDE_FROM_EXPORT := Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.lss *.lst *.hex *.elf *.bin
DOXYGEN_OVERRIDE_PARAMS = PROJECT_NUMBER=$(LUFA_VERSION_NUM)
all:
......
Markdown is supported
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