LUFA_ROOT_PATH = $(LUFA_PATH)/LUFA
endif
+# Check to see if the chip architecture has not been defined in the user makefile, set a default architecture if not
+ifeq ($(origin ARCH), undefined)
+ ARCH = AVR8
+endif
+
# Define module source file lists
LUFA_SRC_USB = $(LUFA_ROOT_PATH)/Drivers/USB/LowLevel/Device.c \
$(LUFA_ROOT_PATH)/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDIS.c \
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImage.c
LUFA_SRC_TEMPERATURE = $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c
-LUFA_SRC_SERIAL = $(LUFA_ROOT_PATH)/Drivers/Peripheral/Serial.c
-LUFA_SRC_TWI = $(LUFA_ROOT_PATH)/Drivers/Peripheral/TWI.c
+LUFA_SRC_SERIAL = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial.c
+LUFA_SRC_TWI = $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI.c
LUFA_SRC_SCHEDULER = $(LUFA_ROOT_PATH)/Scheduler/Scheduler.c