forked from TencentCloud/tencentcloud-iot-sdk-embedded-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·169 lines (131 loc) · 3.77 KB
/
Makefile
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
# Basic Settings
SHELL := /bin/bash
TOP_DIR ?= $(CURDIR)
SUBDIRS := directory-not-exist-actually
# Settings of input directory
SCRIPT_DIR := $(TOP_DIR)/tools/build_scripts
SRC_DIR := sdk_src
PLATFORM_DIR := platform
EXP_INC_DIR := include include/exports
INT_INC_DIR := sdk_src/internal_inc
# Thirdparty libs directory
THIRD_PARTY_PATH := $(TOP_DIR)/external_libs
TEST_LIB_DIR := $(THIRD_PARTY_PATH)/googletest
# Sample directory
SAMPLE_DIR := $(TOP_DIR)/samples
# Test directory
TESTS_DIR := $(TOP_DIR)/sdk-tests
include make.settings
include $(SCRIPT_DIR)/parse_make_settings.mk
# Settings of output directory
TEMP_DIR := $(TOP_DIR)/tmp
DIST_DIR := $(TOP_DIR)/output
FINAL_DIR := $(DIST_DIR)/$(BUILD_TYPE)
# Makefile echo
ifeq ($(DEBUG_MAKEFILE),n)
Q := @
TOP_Q := @
else
Q :=
TOP_Q :=
endif
# IoT SDK sources files defination
COMP_LIB := libiot_sdk.a
COMP_LIB_COMPONENTS := \
$(SRC_DIR)/utils \
$(SRC_DIR)/network \
$(SRC_DIR)/network/socket \
$(SRC_DIR)/protocol/http \
ifeq (,$(filter -DAUTH_WITH_NOTLS,$(CFLAGS)))
COMP_LIB_COMPONENTS += \
$(SRC_DIR)/network/tls
endif
$(call CompLib_Map, MQTT_COMM_ENABLED, \
$(SRC_DIR)/protocol/mqtt \
)
$(call CompLib_Map, COAP_COMM_ENABLED, \
$(SRC_DIR)/protocol/coap \
)
$(call CompLib_Map, MQTT_DEVICE_SHADOW, \
$(SRC_DIR)/services/shadow \
)
$(call CompLib_Map, SYSTEM_COMM_ENABLED, \
$(SRC_DIR)/services/system \
)
$(call CompLib_Map, LOG_UPLOAD_ENABLED, \
$(SRC_DIR)/services/log \
)
$(call CompLib_Map, OTA_COMM_ENABLED, \
$(SRC_DIR)/services/ota \
)
$(call CompLib_Map, GATEWAY_ENABLED, \
$(SRC_DIR)/services/gateway \
)
$(call CompLib_Map, DEV_DYN_REG_ENABLED, \
$(SRC_DIR)/services/dynreg \
)
$(call CompLib_Map, EVENT_POST_ENABLED, \
$(SRC_DIR)/services/event \
)
$(call CompLib_Map, AT_TCP_ENABLED, \
$(SRC_DIR)/network/at_socket \
)
IOTSDK_SRC_FILES := \
$(foreach v, \
$(COMP_LIB_COMPONENTS), \
$(eval \
export IOTSDK_SRC_FILES += \
$(wildcard $(TOP_DIR)/$(v)/*.c) \
) \
)
EXCLUDE_SRC_FILES := \
ifeq (,$(filter -DOTA_COAP_CHANNEL, $(CFLAGS)))
EXCLUDE_SRC_FILES += $(TOP_DIR)/$(SRC_DIR)/services/ota/ota_coap.c
IOTSDK_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(IOTSDK_SRC_FILES))
else
EXCLUDE_SRC_FILES += $(TOP_DIR)/$(SRC_DIR)/services/ota/ota_mqtt.c
IOTSDK_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(IOTSDK_SRC_FILES))
endif
# IoT Platform sources files defination
PLATFORM_LIB := libiot_platform.a
PLATFORM_LIB_COMPONENTS := \
$(PLATFORM_DIR)/os/$(PLATFORM_OS) \
ifeq (,$(filter -DAUTH_WITH_NOTLS,$(CFLAGS)))
PLATFORM_LIB_COMPONENTS += \
$(PLATFORM_DIR)/tls/$(PLATFORM_SSL)
endif
ifneq (,$(filter -DAT_TCP_ENABLED,$(CFLAGS)))
PLATFORM_LIB_COMPONENTS += \
$(PLATFORM_DIR)/at_device/$(PLATFORM_AT_DEV)
endif
IOTPLATFORM_SRC_FILES := \
$(foreach v, \
$(PLATFORM_LIB_COMPONENTS), \
$(eval \
export IOTPLATFORM_SRC_FILES += \
$(wildcard $(TOP_DIR)/$(v)/*.c) \
) \
)
# IoT Include files defination
COMP_LIB_COMPONENTS_INCLUDES := \
$(EXP_INC_DIR) \
$(INT_INC_DIR) \
external_libs/mbedtls/include \
IOTSDK_INCLUDE_FILES := \
$(foreach v, \
$(COMP_LIB_COMPONENTS_INCLUDES), \
$(eval \
export IOTSDK_INCLUDE_FILES += \
-I$(TOP_DIR)/$(v) \
) \
)
$(call CompInc_Map, AT_TCP_ENABLED, \
$(PLATFORM_DIR)/at_device/$(PLATFORM_AT_DEV) \
)
CFLAGS += -Werror -Wall -Wno-error=sign-compare -Wno-error=format -Os ${IOTSDK_INCLUDE_FILES} -pthread -DFORCE_SSL_VERIFY
#CFLAGS += -DMQTT_RMDUP_MSG_ENABLED
include $(SCRIPT_DIR)/rules.mk
ifneq (,$(filter -DSDKTESTS_ENABLED, $(CFLAGS)))
include sdk-tests/unit_test/unit_test.mk
include sdk-tests/multi_thread_test/multi_thread_test.mk
endif