2017-04-03 13:50:12 +00:00
|
|
|
TEST_NAME=test
|
|
|
|
FUZZ=afl-fuzz
|
2018-05-04 14:42:54 +00:00
|
|
|
COMPONENTS_DIR=../..
|
2020-07-23 13:16:15 +00:00
|
|
|
COMPILER_ICLUDE_DIR=$(shell echo `which xtensa-esp32-elf-gcc | xargs dirname | xargs dirname`/xtensa-esp32-elf)
|
|
|
|
|
2021-06-29 13:02:48 +00:00
|
|
|
CFLAGS=-g -Wno-unused-value -Wno-missing-declarations -Wno-pointer-bool-conversion -Wno-macro-redefined -Wno-int-to-void-pointer-cast -DHOOK_MALLOC_FAILED -DESP_EVENT_H_ -D__ESP_LOG_H__ \
|
|
|
|
-I. -I.. -I../include -I../private_include -I ./build/config \
|
2020-07-23 13:16:15 +00:00
|
|
|
-I$(COMPONENTS_DIR) \
|
|
|
|
-I$(COMPONENTS_DIR)/driver/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_common/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_event/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_eth/include \
|
2020-11-05 03:21:08 +00:00
|
|
|
-I$(COMPONENTS_DIR)/esp_hw_support/include \
|
2020-07-23 13:16:15 +00:00
|
|
|
-I$(COMPONENTS_DIR)/esp_netif/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_netif/private_include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_netif/lwip \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_rom/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_system/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_timer/include \
|
|
|
|
-I$(COMPONENTS_DIR)/esp_wifi/include \
|
2021-09-20 06:07:03 +00:00
|
|
|
-I$(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel \
|
|
|
|
-I$(COMPONENTS_DIR)/freertos/FreeRTOS-Kernel/include \
|
2022-02-17 09:40:32 +00:00
|
|
|
-I$(COMPONENTS_DIR)/freertos/esp_additions/include/freertos \
|
2020-07-23 13:16:15 +00:00
|
|
|
-I$(COMPONENTS_DIR)/hal/include \
|
|
|
|
-I$(COMPONENTS_DIR)/hal/esp32/include \
|
|
|
|
-I$(COMPONENTS_DIR)/heap/include \
|
|
|
|
-I$(COMPONENTS_DIR)/log/include \
|
|
|
|
-I$(COMPONENTS_DIR)/lwip/lwip/src/include \
|
|
|
|
-I$(COMPONENTS_DIR)/lwip/port/esp32/include \
|
|
|
|
-I$(COMPONENTS_DIR)/lwip/lwip/src/include/lwip/apps \
|
2020-09-07 14:52:17 +00:00
|
|
|
-I$(COMPONENTS_DIR)/newlib/platform_include \
|
2020-07-23 13:16:15 +00:00
|
|
|
-I$(COMPONENTS_DIR)/soc/include \
|
2020-09-25 05:57:52 +00:00
|
|
|
-I$(COMPONENTS_DIR)/soc/include \
|
|
|
|
-I$(COMPONENTS_DIR)/soc/esp32/include \
|
2020-07-23 13:16:15 +00:00
|
|
|
-I$(COMPONENTS_DIR)/soc/src/esp32/include \
|
|
|
|
-I$(COMPONENTS_DIR)/xtensa/include \
|
|
|
|
-I$(COMPONENTS_DIR)/xtensa/esp32/include \
|
2020-11-10 07:40:01 +00:00
|
|
|
-I$(COMPILER_ICLUDE_DIR)/include
|
2020-07-23 13:16:15 +00:00
|
|
|
|
|
|
|
|
2018-05-04 14:42:54 +00:00
|
|
|
MDNS_C_DEPENDENCY_INJECTION=-include mdns_di.h
|
2022-02-01 08:56:32 +00:00
|
|
|
ifeq ($(MDNS_NO_SERVICES),on)
|
|
|
|
CFLAGS+=-DMDNS_NO_SERVICES
|
|
|
|
endif
|
|
|
|
|
2018-05-04 14:42:54 +00:00
|
|
|
ifeq ($(INSTR),off)
|
|
|
|
CC=gcc
|
|
|
|
CFLAGS+=-DINSTR_IS_OFF
|
|
|
|
TEST_NAME=test_sim
|
|
|
|
else
|
|
|
|
CC=afl-clang-fast
|
|
|
|
endif
|
2017-04-03 13:50:12 +00:00
|
|
|
CPP=$(CC)
|
|
|
|
LD=$(CC)
|
2021-06-29 13:02:48 +00:00
|
|
|
OBJECTS=esp32_mock.o mdns.o test.o esp_netif_mock.o
|
2017-04-03 13:50:12 +00:00
|
|
|
|
|
|
|
OS := $(shell uname)
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
LDLIBS=
|
|
|
|
else
|
2018-05-04 14:42:54 +00:00
|
|
|
LDLIBS=-lbsd
|
|
|
|
CFLAGS+=-DUSE_BSD_STRING
|
2017-04-03 13:50:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
all: $(TEST_NAME)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo "[CC] $<"
|
|
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
mdns.o: ../mdns.c
|
|
|
|
@echo "[CC] $<"
|
2020-11-06 09:19:51 +00:00
|
|
|
@$(CC) $(CFLAGS) -include mdns_mock.h $(MDNS_C_DEPENDENCY_INJECTION) -c $< -o $@
|
2017-04-03 13:50:12 +00:00
|
|
|
|
|
|
|
$(TEST_NAME): $(OBJECTS)
|
|
|
|
@echo "[LD] $@"
|
2018-05-04 14:42:54 +00:00
|
|
|
@$(LD) $(OBJECTS) -o $@ $(LDLIBS)
|
2017-04-03 13:50:12 +00:00
|
|
|
|
|
|
|
fuzz: $(TEST_NAME)
|
|
|
|
@$(FUZZ) -i "in" -o "out" -- ./$(TEST_NAME)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf *.o *.SYM $(TEST_NAME) out
|