Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
# #
# Note that the bootloader size and start address given in AVRStudio is in words and not # 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. # bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128 FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB = 8 BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application # 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 # 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. # 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_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_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287 MCU = at90usb1287
ARCH = AVR8 ARCH = AVR8
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
# #
# Note that the bootloader size and start address given in AVRStudio is in words and not # 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. # bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128 FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB = 8 BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application # 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 # 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. # 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_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_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287 MCU = at90usb1287
ARCH = AVR8 ARCH = AVR8
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
# #
# Note that the bootloader size and start address given in AVRStudio is in words and not # 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. # bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
FLASH_SIZE_KB = 128 FLASH_SIZE_KB := 128
BOOT_SECTION_SIZE_KB = 8 BOOT_SECTION_SIZE_KB := 8
# Formulas used to calculate the starting address of the Bootloader section, and the User Application # 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 # 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. # 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_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_API_TABLESTART := 0x$(shell echo "obase=16; (($(FLASH_SIZE_KB) * 1024) - 96)" | bc)
MCU = at90usb1287 MCU = at90usb1287
ARCH = AVR8 ARCH = AVR8
......
...@@ -48,7 +48,7 @@ AVRDUDE_PORT ?= usb ...@@ -48,7 +48,7 @@ AVRDUDE_PORT ?= usb
AVRDUDE_FLAGS ?= AVRDUDE_FLAGS ?=
# Output Messages # Output Messages
MSG_AVRDUDE_CMD = ' [AVRDUDE] :' MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS) AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS)
AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS) AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS)
......
...@@ -76,24 +76,24 @@ CC_FLAGS ?= ...@@ -76,24 +76,24 @@ CC_FLAGS ?=
# Determine the utility prefix to use for the selected architecture # Determine the utility prefix to use for the selected architecture
ifeq ($(ARCH), AVR8) ifeq ($(ARCH), AVR8)
CROSS = avr- CROSS := avr-
else ifeq ($(ARCH), XMEGA) else ifeq ($(ARCH), XMEGA)
CROSS = avr- CROSS := avr-
else ifeq ($(ARCH), UC3) else ifeq ($(ARCH), UC3)
CROSS = avr32- CROSS := avr32-
else else
$(error Unsupported architecture.) $(error Unsupported architecture.)
endif endif
# Output Messages # Output Messages
MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"... MSG_BUILD_BEGIN := Begin compilation of project \"$(TARGET)\"...
MSG_BUILD_END = Finished building project \"$(TARGET)\". MSG_BUILD_END := Finished building project \"$(TARGET)\".
MSG_COMPILE_CMD = ' [CC] :' MSG_COMPILE_CMD := ' [CC] :'
MSG_REMOVE_CMD = ' [RM] :' MSG_REMOVE_CMD := ' [RM] :'
MSG_LINKER_CMD = ' [LNK] :' MSG_LINKER_CMD := ' [LNK] :'
MSG_SIZE_CMD = ' [SIZE] :' MSG_SIZE_CMD := ' [SIZE] :'
MSG_OBJCPY_CMD = ' [OBJCPY] :' MSG_OBJCPY_CMD := ' [OBJCPY] :'
MSG_OBJDMP_CMD = ' [OBJDMP] :' MSG_OBJDMP_CMD := ' [OBJDMP] :'
# Convert input source file list to differentiate them by type # Convert input source file list to differentiate them by type
C_SOURCE = $(filter %.c, $(SRC)) C_SOURCE = $(filter %.c, $(SRC))
...@@ -138,8 +138,8 @@ ifneq ($(UNKNOWN_SOURCE),) ...@@ -138,8 +138,8 @@ ifneq ($(UNKNOWN_SOURCE),)
endif endif
# Determine flags to pass to the size utility based on its reported features # 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_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_FORMAT_FLAG := $(shell $(CROSS)size --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
begin: begin:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
LUFA_BUILD_MODULES += CORE 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_MANDATORY_VARS +=
LUFA_BUILD_OPTIONAL_VARS += LUFA_BUILD_OPTIONAL_VARS +=
...@@ -19,7 +19,6 @@ LUFA_BUILD_OPTIONAL_VARS += ...@@ -19,7 +19,6 @@ LUFA_BUILD_OPTIONAL_VARS +=
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# TARGETS: # TARGETS:
# #
# info - Build system information
# help - Build system help # help - Build system help
# list_targets - List all build targets # list_targets - List all build targets
# list_modules - List all build modules # list_modules - List all build modules
...@@ -38,14 +37,17 @@ LUFA_BUILD_OPTIONAL_VARS += ...@@ -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 "==================================================================="
@echo " LUFA Build System 2.0 " @echo " LUFA Build System 2.0 "
@echo " (C) Dean Camera { dean @ fourwalledcubicle . com } " @echo " (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com } "
@echo "===================================================================" @echo "==================================================================="
.PHONY: info
help: info
@echo "DESCRIPTION: " @echo "DESCRIPTION: "
@echo " This build system is a set of makefile modules for (GNU) Make, to " @echo " This build system is a set of makefile modules for (GNU) Make, to "
@echo " provide a simple system for building LUFA powered applications. " @echo " provide a simple system for building LUFA powered applications. "
...@@ -61,35 +63,35 @@ help: info ...@@ -61,35 +63,35 @@ help: info
@echo "===================================================================" @echo "==================================================================="
@echo " Currently used modules in this application: " @echo " Currently used modules in this application: "
@echo " " @echo " "
@echo " [" $(sort $(LUFA_BUILD_MODULES)) "]" @echo " [" $(SORTED_LUFA_BUILD_MODULES) "]"
@echo " " @echo " "
@echo " " @echo " "
@echo " Currently available build targets in this application: " @echo " Currently available build targets in this application: "
@echo " " @echo " "
@echo " [" $(sort $(LUFA_BUILD_TARGETS)) "]" @echo " [" $(SORTED_LUFA_BUILD_TARGETS) "]"
@echo " " @echo " "
@echo " " @echo " "
@echo " Mandatory variables required by the selected build Modules: " @echo " Mandatory variables required by the selected build Modules: "
@echo " " @echo " "
@echo " [" $(sort $(LUFA_BUILD_MANDATORY_VARS)) "]" @echo " [" $(SORTED_LUFA_MANDATORY_VARS) "]"
@echo " " @echo " "
@echo " " @echo " "
@echo " Optional variables required by the selected build Modules: " @echo " Optional variables required by the selected build Modules: "
@echo " " @echo " "
@echo " [" $(filter-out $(LUFA_BUILD_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS))) "]" @echo " [" $(SORTED_LUFA_OPTIONAL_VARS) "]"
@echo " " @echo " "
@echo "===================================================================" @echo "==================================================================="
@echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) " @echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) "
@echo "===================================================================" @echo "==================================================================="
list_targets:
@echo Currently Available Build Targets: $(sort $(LUFA_BUILD_TARGETS))
list_modules: 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: 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: 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.) ...@@ -41,9 +41,9 @@ MCU ?= $(error Makefile MCU value not set.)
TARGET ?= $(error Makefile TARGET value not set.) TARGET ?= $(error Makefile TARGET value not set.)
# Output Messages # Output Messages
MSG_COPY_CMD = ' [CP] :' MSG_COPY_CMD := ' [CP] :'
MSG_REMOVE_CMD = ' [RM] :' MSG_REMOVE_CMD := ' [RM] :'
MSG_DFU_CMD = ' [DFU] :' MSG_DFU_CMD := ' [DFU] :'
flip: $(TARGET).hex flip: $(TARGET).hex
@echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\" @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$(TARGET).hex\"
......
...@@ -44,7 +44,7 @@ DOXYGEN_FAIL_ON_WARNING ?= Y ...@@ -44,7 +44,7 @@ DOXYGEN_FAIL_ON_WARNING ?= Y
DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css
# Output Messages # Output Messages
MSG_DOXYGEN_CMD = ' [DOXYGEN] :' MSG_DOXYGEN_CMD := ' [DOXYGEN] :'
# Determine Doxygen invocation command # Determine Doxygen invocation command
BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen - BASE_DOXYGEN_CMD = ( cat Doxygen.conf $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen -
......
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
# Makefile for the LUFA library itself. # Makefile for the LUFA library itself.
# --------------------------------------- # ---------------------------------------
LUFA_VERSION_NUM = $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2) 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 EXCLUDE_FROM_EXPORT := Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.lss *.lst *.hex *.elf *.bin
DOXYGEN_OVERRIDE_PARAMS = PROJECT_NUMBER=$(LUFA_VERSION_NUM) DOXYGEN_OVERRIDE_PARAMS = PROJECT_NUMBER=$(LUFA_VERSION_NUM)
all: all:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment