This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
/
ubxlib.mk
241 lines (214 loc) · 8.68 KB
/
ubxlib.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# This is a shared Makefile used for the ports using classic make build system.
# It is used for collecting source code files and include directories
# that are selected based on UBXLIB_FEATURES. Check README.md for details.
# For each entry in UBXLIB_MODULE_DIRS the following will be done:
# * Append /api and add result to UBXLIB_INC
# * Append /src and add result to UBXLIB_SRC_DIRS
# * Append /test and add result to UBXLIB_TEST_DIRS
UBXLIB_MODULE_DIRS = \
${UBXLIB_BASE}/common/at_client \
${UBXLIB_BASE}/common/error \
${UBXLIB_BASE}/common/assert \
${UBXLIB_BASE}/common/timeout \
${UBXLIB_BASE}/common/location \
${UBXLIB_BASE}/common/mqtt_client \
${UBXLIB_BASE}/common/http_client \
${UBXLIB_BASE}/common/security \
${UBXLIB_BASE}/common/sock \
${UBXLIB_BASE}/common/ubx_protocol \
${UBXLIB_BASE}/common/spartn \
${UBXLIB_BASE}/common/utils \
${UBXLIB_BASE}/common/dns \
${UBXLIB_BASE}/common/geofence \
${UBXLIB_BASE}/port/platform/common/debug_utils
# Additional source directories
UBXLIB_SRC_DIRS += \
${UBXLIB_BASE}/port/platform/common/event_queue \
${UBXLIB_BASE}/port/platform/common/mutex_debug \
${UBXLIB_BASE}/port/platform/common/log_ram
# Additional include directories
UBXLIB_INC += \
${UBXLIB_BASE} \
${UBXLIB_BASE}/cfg \
${UBXLIB_BASE}/common/type/api \
${UBXLIB_BASE}/port/api
UBXLIB_PRIVATE_INC += \
${UBXLIB_BASE}/port/platform/common/event_queue \
${UBXLIB_BASE}/port/platform/common/mutex_debug \
${UBXLIB_BASE}/port/platform/common/debug_utils/src/freertos/additions \
${UBXLIB_BASE}/port/platform/common/log_ram
SRC_LIST =
# Device and network require special care since they contain stub & optional files
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network.c
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network_shared.c
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network_private_ble_extmod_stub.c
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network_private_cell_stub.c
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network_private_gnss_stub.c
SRC_LIST += ${UBXLIB_BASE}/common/network/src/u_network_private_wifi_stub.c
UBXLIB_INC += ${UBXLIB_BASE}/common/network/api
UBXLIB_PRIVATE_INC += ${UBXLIB_BASE}/common/network/src
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_serial.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_serial_wrapped.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_shared.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_private.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_private_cell_stub.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_private_gnss_stub.c
SRC_LIST += ${UBXLIB_BASE}/common/device/src/u_device_private_short_range_stub.c
UBXLIB_INC += ${UBXLIB_BASE}/common/device/api
UBXLIB_PRIVATE_INC += ${UBXLIB_BASE}/common/device/src
# Default malloc()/free() implementation
SRC_LIST += ${UBXLIB_BASE}/port/u_port_heap.c
# Default uPortGetTimezoneOffsetSeconds() implementation
SRC_LIST += ${UBXLIB_BASE}/port/u_port_timezone.c
# Default uPortXxxResource implementation
SRC_LIST += ${UBXLIB_BASE}/port/u_port_resource.c
# Default implementation for certain uPortGpioXxx(), uPortI2cXxx() and uPortSpiXxx() functions
SRC_LIST += ${UBXLIB_BASE}/port/u_port_gpio_default.c
SRC_LIST += ${UBXLIB_BASE}/port/u_port_i2c_default.c
SRC_LIST += ${UBXLIB_BASE}/port/u_port_spi_default.c
# Default implementation for uPortNamePipeXxx()
SRC_LIST += ${UBXLIB_BASE}/port/u_port_named_pipe_default.c
# Default uPortPppAttach()/uPortPppDetach() implementation
SRC_LIST += ${UBXLIB_BASE}/port/u_port_ppp_default.c
# Default uPortDeviceXxx implementation
SRC_LIST += ${UBXLIB_BASE}/port/u_port_board_cfg.c
# Optional short range related files and directories
ifneq ($(filter short_range,$(UBXLIB_FEATURES)),)
UBXLIB_MODULE_DIRS += \
${UBXLIB_BASE}/common/short_range \
${UBXLIB_BASE}/ble \
${UBXLIB_BASE}/wifi
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_ble_extmod.c \
${UBXLIB_BASE}/common/network/src/u_network_private_ble_intmod.c \
${UBXLIB_BASE}/common/network/src/u_network_private_wifi.c \
${UBXLIB_BASE}/common/device/src/u_device_private_short_range.c
else
# Make the linker happy
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_ble_extmod_link.c \
${UBXLIB_BASE}/common/network/src/u_network_private_wifi_link.c \
${UBXLIB_BASE}/common/device/src/u_device_private_short_range_link.c
# Always add all of the includes
UBXLIB_INC += \
${UBXLIB_BASE}/common/short_range/api \
${UBXLIB_BASE}/ble/api \
${UBXLIB_BASE}/wifi/api
UBXLIB_PRIVATE_INC += \
${UBXLIB_BASE}/common/short_range/src \
${UBXLIB_BASE}/ble/src \
${UBXLIB_BASE}/wifi/src
UBXLIB_TEST_INC += \
${UBXLIB_BASE}/common/short_range/test \
${UBXLIB_BASE}/ble/test \
${UBXLIB_BASE}/wifi/test
endif
# Optional cell related files and directories
ifneq ($(filter cell,$(UBXLIB_FEATURES)),)
UBXLIB_MODULE_DIRS += ${UBXLIB_BASE}/cell
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_cell.c \
${UBXLIB_BASE}/common/device/src/u_device_private_cell.c
else
# Make the linker happy
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_cell_link.c \
${UBXLIB_BASE}/common/device/src/u_device_private_cell_link.c
# Always add all of the includes
UBXLIB_INC += \
${UBXLIB_BASE}/cell/api
UBXLIB_PRIVATE_INC += \
${UBXLIB_BASE}/cell/src
UBXLIB_TEST_INC += \
${UBXLIB_BASE}/cell/test
endif
# Optional GNSS related files and directories
ifneq ($(filter gnss,$(UBXLIB_FEATURES)),)
UBXLIB_MODULE_DIRS += ${UBXLIB_BASE}/gnss
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_gnss.c \
${UBXLIB_BASE}/common/device/src/u_device_private_gnss.c \
${UBXLIB_BASE}/common/geofence/src/dummy/u_geofence_geodesic.c \
${UBXLIB_BASE}/gnss/src/lib_mga/u_lib_mga.c
else
# Make the linker happy
SRC_LIST += \
${UBXLIB_BASE}/common/network/src/u_network_private_gnss_link.c \
${UBXLIB_BASE}/common/device/src/u_device_private_gnss_link.c
# Always add all of the includes
UBXLIB_INC += \
${UBXLIB_BASE}/gnss/api
UBXLIB_PRIVATE_INC += \
${UBXLIB_BASE}/gnss/src
UBXLIB_TEST_INC += \
${UBXLIB_BASE}/gnss/test
endif
# The lib_mga subdirectory won't be added by the UBXLIB_MODULE_DIRS, so add it explicitly here for all cases
UBXLIB_PRIVATE_INC += \
${UBXLIB_BASE}/gnss/src/lib_mga
# lib_common
ifneq ($(filter u_lib,$(UBXLIB_FEATURES)),)
UBXLIB_INC += ${UBXLIB_BASE}/common/lib_common/api
UBXLIB_SRC_DIRS += ${UBXLIB_BASE}/common/lib_common/src
endif
# Extra test directories
UBXLIB_TEST_DIRS += \
${UBXLIB_BASE}/port/platform/common/runner \
${UBXLIB_BASE}/port/platform/common/test_util \
${UBXLIB_BASE}/port/platform/common/test \
${UBXLIB_BASE}/port/test \
${UBXLIB_BASE}/common/device/test \
${UBXLIB_BASE}/common/network/test
# Examples are compiled as tests
UBXLIB_TEST_DIRS += \
${UBXLIB_BASE}/example/sockets \
${UBXLIB_BASE}/example/security \
${UBXLIB_BASE}/example/mqtt_client \
${UBXLIB_BASE}/example/http_client \
${UBXLIB_BASE}/example/location \
${UBXLIB_BASE}/example/cell/lte_cfg \
${UBXLIB_BASE}/example/cell/power_saving \
${UBXLIB_BASE}/example/gnss \
${UBXLIB_BASE}/example/utilities/c030_module_fw_update
# For each module dir:
# * Append /api and add result to UBXLIB_INC
# * Append /src and add result to UBXLIB_SRC_DIRS
# * Append /src and add result to UBXLIB_PRIVATE_INC
# * Append /test and add result to UBXLIB_TEST_DIRS
UBXLIB_INC += $(wildcard $(addsuffix /api, $(UBXLIB_MODULE_DIRS)))
UBXLIB_SRC_DIRS += $(wildcard $(addsuffix /src, $(UBXLIB_MODULE_DIRS)))
UBXLIB_PRIVATE_INC += $(wildcard $(addsuffix /src, $(UBXLIB_MODULE_DIRS)))
UBXLIB_TEST_DIRS += $(wildcard $(addsuffix /test, $(UBXLIB_MODULE_DIRS)))
# Get all .c files in each UBXLIB_SRC_DIRS and add these to UBXLIB_SRC
SRC_LIST += \
$(foreach dir, $(UBXLIB_SRC_DIRS), \
$(sort $(wildcard $(dir)/*.c)) \
)
# Add all the files to UBXLIB_SRC variable.
# Check for possible gen2 replacements when feature is set.
ifneq ($(filter short_range_gen2,$(UBXLIB_FEATURES)),)
UBXLIB_SRC += \
$(foreach file,\
$(SRC_LIST),\
$(if \
$(wildcard $(dir $(file))gen2/$(notdir $(file))),\
$(dir $(file))gen2/$(notdir $(file)),\
$(file)\
)\
)
# Shortrange second generation AT module
GEN2_AT_DIR = ${UBXLIB_BASE}/common/short_range/src/gen2/ucxclient
UBXLIB_INC += ${GEN2_AT_DIR}/inc ${GEN2_AT_DIR}/ucx_api
UBXLIB_SRC += $(sort $(wildcard ${GEN2_AT_DIR}/src/*.c))
UBXLIB_SRC += $(sort $(wildcard ${GEN2_AT_DIR}/ucx_api/*.c))
override CFLAGS += -DU_UCONNECT_GEN2 -DU_CX_AT_CONFIG_FILE="\"../../ucx_config.h\""
else
UBXLIB_SRC += $(SRC_LIST)
endif
# Get all .c files in each UBXLIB_TEST_DIRS and add these to UBXLIB_TEST_SRC
UBXLIB_TEST_SRC += \
$(foreach dir, $(UBXLIB_TEST_DIRS), \
$(sort $(wildcard $(dir)/*.c)) \
)
UBXLIB_TEST_INC += $(UBXLIB_TEST_DIRS)