Merge pull request #7 from ucloud/optimize_makefile

optimize makefile
This commit is contained in:
ethanDu1 2019-11-22 17:39:56 +08:00 committed by GitHub
commit 50ad22e8ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 31 deletions

View File

@ -110,8 +110,8 @@ endif ()
if (ENABLE_FEATURE_UPLOAD_FILE)
message("ENABLE_FEATURE_UPLOAD_FILE = y")
AUX_SOURCE_DIRECTORY(src/http FILE_UPLOAD_SRC)
set(src_iot_sdk ${src_iot_sdk} ${FILE_UPLOAD_SRC})
AUX_SOURCE_DIRECTORY(src/upload_file UPLOAD_FILE_SRC)
set(src_iot_sdk ${src_iot_sdk} ${UPLOAD_FILE_SRC})
else ()
message("ENABLE_FEATURE_UPLOAD_FILE = n")
endif ()

View File

@ -17,7 +17,7 @@ $(call CompLib_Map, OTA_ENABLED, src/ota/src)
$(call CompLib_Map, DEVICE_MODEL_ENABLED, src/dev_model/src)
$(call CompLib_Map, FILE_UPLOAD_ENABLED, src/http)
$(call CompLib_Map, FILE_UPLOAD_ENABLED, src/upload_file)
IOTSDK_SRC_FILES := \

View File

@ -32,9 +32,9 @@ if (ENABLE_FEATURE_AUTH_MODE_DYNAMIC)
endif ()
if (ENABLE_FEATURE_UPLOAD_FILE)
add_executable(http_download http/http_download.c)
add_dependencies(http_download iot_sdk iot_platform)
add_executable(download_file_sample upload_file/download_file_sample.c)
add_dependencies(download_file_sample iot_sdk iot_platform)
add_executable(http_upload http/http_upload.c)
add_dependencies(http_upload iot_sdk iot_platform)
add_executable(upload_file_sample upload_file/upload_file_sample.c)
add_dependencies(upload_file_sample iot_sdk iot_platform)
endif ()

View File

@ -32,9 +32,6 @@
static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg)
{
uintptr_t packet_id = 0;
packet_id = (uintptr_t)msg->msg;
switch(msg->event_type) {
case MQTT_EVENT_UNDEF:
LOG_INFO("undefined event occur.\n");
@ -49,27 +46,27 @@ static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg
break;
case MQTT_EVENT_SUBSCRIBE_SUCCESS:
LOG_INFO("subscribe success, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe success.\n");
break;
case MQTT_EVENT_SUBSCRIBE_TIMEOUT:
LOG_INFO("subscribe wait ack timeout, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe wait ack timeout.\n");
break;
case MQTT_EVENT_SUBSCRIBE_NACK:
LOG_INFO("subscribe nack, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe nack.\n");
break;
case MQTT_EVENT_PUBLISH_SUCCESS:
LOG_INFO("publish success, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish success.\n");
break;
case MQTT_EVENT_PUBLISH_TIMEOUT:
LOG_INFO("publish timeout, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish timeout.\n");
break;
case MQTT_EVENT_PUBLISH_NACK:
LOG_INFO("publish nack, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish nack.\n");
break;
default:

View File

@ -33,9 +33,6 @@
static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg)
{
uintptr_t packet_id = 0;
packet_id = (uintptr_t)msg->msg;
switch(msg->event_type) {
case MQTT_EVENT_UNDEF:
LOG_INFO("undefined event occur.\n");
@ -50,27 +47,27 @@ static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg
break;
case MQTT_EVENT_SUBSCRIBE_SUCCESS:
LOG_INFO("subscribe success, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe success.\n");
break;
case MQTT_EVENT_SUBSCRIBE_TIMEOUT:
LOG_INFO("subscribe wait ack timeout, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe wait ack timeout.\n");
break;
case MQTT_EVENT_SUBSCRIBE_NACK:
LOG_INFO("subscribe nack, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("subscribe nack.\n");
break;
case MQTT_EVENT_PUBLISH_SUCCESS:
LOG_INFO("publish success, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish success.\n");
break;
case MQTT_EVENT_PUBLISH_TIMEOUT:
LOG_INFO("publish timeout, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish timeout.\n");
break;
case MQTT_EVENT_PUBLISH_NACK:
LOG_INFO("publish nack, packet-id=%u.\n", (unsigned int)packet_id);
LOG_INFO("publish nack.\n");
break;
default:
LOG_INFO("Should NOT arrive here.\n");

View File

@ -65,16 +65,16 @@ dev_model_sample:
endif
ifneq (,$(filter -DFILE_UPLOAD_ENABLED,$(CFLAGS)))
http_download:
download_file_sample:
$(TOP_Q) \
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/http/$@.c $(LDFLAGS) -o $@
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/upload_file/$@.c $(LDFLAGS) -o $@
$(TOP_Q) \
mv $@ $(FINAL_DIR)/bin
http_upload:
upload_file_sample:
$(TOP_Q) \
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/http/$@.c $(LDFLAGS) -o $@
$(PLATFORM_CC) $(CFLAGS) $(SAMPLE_DIR)/upload_file/$@.c $(LDFLAGS) -o $@
$(TOP_Q) \
mv $@ $(FINAL_DIR)/bin

View File

@ -16,6 +16,6 @@ endif
$(TOP_Q) \
rm -rf ${TEMP_DIR}
.PHONY: mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample
.PHONY: mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample download_file_sample upload_file_sample
final : mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample
final : mqtt_sample ota_sample shadow_sample dynamic_auth_sample dev_model_sample samples_final smart_bracelet_heart_rate_shadow_sample smart_bracelet_walk_step_shadow_sample download_file_sample upload_file_sample