2018-05-26 02:58:01 -04:00
|
|
|
COMPONENT=spi_flash
|
|
|
|
COMPONENT_LIB=lib$(COMPONENT).a
|
2018-05-17 06:56:52 -04:00
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
all: lib
|
2018-05-17 06:56:52 -04:00
|
|
|
|
|
|
|
SOURCE_FILES = \
|
2018-05-26 02:58:01 -04:00
|
|
|
../partition.c \
|
|
|
|
../flash_ops.c \
|
|
|
|
SpiFlash.cpp \
|
|
|
|
flash_mock_util.c \
|
|
|
|
flash_mock.cpp \
|
|
|
|
$(addprefix stubs/, \
|
|
|
|
newlib/lock.c \
|
|
|
|
app_update/esp_ota_eps.c \
|
|
|
|
)
|
2018-05-17 06:56:52 -04:00
|
|
|
|
|
|
|
INCLUDE_FLAGS = $(addprefix -I,\
|
|
|
|
. \
|
2018-05-26 02:58:01 -04:00
|
|
|
../include \
|
2018-05-17 06:56:52 -04:00
|
|
|
../../esp32/include/ \
|
2018-05-26 02:58:01 -04:00
|
|
|
$(addprefix stubs/, \
|
|
|
|
newlib/include \
|
|
|
|
log/include \
|
|
|
|
freertos/include \
|
|
|
|
) \
|
|
|
|
$(addprefix ../../../components/, \
|
|
|
|
soc/esp32/include \
|
|
|
|
esp32/include \
|
|
|
|
bootloader_support/include \
|
|
|
|
app_update/include \
|
|
|
|
) \
|
|
|
|
../../../tools/catch \
|
|
|
|
)
|
2018-05-17 06:56:52 -04:00
|
|
|
|
|
|
|
GCOV ?= gcov
|
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
CPPFLAGS += $(INCLUDE_FLAGS) -D CONFIG_LOG_DEFAULT_LEVEL -g -m32
|
2018-05-17 06:56:52 -04:00
|
|
|
CFLAGS += -fprofile-arcs -ftest-coverage
|
2018-05-26 02:58:01 -04:00
|
|
|
CXXFLAGS += -std=c++11 -Wall -Werror -fprofile-arcs -ftest-coverage
|
2018-05-17 06:56:52 -04:00
|
|
|
LDFLAGS += -lstdc++ -fprofile-arcs -ftest-coverage
|
|
|
|
|
|
|
|
OBJ_FILES = $(filter %.o, $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))
|
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
$(COMPONENT_LIB): $(OBJ_FILES)
|
2018-05-17 06:56:52 -04:00
|
|
|
$(AR) rcs $@ $^
|
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
lib: $(COMPONENT_LIB)
|
|
|
|
|
|
|
|
COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
|
2018-05-17 06:56:52 -04:00
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
$(COVERAGE_FILES): lib
|
2018-05-17 06:56:52 -04:00
|
|
|
|
|
|
|
coverage.info: $(COVERAGE_FILES)
|
|
|
|
find ../ -name "*.gcno" -exec $(GCOV) -r -pb {} +
|
|
|
|
lcov --capture --directory ../ --no-external --output-file coverage.info --gcov-tool $(GCOV)
|
|
|
|
|
|
|
|
coverage_report: coverage.info
|
|
|
|
genhtml coverage.info --output-directory coverage_report
|
|
|
|
@echo "Coverage report is in coverage_report/index.html"
|
|
|
|
|
|
|
|
clean:
|
2018-05-26 02:58:01 -04:00
|
|
|
rm -f $(OBJ_FILES) $(COMPONENT_LIB)
|
2018-05-17 06:56:52 -04:00
|
|
|
rm -f $(COVERAGE_FILES) *.gcov
|
|
|
|
rm -rf coverage_report/
|
|
|
|
rm -f coverage.info
|
|
|
|
|
2018-05-26 02:58:01 -04:00
|
|
|
.PHONY: clean lib all
|