lufa_sources.mk 7.31 KB
Newer Older
1
2
#
#             LUFA Library
Dean Camera's avatar
Dean Camera committed
3
#     Copyright (C) Dean Camera, 2013.
4
5
6
7
8
#
#  dean [at] fourwalledcubicle [dot] com
#           www.lufa-lib.org
#

9
LUFA_BUILD_MODULES         += SOURCES
10
LUFA_BUILD_TARGETS         +=
11
LUFA_BUILD_MANDATORY_VARS  += LUFA_PATH ARCH
12
13
14
15
16
17
18
LUFA_BUILD_OPTIONAL_VARS   +=
LUFA_BUILD_PROVIDED_VARS   += LUFA_SRC_USB_DEVICE LUFA_SRC_USB_HOST    \
                              LUFA_SRC_USB LUFA_SRC_USBCLASS_DEVICE    \
                              LUFA_SRC_USBCLASS_HOST LUFA_SRC_USBCLASS \
                              LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL     \
                              LUFA_SRC_TWI LUFA_SRC_PLATFORM
LUFA_BUILD_PROVIDED_MACROS +=
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

# -----------------------------------------------------------------------------
#               LUFA Sources Buildsystem Makefile Module.
# -----------------------------------------------------------------------------
# DESCRIPTION:
#   Provides a set of makefile variables for the various LUFA module sources.
#   Once included, the sources required to use a given LUFA module will become
#   available using the makefile variable names listed in the LUFA project
#   documentation.
# -----------------------------------------------------------------------------
# TARGETS:
#
#    (None)
#
# MANDATORY PARAMETERS:
#
#    LUFA_PATH                 - Path to the LUFA library core
#    ARCH                      - Device architecture name
#
# OPTIONAL PARAMETERS:
#
#    (None)
#
42
43
# PROVIDED VARIABLES:
#
44
45
46
47
48
49
50
51
52
53
54
55
#    LUFA_SRC_USB_DEVICE       - List of LUFA USB driver source files required
#                                for USB Device mode only
#    LUFA_SRC_USB_HOST         - List of LUFA USB driver source files required
#                                for USB Host mode only
#    LUFA_SRC_USB              - List of LUFA USB driver source files for all
#                                USB modes
#    LUFA_SRC_USBCLASS_DEVICE  - List of LUFA USB Class driver source files for
#                                USB Device mode only
#    LUFA_SRC_USBCLASS_HOST    - List of LUFA USB Class driver source files for
#                                USB Host mode only
#    LUFA_SRC_USBCLASS         - List of LUFA USB Class driver source files for
#                                all USB modes
56
57
58
59
60
61
62
63
64
65
66
#    LUFA_SRC_TEMPERATURE      - List of LUFA temperature sensor driver source
#                                files
#    LUFA_SRC_SERIAL           - List of LUFA Serial U(S)ART driver source files
#    LUFA_SRC_TWI              - List of LUFA TWI driver source files
#    LUFA_SRC_PLATFORM         - List of LUFA architecture specific platform
#                                management source files
#
# PROVIDED MACROS:
#
#    (None)
#
67
68
# -----------------------------------------------------------------------------

69
70
71
72
73
SHELL = /bin/sh

ERROR_IF_UNSET   ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
ERROR_IF_EMPTY   ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
74

75
76
77
78
# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
$(call ERROR_IF_EMPTY, LUFA_PATH)
$(call ERROR_IF_EMPTY, ARCH)
79
80
81
82
83

# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles
LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH))

# Construct LUFA module source variables
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
LUFA_SRC_USB_COMMON      := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c   \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c    \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c               \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c                          \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c                         \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c               \

LUFA_SRC_USB_HOST        := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c            \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c            \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c      \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c                 \
                            $(LUFA_SRC_USB_COMMON)

LUFA_SRC_USB_DEVICE      := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c          \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c        \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c  \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c               \
                            $(LUFA_SRC_USB_COMMON)

LUFA_SRC_USBCLASS_DEVICE := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c        \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c          \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c          \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c  \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c         \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c        \

LUFA_SRC_USBCLASS_HOST   := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c            \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c              \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c              \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c      \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c             \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c          \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c            \
                            $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c

LUFA_SRC_USB             := $(LUFA_SRC_USB_COMMON) $(LUFA_SRC_USB_HOST) $(LUFA_SRC_USB_DEVICE)

LUFA_SRC_USBCLASS        := $(LUFA_SRC_USBCLASS_DEVICE) $(LUFA_SRC_USBCLASS_HOST)

LUFA_SRC_TEMPERATURE     := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c

LUFA_SRC_SERIAL          := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c

LUFA_SRC_TWI             := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c
129
130

ifeq ($(ARCH), UC3)
131
132
   LUFA_SRC_PLATFORM     := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S   \
                            $(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c
133
else
134
   LUFA_SRC_PLATFORM     :=
135
136
137
endif

# Build a list of all available module sources
138
139
140
141
142
LUFA_SRC_ALL_FILES   := $(LUFA_SRC_USB)            \
                        $(LUFA_SRC_USBCLASS)       \
                        $(LUFA_SRC_TEMPERATURE)    \
                        $(LUFA_SRC_SERIAL)         \
                        $(LUFA_SRC_TWI)            \
143
                        $(LUFA_SRC_PLATFORM)