3 # Copyright (C) Dean Camera, 2015.
5 # dean [at] fourwalledcubicle [dot] com
9 DMBS_BUILD_MODULES
+= LUFA_SOURCES
11 DMBS_BUILD_MANDATORY_VARS
+= LUFA_PATH ARCH
12 DMBS_BUILD_OPTIONAL_VARS
+=
13 DMBS_BUILD_PROVIDED_VARS
+= LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST \
14 LUFA_SRC_USB LUFA_SRC_USBCLASS_DEVICE \
15 LUFA_SRC_USBCLASS_HOST LUFA_SRC_USBCLASS \
16 LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL \
17 LUFA_SRC_TWI LUFA_SRC_PLATFORM
18 DMBS_BUILD_PROVIDED_MACROS
+=
22 ERROR_IF_UNSET ?
= $(if
$(filter undefined
, $(origin $(strip $(1)))), $(error Makefile
$(strip $(1)) value not set
))
23 ERROR_IF_EMPTY ?
= $(if
$(strip $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option cannot be blank
))
24 ERROR_IF_NONBOOL ?
= $(if
$(filter Y N
, $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option must be Y or N
))
26 # Sanity check user supplied values
27 $(foreach MANDATORY_VAR
, $(LUFA_BUILD_MANDATORY_VARS
), $(call ERROR_IF_UNSET
, $(MANDATORY_VAR
)))
28 $(call ERROR_IF_EMPTY
, LUFA_PATH
)
29 $(call ERROR_IF_EMPTY
, ARCH
)
31 # Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
32 LUFA_ROOT_PATH ?
= $(patsubst %/,%,$(LUFA_PATH
))
34 # Construct LUFA module source variables
35 LUFA_SRC_USB_COMMON
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/USBController_
$(ARCH
).c \
36 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/USBInterrupt_
$(ARCH
).c \
37 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/ConfigDescriptors.c \
38 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/Events.c \
39 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/USBTask.c \
40 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Common
/HIDParser.c \
42 LUFA_SRC_USB_HOST
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Host_
$(ARCH
).c \
43 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Pipe_
$(ARCH
).c \
44 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/PipeStream_
$(ARCH
).c \
45 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/HostStandardReq.c \
46 $(LUFA_SRC_USB_COMMON
)
48 LUFA_SRC_USB_DEVICE
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Device_
$(ARCH
).c \
49 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Endpoint_
$(ARCH
).c \
50 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/EndpointStream_
$(ARCH
).c \
51 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/DeviceStandardReq.c \
52 $(LUFA_SRC_USB_COMMON
)
54 LUFA_SRC_USBCLASS_DEVICE
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/AudioClassDevice.c \
55 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/CDCClassDevice.c \
56 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/HIDClassDevice.c \
57 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/MassStorageClassDevice.c \
58 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/MIDIClassDevice.c \
59 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/PrinterClassDevice.c \
60 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/RNDISClassDevice.c \
62 LUFA_SRC_USBCLASS_HOST
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/AndroidAccessoryClassHost.c \
63 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/AudioClassHost.c \
64 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/CDCClassHost.c \
65 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/HIDClassHost.c \
66 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/MassStorageClassHost.c \
67 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/MIDIClassHost.c \
68 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/PrinterClassHost.c \
69 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/RNDISClassHost.c \
70 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/StillImageClassHost.c
72 LUFA_SRC_USB
:= $(sort $(LUFA_SRC_USB_COMMON
) $(LUFA_SRC_USB_HOST
) $(LUFA_SRC_USB_DEVICE
))
74 LUFA_SRC_USBCLASS
:= $(LUFA_SRC_USBCLASS_DEVICE
) $(LUFA_SRC_USBCLASS_HOST
)
76 LUFA_SRC_TEMPERATURE
:= $(LUFA_ROOT_PATH
)/Drivers
/Board
/Temperature.c
78 LUFA_SRC_SERIAL
:= $(LUFA_ROOT_PATH
)/Drivers
/Peripheral
/$(ARCH
)/Serial_
$(ARCH
).c
80 LUFA_SRC_TWI
:= $(LUFA_ROOT_PATH
)/Drivers
/Peripheral
/$(ARCH
)/TWI_
$(ARCH
).c
83 LUFA_SRC_PLATFORM
:= $(LUFA_ROOT_PATH
)/Platform
/UC3
/Exception.S \
84 $(LUFA_ROOT_PATH
)/Platform
/UC3
/InterruptManagement.c
89 # Build a list of all available module sources
90 LUFA_SRC_ALL_FILES
:= $(LUFA_SRC_USB
) \
91 $(LUFA_SRC_USBCLASS
) \
92 $(LUFA_SRC_TEMPERATURE
) \