X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/7655205aac2ae8aca89bcd4e3e056bb20a33414c..41b4c5b645ffe8ae3c22af00e6613c4dec8758be:/LUFA/Build/lufa.build.in diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in index 3b28db9ee..115763ab4 100644 --- a/LUFA/Build/lufa.build.in +++ b/LUFA/Build/lufa.build.in @@ -7,12 +7,12 @@ # LUFA_BUILD_MODULES += BUILD -LUFA_BUILD_TARGETS += size checksource all elf hex lss gcc_version clean +LUFA_BUILD_TARGETS += size all elf hex lss clean LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS # ----------------------------------------------------------------------------- -# LUFA Compiler Buildsystem Makefile Module. +# LUFA GCC Compiler Buildsystem Makefile Module. # ----------------------------------------------------------------------------- # DESCRIPTION: # Provides a set of targets to build a C, C++ and/or Assembly application @@ -20,13 +20,11 @@ LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_ # ----------------------------------------------------------------------------- # TARGETS: # -# size - List application size -# checksource - Check existance of listed input source files +# size - List built application size # all - Build application and list size # elf - Build application ELF debug object file # hex - Build application HEX object files # lss - Build application LSS assembly listing file -# gcc_version - Print version of GCC used # clean - Remove output files # # MANDATORY PARAMETERS: @@ -56,12 +54,25 @@ LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_ # ----------------------------------------------------------------------------- # Sanity-check values of mandatory user-supplied variables -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.) +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) + +ifeq ($(MCU),) + $(error Makefile MCU option cannot be blank) +endif +ifeq ($(TARGET),) + $(error Makefile TARGET option cannot be blank) +endif +ifeq ($(ARCH),) + $(error Makefile ARCH option cannot be blank) +endif +ifeq ($(F_USB),) + $(error Makefile F_USB option cannot be blank) +endif # Default values of optionally user-supplied variables BOARD ?= NONE @@ -82,7 +93,7 @@ else ifeq ($(ARCH), XMEGA) else ifeq ($(ARCH), UC3) CROSS := avr32- else - $(error Unsupported architecture.) + $(error Unsupported architecture "$(ARCH)".) endif # Output Messages @@ -155,12 +166,11 @@ end: gcc_version: @$(CROSS)gcc --version -checksource: - @for f in $(SRC) $(CPPSRC) $(ASRC); do \ - if [ -f $$f ]; then \ - echo "Found Source File: $$f" ; \ - else \ - echo "Source File Not Found: $$f" ; \ +check_source: + @for f in $(SRC); do \ + if [ ! -f $$f ]; then \ + echo "Error: Source file not found: $$f"; \ + exit 1; \ fi; \ done @@ -170,22 +180,29 @@ size: $(CROSS)size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $(TARGET).elf ; 2>/dev/null; \ fi -.PHONY: begin gcc_version elf hex lss size end -all: begin gcc_version elf hex lss size end +clean: + @echo $(MSG_REMOVE_CMD) Removing object files \"$(strip $(notdir $(OBJECT_FILES)))\" + rm -f $(OBJECT_FILES) + @echo $(MSG_REMOVE_CMD) Removing dependency files \"$(strip $(notdir $(DEPENDENCY_FILES)))\" + rm -f $(DEPENDENCY_FILES) + @echo $(MSG_REMOVE_CMD) Removing output files \"$(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss\" + rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss + +all: begin check_source gcc_version elf hex lss size end elf: $(TARGET).elf hex: $(TARGET).hex $(TARGET).eep lss: $(TARGET).lss -%.o: %.c +%.o: %.c $(MAKEFILE_LIST) @echo $(MSG_COMPILE_CMD) Compiling C file \"$<\" $(CROSS)gcc -c $(CC_FLAGS) $(C_FLAGS) $< -o $@ -%.o: %.cpp +%.o: %.cpp $(MAKEFILE_LIST) @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$<\" $(CROSS)gcc -c $(CC_FLAGS) $(CPP_FLAGS) -x c++ $< -o $@ -%.o: %.S +%.o: %.S $(MAKEFILE_LIST) @echo $(MSG_COMPILE_CMD) Assembling \"$<\" $(CROSS)gcc -c $(CC_FLAGS) $(ASM_FLAGS) -x assembler-with-cpp $< -o $@ @@ -206,13 +223,8 @@ lss: $(TARGET).lss @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\" $(CROSS)objdump -h -S -z $< > $@ -clean: - @echo $(MSG_REMOVE_CMD) Removing object files \"$(strip $(notdir $(OBJECT_FILES)))\" - rm -f $(OBJECT_FILES) - @echo $(MSG_REMOVE_CMD) Removing dependency files \"$(strip $(notdir $(DEPENDENCY_FILES)))\" - rm -f $(DEPENDENCY_FILES) - @echo $(MSG_REMOVE_CMD) Removing output files \"$(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss\" - rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss - # Include build dependency files --include $(DEPENDENCY_FILES) \ No newline at end of file +-include $(DEPENDENCY_FILES) + +# Phony build targets for this module +.PHONY: begin end gcc_version check_source size elf hex lss clean \ No newline at end of file