FreeRTOS-Kernel/FreeRTOS/Test/CMock/makefile.in
alfred gedeon 1ac492d6aa
Kernel timers.c tasks.c Unit Test (#539)
* Test: add multi config ability to build system

* Remove Tests that are not implemented yet from the makefile

* Fix header check

* Test: Unit Test tasks.c

* UnitTest: tasks.c Save progress

* saving some work 70% coverage

* coverage 77%

* tasks.c coverage 90%

* tasks.c coverage 95%

* Cleanup and common header

* Cover some extra branches, no_mutex +stack growth

* Fix Makefile not to use modified version of c-preprocessor

* Remove c-preprocessor errros

* Rebase and add some tests

* Fortify_source=1 and O0 are mutually exclusive

* Style: Uncrustify code

* Style: Fix indent

* Fix Header checks

* Add prototypes

* Build: use unifdef instead of the c-preprocessor to generate different configurations

* Build: fix makefile cflags

* Fix UT after upgrading kernel version

* Resolve conflicts and test failures

* Comment fix version number

* Fix build error

* Update FreeRTOS/Test/CMock/Makefile

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2022-08-16 14:38:26 -07:00

76 lines
2.6 KiB
Makefile

# indent with spaces
.RECIPEPREFIX := $(.RECIPEPREFIX) $(.RECIPEPREFIX)
# Various directories
# Note: for this to work in subdirectories, this makefile must be the first one included.
UT_ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR := $(UT_ROOT_DIR)/build
DOC_DIR := $(BUILD_DIR)/doc
COVERAGE_DIR := $(BUILD_DIR)/coverage
BIN_DIR := $(BUILD_DIR)/bin
GENERATED_DIR := $(BUILD_DIR)/generated
LIB_DIR := $(BUILD_DIR)/lib
TOOLS_DIR := $(UT_ROOT_DIR)/tools
FREERTOS_DIR := $(abspath $(UT_ROOT_DIR)../../../FreeRTOS)
KERNEL_DIR := $(abspath $(UT_ROOT_DIR)/../../../FreeRTOS/Source)
CMOCK_DIR := $(UT_ROOT_DIR)/CMock
CMOCK_SRC_DIR := $(CMOCK_DIR)/src
UNITY_DIR := $(CMOCK_DIR)/vendor/unity
UNITY_SRC_DIR := $(UNITY_DIR)/src
UNITY_INC_DIR := $(UNITY_DIR)/src
UNITY_BIN_DIR := $(UNITY_DIR)/auto
UNITY_EXTRAS_DIR := $(UNITY_DIR)/extras
UNITY_MEM_DIR := $(UNITY_EXTRAS_DIR)/memory/src
C_EXCEPTION_SRC_DIR := $(CMOCK_DIR)/vendor/c_exception/lib
CMOCK_EXEC_DIR := $(CMOCK_DIR)/lib
# Include directories
INCLUDE_DIR := -I$(KERNEL_DIR)/include
INCLUDE_DIR += -I.
INCLUDE_DIR += -I$(UT_ROOT_DIR)/config
INCLUDE_DIR += -I$(UNITY_INC_DIR)
INCLUDE_DIR += -I$(CMOCK_SRC_DIR)
INCLUDE_DIR += -I$(UNITY_MEM_DIR)
INCLUDE_DIR += -I$(C_EXCEPTION_SRC_DIR)
# Preprocessor flags
CPPFLAGS := $(INCLUDE_DIR)
# Compiler flags
CFLAGS := -pthread --std=c99 -Werror -Wall
CFLAGS += -fstack-protector-all
CFLAGS += -Wformat -Werror=format-security -Werror=array-bounds -Wno-unused-function
ifeq ($(ENABLE_SANITIZER),1)
CFLAGS += -fsanitize=address,undefined -fsanitize-recover=address
CFLAGS += -O3 -ggdb3
CPPFLAGS += -D_FORTIFY_SOURCE=2
else
CFLAGS += -O0 -ggdb3
endif
# Linker flags
LDFLAGS := -L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR)
LDFLAGS += -pthread
LDFLAGS += -lunity
LDFLAGS += -lunitymemory
LDFLAGS += -lcexception
LDFLAGS += -lcmock
LDFLAGS += -lgcov
ifeq ($(ENABLE_SANITIZER),1)
LDFLAGS += -fsanitize=address,undefined
endif
# Shared libraries
LIBS := libunity
LIBS += libcmock
LIBS += libunitymemory
LIBS += libcexception
LCOV_OPTS := --config-file $(UT_ROOT_DIR)/lcovrc
# export everything in this file
export