rusefi-1/unit_tests/Makefile

184 lines
5.5 KiB
Makefile

##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
PROJECT_DIR = ../firmware
UNIT_TESTS_DIR=$(PROJECT_DIR)/../unit_tests
include $(PROJECT_DIR)/rusefi_rules.mk
# Compiler options here.
ifeq ($(USE_OPT),)
# -O2 is needed for mingw, without it there is a linking issue to isnanf?!?!
#USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers
USE_OPT = -c -Wall -O0 -ggdb -g
USE_OPT += -fprofile-arcs -ftest-coverage
USE_OPT += -Werror=missing-field-initializers
endif
#TODO! this is a nice goal
#USE_OPT += $(RUSEFI_OPT)
#USE_OPT += -Wno-error=format= -Wno-error=register -Wno-error=write-strings
# See explanation in main firmware Makefile for these three defines
USE_OPT += -DEFI_UNIT_TEST=1 -DEFI_PROD_CODE=0 -DEFI_SIMULATOR=0
# Pretend we are all different hardware so that all canned engine configs are included
USE_OPT += -DHW_MICRO_RUSEFI=1 -DHW_PROTEUS=1 -DHW_FRANKENSO=1
ifeq ($(CCACHE_DIR),)
$(info No CCACHE_DIR)
else
$(info CCACHE_DIR is ${CCACHE_DIR})
CCPREFIX=ccache
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT = -std=gnu99 -fgnu89-inline
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -std=gnu++17 -fno-rtti -fpermissive -fexceptions -fno-use-cxa-atexit
endif
# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = no
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
# List all default C defines here, like -D_DEBUG=1
DDEFS =
# Imported source files and paths
include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/controllers/controllers.mk
include $(PROJECT_DIR)/development/development.mk
include $(PROJECT_DIR)/console/console.mk
include $(PROJECT_DIR)/console/binary/tunerstudio.mk
include $(PROJECT_DIR)/hw_layer/hw_layer.mk
include $(PROJECT_DIR)/hw_layer/drivers/drivers.mk
include $(PROJECT_DIR)/hw_layer/sensors/sensors.mk
include $(PROJECT_DIR)/util/util.mk
include $(PROJECT_DIR)/init/init.mk
include $(UNIT_TESTS_DIR)/test.mk
include $(UNIT_TESTS_DIR)/tests/tests.mk
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(UTILSRC) \
$(CONTROLLERS_ALGO_SRC) \
$(CONTROLLERS_CORE_SRC) \
$(CONTROLLERS_MATH_SRC) \
$(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \
$(HW_LAYER_DRIVERS_CORE) \
$(TEST_SRC_C)
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(ALLCPPSRC) \
$(UTILSRC_CPP) \
gtest-all.cpp \
gmock-all.cpp \
$(CONTROLLERS_ALGO_SRC_CPP) \
$(TRIGGER_DECODERS_SRC_CPP) \
$(ENGINES_SRC_CPP) \
$(CONTROLLERS_SRC_CPP) \
$(CONTROLLERS_CORE_SRC_CPP) \
$(CONTROLLERS_MATH_SRC_CPP) \
$(CONTROLLERS_SENSORS_SRC_CPP) \
$(FRAMEWORK_SRC_CPP) \
$(TESTS_SRC_CPP) \
$(SYSTEMSRC_CPP) \
$(HW_LAYER_EMS_CPP) \
$(TUNERSTUDIO_SRC_CPP) \
$(HW_SENSORS_SRC) \
$(TRIGGER_SRC_CPP) \
$(INIT_SRC_CPP) \
$(PROJECT_DIR)/../unit_tests/logicdata.cpp \
$(DEVELOPMENT_DIR)/engine_sniffer.cpp \
$(PROJECT_DIR)/../unit_tests/main.cpp \
$(PROJECT_DIR)/console/binary/tooth_logger.cpp \
$(PROJECT_DIR)/console/binary_log/log_field.cpp \
# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =
# List ASM source files here
ASMSRC = $(PORTASM)
INCDIR = $(UNIT_TESTS_DIR) \
$(ALLINC) \
$(UTIL_INC) \
$(PROJECT_DIR)/config/engines \
$(CONTROLLERS_INC) \
$(CONSOLE_INC) \
$(DEVELOPMENT_DIR) \
$(PROJECT_DIR)/ext_algo \
$(PROJECT_DIR)/init/ \
$(PROJECT_DIR)/hw_layer/algo \
$(HW_LAYER_INC) \
$(HW_SENSORS_INC) \
$(HW_LAYER_DRIVERS_INC) \
$(UNIT_TESTS_DIR)/test_data_structures \
$(UNIT_TESTS_DIR)/googletest/googlemock/include \
$(UNIT_TESTS_DIR)/googletest/googletest \
$(UNIT_TESTS_DIR)/googletest/googletest/include \
$(UNIT_TESTS_DIR)/tests \
$(UNIT_TESTS_DIR)/tests/sensor \
$(UNIT_TESTS_DIR)/test_basic_math
#
# Project, sources and paths
##############################################################################
include $(UNIT_TESTS_DIR)/unit_test_rules.mk
include $(UNIT_TESTS_DIR)/rules.mk