3 # Copyright (C) Dean Camera, 2015.
5 # dean [at] fourwalledcubicle [dot] com
9 LUFA_BUILD_MODULES
+= SOURCES
11 LUFA_BUILD_MANDATORY_VARS
+= LUFA_PATH ARCH
12 LUFA_BUILD_OPTIONAL_VARS
+=
13 LUFA_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 LUFA_BUILD_PROVIDED_MACROS
+=
20 # -----------------------------------------------------------------------------
21 # LUFA Sources Buildsystem Makefile Module.
22 # -----------------------------------------------------------------------------
24 # Provides a set of makefile variables for the various LUFA module sources.
25 # Once included, the sources required to use a given LUFA module will become
26 # available using the makefile variable names listed in the LUFA project
28 # -----------------------------------------------------------------------------
33 # MANDATORY PARAMETERS:
35 # LUFA_PATH - Path to the LUFA library core
36 # ARCH - Device architecture name
38 # OPTIONAL PARAMETERS:
44 # LUFA_SRC_USB_DEVICE - List of LUFA USB driver source files required
45 # for USB Device mode only
46 # LUFA_SRC_USB_HOST - List of LUFA USB driver source files required
47 # for USB Host mode only
48 # LUFA_SRC_USB - List of LUFA USB driver source files for all
50 # LUFA_SRC_USBCLASS_DEVICE - List of LUFA USB Class driver source files for
51 # USB Device mode only
52 # LUFA_SRC_USBCLASS_HOST - List of LUFA USB Class driver source files for
54 # LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files for
56 # LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source
58 # LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files
59 # LUFA_SRC_TWI - List of LUFA TWI driver source files
60 # LUFA_SRC_PLATFORM - List of LUFA architecture specific platform
61 # management source files
67 # -----------------------------------------------------------------------------
71 ERROR_IF_UNSET ?
= $(if
$(filter undefined
, $(origin $(strip $(1)))), $(error Makefile
$(strip $(1)) value not set
))
72 ERROR_IF_EMPTY ?
= $(if
$(strip $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option cannot be blank
))
73 ERROR_IF_NONBOOL ?
= $(if
$(filter Y N
, $($(strip $(1)))), , $(error Makefile
$(strip $(1)) option must be Y or N
))
75 # Sanity check user supplied values
76 $(foreach MANDATORY_VAR
, $(LUFA_BUILD_MANDATORY_VARS
), $(call ERROR_IF_UNSET
, $(MANDATORY_VAR
)))
77 $(call ERROR_IF_EMPTY
, LUFA_PATH
)
78 $(call ERROR_IF_EMPTY
, ARCH
)
80 # Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
81 LUFA_ROOT_PATH ?
= $(patsubst %/,%,$(LUFA_PATH
))
83 # Construct LUFA module source variables
84 LUFA_SRC_USB_COMMON
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/USBController_
$(ARCH
).c \
85 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/USBInterrupt_
$(ARCH
).c \
86 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/ConfigDescriptors.c \
87 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/Events.c \
88 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/USBTask.c \
89 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Common
/HIDParser.c \
91 LUFA_SRC_USB_HOST
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Host_
$(ARCH
).c \
92 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Pipe_
$(ARCH
).c \
93 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/PipeStream_
$(ARCH
).c \
94 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/HostStandardReq.c \
95 $(LUFA_SRC_USB_COMMON
)
97 LUFA_SRC_USB_DEVICE
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Device_
$(ARCH
).c \
98 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/Endpoint_
$(ARCH
).c \
99 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/$(ARCH
)/EndpointStream_
$(ARCH
).c \
100 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Core
/DeviceStandardReq.c \
101 $(LUFA_SRC_USB_COMMON
)
103 LUFA_SRC_USBCLASS_DEVICE
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/AudioClassDevice.c \
104 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/CDCClassDevice.c \
105 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/HIDClassDevice.c \
106 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/MassStorageClassDevice.c \
107 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/MIDIClassDevice.c \
108 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/PrinterClassDevice.c \
109 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Device
/RNDISClassDevice.c \
111 LUFA_SRC_USBCLASS_HOST
:= $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/AndroidAccessoryClassHost.c \
112 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/AudioClassHost.c \
113 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/CDCClassHost.c \
114 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/HIDClassHost.c \
115 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/MassStorageClassHost.c \
116 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/MIDIClassHost.c \
117 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/PrinterClassHost.c \
118 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/RNDISClassHost.c \
119 $(LUFA_ROOT_PATH
)/Drivers
/USB
/Class
/Host
/StillImageClassHost.c
121 LUFA_SRC_USB
:= $(sort $(LUFA_SRC_USB_COMMON
) $(LUFA_SRC_USB_HOST
) $(LUFA_SRC_USB_DEVICE
))
123 LUFA_SRC_USBCLASS
:= $(LUFA_SRC_USBCLASS_DEVICE
) $(LUFA_SRC_USBCLASS_HOST
)
125 LUFA_SRC_TEMPERATURE
:= $(LUFA_ROOT_PATH
)/Drivers
/Board
/Temperature.c
127 LUFA_SRC_SERIAL
:= $(LUFA_ROOT_PATH
)/Drivers
/Peripheral
/$(ARCH
)/Serial_
$(ARCH
).c
129 LUFA_SRC_TWI
:= $(LUFA_ROOT_PATH
)/Drivers
/Peripheral
/$(ARCH
)/TWI_
$(ARCH
).c
132 LUFA_SRC_PLATFORM
:= $(LUFA_ROOT_PATH
)/Platform
/UC3
/Exception.S \
133 $(LUFA_ROOT_PATH
)/Platform
/UC3
/InterruptManagement.c
138 # Build a list of all available module sources
139 LUFA_SRC_ALL_FILES
:= $(LUFA_SRC_USB
) \
140 $(LUFA_SRC_USBCLASS
) \
141 $(LUFA_SRC_TEMPERATURE
) \