Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. TEST_PROGRAM=test_nvs
  2. all: $(TEST_PROGRAM)
  3. SOURCE_FILES = \
  4. esp_error_check_stub.cpp \
  5. $(addprefix ../src/, \
  6. nvs_types.cpp \
  7. nvs_api.cpp \
  8. nvs_page.cpp \
  9. nvs_pagemanager.cpp \
  10. nvs_storage.cpp \
  11. nvs_item_hash_list.cpp \
  12. nvs_handle_simple.cpp \
  13. nvs_handle_locked.cpp \
  14. nvs_partition_manager.cpp \
  15. nvs_partition.cpp \
  16. nvs_encrypted_partition.cpp \
  17. nvs_cxx_api.cpp \
  18. ) \
  19. spi_flash_emulation.cpp \
  20. test_compressed_enum_table.cpp \
  21. test_spi_flash_emulation.cpp \
  22. test_intrusive_list.cpp \
  23. test_nvs.cpp \
  24. test_partition_manager.cpp \
  25. test_nvs_handle.cpp \
  26. test_nvs_storage.cpp \
  27. test_nvs_partition.cpp \
  28. test_nvs_cxx_api.cpp \
  29. test_nvs_initialization.cpp \
  30. main.cpp
  31. SOURCE_FILES_C = ../../esp_rom/linux/esp_rom_crc.c
  32. ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
  33. COMPILER := clang
  34. else
  35. COMPILER := gcc
  36. endif
  37. CPPFLAGS += -I../include -I../src -I../../esp_rom/include -I../../esp_rom/include/linux -I../../log/include -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../hal/include -I ../../xtensa/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage -g2 -ggdb
  38. CFLAGS += -fprofile-arcs -ftest-coverage -DLINUX_TARGET
  39. CXXFLAGS += -std=c++11 -Wall -Werror -DLINUX_TARGET
  40. LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage
  41. ifeq ($(COMPILER),clang)
  42. CFLAGS += -fsanitize=address
  43. CXXFLAGS += -fsanitize=address
  44. LDFLAGS += -fsanitize=address
  45. endif
  46. OBJ_FILES = $(SOURCE_FILES:.cpp=.o)
  47. OBJ_FILES_C = $(SOURCE_FILES_C:.c=.o)
  48. COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
  49. $(OBJ_FILES): %.o: %.cpp
  50. $(OBJ_FILES_C): %.c: %.c
  51. $(TEST_PROGRAM): clean-coverage $(OBJ_FILES) $(OBJ_FILES_C)
  52. $(MAKE) -C ../../mbedtls/mbedtls/ lib
  53. g++ $(LDFLAGS) -o $(TEST_PROGRAM) $(OBJ_FILES) $(OBJ_FILES_C) ../../mbedtls/mbedtls/library/libmbedcrypto.a
  54. $(OUTPUT_DIR):
  55. mkdir -p $(OUTPUT_DIR)
  56. test: $(TEST_PROGRAM)
  57. ./$(TEST_PROGRAM) -d yes exclude:[long]
  58. long-test: $(TEST_PROGRAM)
  59. ./$(TEST_PROGRAM) -d yes
  60. $(COVERAGE_FILES): $(TEST_PROGRAM) long-test
  61. coverage.info: $(COVERAGE_FILES)
  62. find ../src/ -name "*.gcno" -exec gcov -r -pb {} +
  63. lcov --capture --directory ../src --no-external --output-file coverage.info
  64. coverage_report: coverage.info
  65. genhtml coverage.info --output-directory coverage_report
  66. @echo "Coverage report is in coverage_report/index.html"
  67. clean-coverage:
  68. rm -f $(COVERAGE_FILES) *.gcov
  69. rm -rf coverage_report/
  70. rm -f coverage.info
  71. clean: clean-coverage
  72. $(MAKE) -C ../../mbedtls/mbedtls/ clean
  73. rm -f $(OBJ_FILES) $(OBJ_FILES_C) $(TEST_PROGRAM)
  74. rm -f ../nvs_partition_generator/partition_single_page.bin
  75. rm -f ../nvs_partition_generator/partition_multipage_blob.bin
  76. rm -f ../nvs_partition_generator/partition_encrypted.bin
  77. rm -f ../nvs_partition_generator/partition_encrypted_using_keygen.bin
  78. rm -f ../nvs_partition_generator/partition_encrypted_using_keyfile.bin
  79. rm -f ../nvs_partition_generator/partition_decrypted.bin
  80. rm -f ../nvs_partition_generator/partition_encoded.bin
  81. rm -f ../nvs_partition_generator/Test-1-partition-encrypted.bin
  82. rm -f ../nvs_partition_generator/Test-1-partition.bin
  83. rm -f ../../../tools/mass_mfg/samples/sample_values_multipage_blob_created.csv
  84. rm -f ../../../tools/mass_mfg/samples/sample_values_singlepage_blob_created.csv
  85. .PHONY: clean clean-coverage all test long-test