#Builds mbedTLS to an archive. This makefile is called from the main makefile #which is just called "makefile". MBED_OUTPUT_DIR := ./output/mbedTLS ARCHIVE_IMAGE := mbedTLS.a CC = arm-none-eabi-gcc AR = arm-none-eabi-ar SUB_MAKEFILE_DIR = ./library-makefiles CFLAGS += $(INCLUDE_DIRS) -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 \ -Wall -Wextra -g3 -O0 -ffunction-sections -fdata-sections \ -DMBEDTLS_CONFIG_FILE='' -MMD -MP -MF"$(@:%.o=%.d)" -MT $@ #must be first in the include paths to ensure the correct FreeRTOSConfig.h is #used. INCLUDE_DIRS += -I./target-specific-source INCLUDE_DIRS += -I./target-specific-source/CMSIS INCLUDE_DIRS += -I./../../source/configuration-files INCLUDE_DIRS += -I./../../lib/ThirdParty/mbedtls/include INCLUDE_DIRS += -I./../../lib/FreeRTOS/utilities/mbedtls_freertos INCLUDE_DIRS += -I./../../lib/FreeRTOS/freertos-plus-tcp/include INCLUDE_DIRS += -I./../../lib/FreeRTOS/freertos-plus-tcp/tools/tcp_utilities/include KERNEL_DIR += ./../../lib/FreeRTOS/freertos-kernel KERNEL_PORT_DIR += $(KERNEL_DIR)/portable/GCC/ARM_CM3 INCLUDE_DIRS += -I$(KERNEL_DIR)/include \ -I$(KERNEL_PORT_DIR) #Implementation of the Mbed TLS port layer for FreeRTOS. include $(SUB_MAKEFILE_DIR)/mbedtls-utils.mk #mbedTLS itself. include $(SUB_MAKEFILE_DIR)/mbedtls.mk #Create a list of object files with the desired output directory path. OBJS = $(SOURCE_FILES:%.c=%.o) OBJS_NO_PATH = $(notdir $(OBJS)) OBJS_OUTPUT = $(OBJS_NO_PATH:%.o=$(MBED_OUTPUT_DIR)/%.o) #Create a list of dependency files with the desired output directory path. DEP_FILES := $(SOURCE_FILES:%.c=$(MBED_OUTPUT_DIR)/%.d) DEP_FILES_NO_PATH = $(notdir $(DEP_FILES)) DEP_OUTPUT = $(DEP_FILES_NO_PATH:%.d=$(MBED_OUTPUT_DIR)/%.d) all: $(MBED_OUTPUT_DIR)/$(ARCHIVE_IMAGE) %.o : %.c $(MBED_OUTPUT_DIR)/%.o : %.c $(MBED_OUTPUT_DIR)/%.d mbedTLS-archive.mk $(CC) $(CFLAGS) -c $< -o $@ $(MBED_OUTPUT_DIR)/$(ARCHIVE_IMAGE): $(OBJS_OUTPUT) mbedTLS-archive.mk $(AR) -r $(MBED_OUTPUT_DIR)/$(ARCHIVE_IMAGE) $(OBJS_OUTPUT) $(DEP_OUTPUT): include $(wildcard $(DEP_OUTPUT)) clean: rm -f $(MBED_OUTPUT_DIR)/$(ARCHIVE_IMAGE) $(MBED_OUTPUT_DIR)/*.o $(MBED_OUTPUT_DIR)/*.d #use "make print-[VARIABLE_NAME] to print the value of a variable generated by #this makefile. print-% : ; @echo $* = $($*) .PHONY: all clean