Jim Flynn
/
aws-iot-device-sdk-mbed-c
Changes to enabled on-line compiler
examples/shadow_sample/Makefile@0:082731ede69f, 2018-05-30 (annotated)
- Committer:
- JMF
- Date:
- Wed May 30 20:59:51 2018 +0000
- Revision:
- 0:082731ede69f
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 0:082731ede69f | 1 | #This target is to ensure accidental execution of Makefile as a bash script will not execute commands like rm in unexpected directories and exit gracefully. |
JMF | 0:082731ede69f | 2 | .prevent_execution: |
JMF | 0:082731ede69f | 3 | exit 0 |
JMF | 0:082731ede69f | 4 | |
JMF | 0:082731ede69f | 5 | CC = gcc |
JMF | 0:082731ede69f | 6 | |
JMF | 0:082731ede69f | 7 | #remove @ for no make command prints |
JMF | 0:082731ede69f | 8 | DEBUG = @ |
JMF | 0:082731ede69f | 9 | |
JMF | 0:082731ede69f | 10 | APP_DIR = . |
JMF | 0:082731ede69f | 11 | APP_INCLUDE_DIRS += -I $(APP_DIR) |
JMF | 0:082731ede69f | 12 | APP_NAME = shadow_sample |
JMF | 0:082731ede69f | 13 | APP_SRC_FILES = $(APP_NAME).c |
JMF | 0:082731ede69f | 14 | |
JMF | 0:082731ede69f | 15 | #IoT client directory |
JMF | 0:082731ede69f | 16 | IOT_CLIENT_DIR = ../../.. |
JMF | 0:082731ede69f | 17 | |
JMF | 0:082731ede69f | 18 | PLATFORM_DIR = $(IOT_CLIENT_DIR)/platform/linux/mbedtls |
JMF | 0:082731ede69f | 19 | PLATFORM_COMMON_DIR = $(IOT_CLIENT_DIR)/platform/linux/common |
JMF | 0:082731ede69f | 20 | |
JMF | 0:082731ede69f | 21 | IOT_INCLUDE_DIRS += -I $(IOT_CLIENT_DIR)/include |
JMF | 0:082731ede69f | 22 | IOT_INCLUDE_DIRS += -I $(IOT_CLIENT_DIR)/external_libs/jsmn |
JMF | 0:082731ede69f | 23 | IOT_INCLUDE_DIRS += -I $(PLATFORM_COMMON_DIR) |
JMF | 0:082731ede69f | 24 | IOT_INCLUDE_DIRS += -I $(PLATFORM_DIR) |
JMF | 0:082731ede69f | 25 | |
JMF | 0:082731ede69f | 26 | IOT_SRC_FILES += $(shell find $(IOT_CLIENT_DIR)/src/ -name '*.c') |
JMF | 0:082731ede69f | 27 | IOT_SRC_FILES += $(shell find $(IOT_CLIENT_DIR)/external_libs/jsmn -name '*.c') |
JMF | 0:082731ede69f | 28 | IOT_SRC_FILES += $(shell find $(PLATFORM_DIR)/ -name '*.c') |
JMF | 0:082731ede69f | 29 | IOT_SRC_FILES += $(shell find $(PLATFORM_COMMON_DIR)/ -name '*.c') |
JMF | 0:082731ede69f | 30 | |
JMF | 0:082731ede69f | 31 | #TLS - mbedtls |
JMF | 0:082731ede69f | 32 | MBEDTLS_DIR = $(IOT_CLIENT_DIR)/external_libs/mbedTLS |
JMF | 0:082731ede69f | 33 | TLS_LIB_DIR = $(MBEDTLS_DIR)/library |
JMF | 0:082731ede69f | 34 | TLS_INCLUDE_DIR = -I $(MBEDTLS_DIR)/include |
JMF | 0:082731ede69f | 35 | EXTERNAL_LIBS += -L$(TLS_LIB_DIR) |
JMF | 0:082731ede69f | 36 | LD_FLAG += -Wl,-rpath,$(TLS_LIB_DIR) |
JMF | 0:082731ede69f | 37 | LD_FLAG += -ldl $(TLS_LIB_DIR)/libmbedtls.a $(TLS_LIB_DIR)/libmbedcrypto.a $(TLS_LIB_DIR)/libmbedx509.a |
JMF | 0:082731ede69f | 38 | |
JMF | 0:082731ede69f | 39 | |
JMF | 0:082731ede69f | 40 | #Aggregate all include and src directories |
JMF | 0:082731ede69f | 41 | INCLUDE_ALL_DIRS += $(IOT_INCLUDE_DIRS) |
JMF | 0:082731ede69f | 42 | INCLUDE_ALL_DIRS += $(TLS_INCLUDE_DIR) |
JMF | 0:082731ede69f | 43 | INCLUDE_ALL_DIRS += $(APP_INCLUDE_DIRS) |
JMF | 0:082731ede69f | 44 | |
JMF | 0:082731ede69f | 45 | SRC_FILES += $(APP_SRC_FILES) |
JMF | 0:082731ede69f | 46 | SRC_FILES += $(IOT_SRC_FILES) |
JMF | 0:082731ede69f | 47 | |
JMF | 0:082731ede69f | 48 | # Logging level control |
JMF | 0:082731ede69f | 49 | LOG_FLAGS += -DENABLE_IOT_DEBUG |
JMF | 0:082731ede69f | 50 | LOG_FLAGS += -DENABLE_IOT_INFO |
JMF | 0:082731ede69f | 51 | LOG_FLAGS += -DENABLE_IOT_WARN |
JMF | 0:082731ede69f | 52 | LOG_FLAGS += -DENABLE_IOT_ERROR |
JMF | 0:082731ede69f | 53 | |
JMF | 0:082731ede69f | 54 | COMPILER_FLAGS += -g |
JMF | 0:082731ede69f | 55 | COMPILER_FLAGS += $(LOG_FLAGS) |
JMF | 0:082731ede69f | 56 | #If the processor is big endian uncomment the compiler flag |
JMF | 0:082731ede69f | 57 | #COMPILER_FLAGS += -DREVERSED |
JMF | 0:082731ede69f | 58 | |
JMF | 0:082731ede69f | 59 | MBED_TLS_MAKE_CMD = $(MAKE) -C $(MBEDTLS_DIR) |
JMF | 0:082731ede69f | 60 | |
JMF | 0:082731ede69f | 61 | PRE_MAKE_CMD = $(MBED_TLS_MAKE_CMD) |
JMF | 0:082731ede69f | 62 | MAKE_CMD = $(CC) $(SRC_FILES) $(COMPILER_FLAGS) -o $(APP_NAME) $(LD_FLAG) $(EXTERNAL_LIBS) $(INCLUDE_ALL_DIRS) |
JMF | 0:082731ede69f | 63 | |
JMF | 0:082731ede69f | 64 | all: |
JMF | 0:082731ede69f | 65 | $(PRE_MAKE_CMD) |
JMF | 0:082731ede69f | 66 | $(DEBUG)$(MAKE_CMD) |
JMF | 0:082731ede69f | 67 | $(POST_MAKE_CMD) |
JMF | 0:082731ede69f | 68 | |
JMF | 0:082731ede69f | 69 | clean: |
JMF | 0:082731ede69f | 70 | rm -f $(APP_DIR)/$(APP_NAME) |
JMF | 0:082731ede69f | 71 | $(MBED_TLS_MAKE_CMD) clean |