2017-04-03 09:50:12 -04:00
|
|
|
TEST_NAME=test
|
|
|
|
FUZZ=afl-fuzz
|
2018-05-04 10:42:54 -04:00
|
|
|
COMPONENTS_DIR=../..
|
2020-07-23 09:16:15 -04:00
|
|
|
COMPILER_ICLUDE_DIR=$(shell echo `which xtensa-esp32-elf-gcc | xargs dirname | xargs dirname`/xtensa-esp32-elf)
|
|
|
|
|
|
|
|
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__ -DMDNS_TEST_MODE \
|
|
|
|
-I. -I.. -I../include -I../private_include -I ./build/config -include esp32_compat.h \
|
|
|
|
-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-04 22:21:08 -05:00
|
|
|
-I$(COMPONENTS_DIR)/esp_hw_support/include \
|
2020-07-23 09:16:15 -04: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 \
|
2020-11-05 23:03:21 -05:00
|
|
|
-I$(COMPONENTS_DIR)/freertos/port/xtensa/include \
|
2020-07-23 09:16:15 -04:00
|
|
|
-I$(COMPONENTS_DIR)/freertos \
|
|
|
|
-I$(COMPONENTS_DIR)/freertos/include \
|
|
|
|
-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 10:52:17 -04:00
|
|
|
-I$(COMPONENTS_DIR)/newlib/platform_include \
|
2020-07-23 09:16:15 -04:00
|
|
|
-I$(COMPONENTS_DIR)/soc/include \
|
2020-09-25 01:57:52 -04:00
|
|
|
-I$(COMPONENTS_DIR)/soc/include \
|
|
|
|
-I$(COMPONENTS_DIR)/soc/esp32/include \
|
2020-07-23 09:16:15 -04:00
|
|
|
-I$(COMPONENTS_DIR)/soc/src/esp32/include \
|
|
|
|
-I$(COMPONENTS_DIR)/tcpip_adapter/include \
|
|
|
|
-I$(COMPONENTS_DIR)/xtensa/include \
|
|
|
|
-I$(COMPONENTS_DIR)/xtensa/esp32/include \
|
2020-11-10 02:40:01 -05:00
|
|
|
-I$(COMPILER_ICLUDE_DIR)/include
|
2020-07-23 09:16:15 -04:00
|
|
|
|
|
|
|
|
2018-05-04 10:42:54 -04:00
|
|
|
MDNS_C_DEPENDENCY_INJECTION=-include mdns_di.h
|
|
|
|
ifeq ($(INSTR),off)
|
|
|
|
CC=gcc
|
|
|
|
CFLAGS+=-DINSTR_IS_OFF
|
|
|
|
TEST_NAME=test_sim
|
|
|
|
else
|
|
|
|
CC=afl-clang-fast
|
|
|
|
endif
|
2017-04-03 09:50:12 -04:00
|
|
|
CPP=$(CC)
|
|
|
|
LD=$(CC)
|
2020-07-23 09:16:15 -04:00
|
|
|
OBJECTS=esp32_mock.o esp_netif_loopback_mock.o mdns.o test.o esp_netif_objects_mock.o
|
2017-04-03 09:50:12 -04:00
|
|
|
|
|
|
|
OS := $(shell uname)
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
LDLIBS=
|
|
|
|
else
|
2018-05-04 10:42:54 -04:00
|
|
|
LDLIBS=-lbsd
|
|
|
|
CFLAGS+=-DUSE_BSD_STRING
|
2017-04-03 09:50:12 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
all: $(TEST_NAME)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo "[CC] $<"
|
|
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
mdns.o: ../mdns.c
|
|
|
|
@echo "[CC] $<"
|
2020-11-06 04:19:51 -05:00
|
|
|
@$(CC) $(CFLAGS) -include mdns_mock.h $(MDNS_C_DEPENDENCY_INJECTION) -c $< -o $@
|
2017-04-03 09:50:12 -04:00
|
|
|
|
|
|
|
$(TEST_NAME): $(OBJECTS)
|
|
|
|
@echo "[LD] $@"
|
2018-05-04 10:42:54 -04:00
|
|
|
@$(LD) $(OBJECTS) -o $@ $(LDLIBS)
|
2017-04-03 09:50:12 -04:00
|
|
|
|
|
|
|
fuzz: $(TEST_NAME)
|
|
|
|
@$(FUZZ) -i "in" -o "out" -- ./$(TEST_NAME)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf *.o *.SYM $(TEST_NAME) out
|