aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-06-01 23:23:18 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-06-01 23:23:18 +0000
commit26cc2e9fa80c04ece990349383adc0206613f8ab (patch)
treea2c7cb1fd4bcd02ec075cb39aff91c0026f5745b /LUFA
parent56e792c95b1a29e61d9204a8f7f305d7f33261f1 (diff)
downloadlufa-26cc2e9fa80c04ece990349383adc0206613f8ab.tar.gz
lufa-26cc2e9fa80c04ece990349383adc0206613f8ab.tar.bz2
lufa-26cc2e9fa80c04ece990349383adc0206613f8ab.zip
Make BUILD build system module not destroy C++ source files, and support multiple architectures.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Build/lufa.build.in34
1 files changed, 22 insertions, 12 deletions
diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in
index e9921efb7..3f9d446e3 100644
--- a/LUFA/Build/lufa.build.in
+++ b/LUFA/Build/lufa.build.in
@@ -86,16 +86,27 @@ CPP_STANDARD ?= c++98
# Convert input source file list to differentiate them by type
C_SOURCE = $(filter %.c, $(SRC))
-CPP_SOURCE = $(filter %.cpp, $(SRC)) $(filter %.c++, $(SRC))
+CPP_SOURCE = $(filter %.cpp, $(SRC))
ASM_SOURCE = $(filter %.S, $(SRC))
# Convert input source filenames into a list of required output object files
-OBJECT_FILES = $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.c++=%.o) $(CPP_SOURCE:%.c++=%.o) $(ASM_SOURCE:%.S=%.o)
+OBJECT_FILES = $(filter %.o, $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.cpp=%.o) $(ASM_SOURCE:%.S=%.o))
# Create a list of flags to pass to the compiler
-CC_FLAGS += -mmcu=$(MCU) -I. -I$(LUFA_PATH)/.. -gdwarf-2 -pipe
+ifeq ($(ARCH),AVR8)
+ CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
+ CROSS = avr-
+else ifeq ($(ARCH),XMEGA)
+ CC_FLAGS += -mmcu=$(MCU) -gdwarf-2 -fshort-enums -fno-inline-small-functions -fpack-struct
+ CROSS = avr-
+else ifeq ($(ARCH),UC3)
+ CC_FLAGS += -mpart=$(MCU) -g3 -masm-addr-pseudos
+ CROSS = avr32-
+endif
+
+CC_FLAGS += -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
CC_FLAGS += -Wall -Wstrict-prototypes
-CC_FLAGS += -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -fshort-enums -fno-inline-small-functions -fpack-struct -fshort-enums
+CC_FLAGS += -I. -I$(LUFA_PATH)/.. -pipe
CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
ifneq ($(F_CPU),)
CC_FLAGS += -DF_CPU=$(F_CPU)UL
@@ -147,33 +158,32 @@ lss: $(TARGET).lss
%.o: %.c
@echo $(MSG_COMPILE_CMD) Compiling C file \"$^\"
- avr-gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(C_STANDARD) $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(C_STANDARD) $< -o $@
%.o: %.cpp
-%.o: %.c++
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$^\"
- avr-gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(CPP_STANDARD) -x c++ $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) --std=$(CPP_STANDARD) -x c++ $< -o $@
%.o: %.S
@echo $(MSG_COMPILE_CMD) Assembling \"$^\"
- avr-gcc -c $(CC_FLAGS) -x assembler-with-cpp $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) -x assembler-with-cpp $< -o $@
.PRECIOUS : $(OBJECT_FILES)
%.elf: $(OBJECT_FILES)
@echo $(MSG_LINKER_CMD) Linking object files into \"$@\"
- avr-gcc $^ $(CC_FLAGS) $(LD_FLAGS) -o $@
+ $(CROSS)gcc $^ $(CC_FLAGS) $(LD_FLAGS) -o $@
%.hex: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$@\"
- avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
+ $(CROSS)objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@
%.eep: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$@\"
- avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0
+ $(CROSS)objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0
%.lss: %.elf
@echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$@\"
- avr-objdump -h -S -z $< > $@
+ $(CROSS)objdump -h -S -z $< > $@
clean:
@echo $(MSG_REMOVE_CMD) Removing object files \"$(OBJECT_FILES)\"