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 102
/
Copy pathubxlib.mk
181 lines (162 loc) · 6.58 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
# 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/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}/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
# Device and network require special care since they contain stub & optional files
UBXLIB_SRC += ${UBXLIB_BASE}/common/network/src/u_network.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/network/src/u_network_shared.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/network/src/u_network_private_ble_extmod_stub.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/network/src/u_network_private_cell_stub.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/network/src/u_network_private_gnss_stub.c
UBXLIB_SRC += ${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
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device_serial.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device_shared.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device_private.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device_private_cell_stub.c
UBXLIB_SRC += ${UBXLIB_BASE}/common/device/src/u_device_private_gnss_stub.c
UBXLIB_SRC += ${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
UBXLIB_SRC += ${UBXLIB_BASE}/port/u_port_heap.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
UBXLIB_SRC += \
${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
UBXLIB_SRC += \
${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
endif
# Optional cell related files and directories
ifneq ($(filter cell,$(UBXLIB_FEATURES)),)
UBXLIB_MODULE_DIRS += ${UBXLIB_BASE}/cell
UBXLIB_SRC += \
${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
UBXLIB_SRC += \
${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
endif
# Optional GNSS related files and directories
ifneq ($(filter gnss,$(UBXLIB_FEATURES)),)
UBXLIB_MODULE_DIRS += ${UBXLIB_BASE}/gnss
UBXLIB_SRC += \
${UBXLIB_BASE}/common/network/src/u_network_private_gnss.c \
${UBXLIB_BASE}/common/device/src/u_device_private_gnss.c
else
# Make the linker happy
UBXLIB_SRC += \
${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
endif
# 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 \
${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/e2e \
${UBXLIB_BASE}/example/security/psk \
${UBXLIB_BASE}/example/security/c2c \
${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
UBXLIB_SRC += \
$(foreach dir, $(UBXLIB_SRC_DIRS), \
$(sort $(wildcard $(dir)/*.c)) \
)
# 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)