rusefi/unit_tests/Makefile

305 lines
8.7 KiB
Makefile
Raw Normal View History

2015-07-10 06:01:56 -07:00
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
2019-08-25 17:15:14 -07:00
ifeq ("$(wildcard googletest/LICENSE)","")
$(info Invoking "git submodule update --init")
$(shell git submodule update --init)
$(info Invoked "git submodule update --init")
# make is not happy about newly checked out module for some reason but next invocation would work
$(error Please run 'make' again. Please make sure you have 'git' command in PATH)
endif
2015-07-10 06:01:56 -07:00
PROJECT_DIR = ../firmware
2019-12-02 10:53:08 -08:00
include $(PROJECT_DIR)/rusefi_rules.mk
2015-07-10 06:01:56 -07:00
# Compiler options here.
ifeq ($(USE_OPT),)
2019-01-12 11:31:55 -08:00
# As of Jan 2016 we are producing 64 bit unit tests on Windows which needs 64 bit GDB
# Previouslyt we had to download 32 bit version of GDB maybe from http://www.equation.com/servlet/equation.cmd?fa=gdb
2018-12-08 11:17:39 -08:00
#
2015-07-10 06:01:56 -07:00
# -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
2019-08-24 21:37:05 -07:00
USE_OPT = -c -Wall -O0 -ggdb -g3
USE_OPT += -fprofile-arcs -ftest-coverage
2019-08-24 21:37:05 -07:00
USE_OPT += -Werror=missing-field-initializers
USE_OPT += -Wno-unused-parameter -Wno-unused-function
USE_OPT += -fsingle-precision-constant
2015-07-10 06:01:56 -07:00
endif
2019-12-02 10:53:08 -08:00
#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
2019-04-20 18:44:00 -07:00
ifeq ($(CCACHE_DIR),)
$(info No CCACHE_DIR)
else
$(info CCACHE_DIR is ${CCACHE_DIR})
CCPREFIX=ccache
endif
2015-07-10 06:01:56 -07:00
# 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
2015-07-10 06:01:56 -07:00
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 =
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = rusefi_test
#PROJECT_BOARD = OLIMEX_STM32_E407
#ifneq ($(PROJECT_BOARD),OLIMEX_STM32_E407)
# PROJECT_BOARD = ST_STM32F4_DISCOVERY
#endif
#DDEFS += -D$(PROJECT_BOARD)
# Imported source files and paths
include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/controllers/controllers.mk
include $(PROJECT_DIR)/development/development.mk
2020-05-25 10:42:55 -07:00
include $(PROJECT_DIR)/console/console.mk
2017-04-21 10:35:06 -07:00
include $(PROJECT_DIR)/hw_layer/hw_layer.mk
include $(PROJECT_DIR)/hw_layer/drivers/drivers.mk
2019-02-01 20:16:34 -08:00
include $(PROJECT_DIR)/hw_layer/sensors/sensors.mk
include $(PROJECT_DIR)/util/util.mk
include $(PROJECT_DIR)/init/init.mk
2015-07-10 06:01:56 -07:00
include test.mk
2019-06-15 13:43:30 -07:00
include tests/tests.mk
2015-07-10 06:01:56 -07:00
# Define linker script file here
#LDSCRIPT= config/system/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
2016-02-12 08:02:09 -08:00
CSRC = $(UTILSRC) \
2015-07-10 06:01:56 -07:00
$(CONTROLLERS_ALGO_SRC) \
$(CONTROLLERS_CORE_SRC) \
$(CONTROLLERS_MATH_SRC) \
$(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \
$(HW_LAYER_DRIVERS_CORE) \
2015-07-10 06:01:56 -07:00
$(TEST_SRC_C)
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(UTILSRC_CPP) \
2019-01-03 17:14:23 -08:00
gtest-all.cpp \
2019-01-07 22:20:18 -08:00
gmock-all.cpp \
2015-07-10 06:01:56 -07:00
$(CONTROLLERS_ALGO_SRC_CPP) \
$(TRIGGER_DECODERS_SRC_CPP) \
$(ENGINES_SRC_CPP) \
$(CONTROLLERS_SRC_CPP) \
2015-07-10 06:01:56 -07:00
$(CONTROLLERS_CORE_SRC_CPP) \
$(CONTROLLERS_MATH_SRC_CPP) \
$(CONTROLLERS_SENSORS_SRC_CPP) \
2019-06-15 13:43:30 -07:00
$(FRAMEWORK_SRC_CPP) \
$(TESTS_SRC_CPP) \
2015-07-10 06:01:56 -07:00
$(SYSTEMSRC_CPP) \
2019-01-03 21:16:08 -08:00
$(HW_LAYER_EMS_CPP) \
2019-02-01 20:16:34 -08:00
$(HW_SENSORS_SRC) \
2017-11-25 22:17:37 -08:00
$(TRIGGER_SRC_CPP) \
$(INIT_SRC_CPP) \
2020-07-19 18:27:28 -07:00
$(PROJECT_DIR)/../unit_tests/logicdata.cpp \
$(PROJECT_DIR)/../unit_tests/main.cpp \
2020-07-19 19:41:34 -07:00
$(PROJECT_DIR)/console/binary/tooth_logger.cpp \
$(PROJECT_DIR)/console/binary_log/log_field.cpp \
2015-07-10 06:01:56 -07:00
2019-01-03 17:14:23 -08:00
2015-07-10 06:01:56 -07:00
# 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)
2018-01-23 18:56:26 -08:00
2015-07-10 06:01:56 -07:00
INCDIR = . \
$(UTIL_INC) \
2015-07-10 06:01:56 -07:00
$(PROJECT_DIR)/config/engines \
$(CONTROLLERS_INC) \
2020-05-25 10:42:55 -07:00
$(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) \
2015-07-10 06:01:56 -07:00
test_data_structures \
2019-01-07 22:20:18 -08:00
googletest/googlemock/include \
2019-01-03 17:14:23 -08:00
googletest/googletest \
googletest/googletest/include \
$(PROJECT_DIR)/../unit_tests/tests \
$(PROJECT_DIR)/../unit_tests/test_basic_math
2015-07-10 06:01:56 -07:00
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
# It looks like cygwin build of mingwg-w64 has issues with gcov runtime :(
# mingw-w64 is a project which forked from mingw in 2007 - be careful not to confuse these two.
# In order to have coverage generated please download from https://mingw-w64.org/doku.php/download/mingw-builds
# Install using mingw-w64-install.exe instead of similar thing packaged with cygwin
# Both 32 bit and 64 bit versions of mingw-w64 are generating coverage data.
2015-07-10 06:01:56 -07:00
ifeq ($(OS),Windows_NT)
ifeq ($(USE_MINGW32_I686),)
2019-01-12 11:31:55 -08:00
#this one is 64 bit
TRGT = x86_64-w64-mingw32-
else
2019-01-12 11:31:55 -08:00
#this one was 32 bit
TRGT = i686-w64-mingw32-
endif
2015-07-10 06:01:56 -07:00
else
TRGT =
endif
2019-04-20 18:44:00 -07:00
CC = $(CCPREFIX) $(TRGT)gcc
CPPC = $(CCPREFIX) $(TRGT)g++
2015-07-10 06:01:56 -07:00
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
#LD = $(TRGT)gcc
LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -DTHUMB
# Define C warning options here
2019-04-20 17:32:20 -07:00
CWARN = -Wall -Wextra -Wstrict-prototypes -pedantic -Wmissing-prototypes -Wold-style-definition
2015-07-10 06:01:56 -07:00
# Define C++ warning options here
CPPWARN = -Wall -Wextra
#
# Compiler settings
##############################################################################
##############################################################################
# Start of default section
#
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
2019-01-08 20:07:00 -08:00
ifeq ($(OS),Windows_NT)
# Windows
DLIBS = -static-libgcc -static -static-libstdc++
else
# Linux
DLIBS = -pthread
endif
2015-07-10 06:01:56 -07:00
#
# End of default section
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS = -lm
ULIBS += -lgcov --coverage
2015-07-10 06:01:56 -07:00
#
# End of user defines
##############################################################################
include rules.mk