2021-01-12 15:56:02 +00:00
|
|
|
SRCDIR = ../src
|
|
|
|
TESTDIR = .
|
|
|
|
|
2021-01-18 19:17:44 +00:00
|
|
|
SRCOBJS := $(addprefix $(SRCDIR)/, net-utils.o net-arp.o net-ethernet.o)
|
|
|
|
TESTOBJS := $(addprefix $(TESTDIR)/, test.o net-arp.o net-utils.o)
|
|
|
|
OBJS := $(SRCOBJS) $(TESTOBJS)
|
2021-01-12 15:56:02 +00:00
|
|
|
|
|
|
|
INCLUDE = -I../uspi/include/ -I..
|
|
|
|
|
|
|
|
CC := clang
|
|
|
|
CXX := clang++
|
|
|
|
|
2021-01-18 19:17:44 +00:00
|
|
|
CFLAGS += $(ARCH) $(INCLUDE) -MMD -MP -Wall -Wno-psabi -fsigned-char -fno-builtin -g -DNDEBUG -fprofile-instr-generate -fcoverage-mapping -fsanitize=address,undefined -fno-omit-frame-pointer
|
2021-01-12 15:56:02 +00:00
|
|
|
CXXFLAGS := $(CFLAGS) $(CXXFLAGS) -std=c++11
|
|
|
|
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float -std=gnu99
|
|
|
|
|
|
|
|
TARGET ?= test
|
|
|
|
|
|
|
|
DEPENDS := $(patsubst %.o,%.d,$(OBJS))
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
2021-01-18 19:17:44 +00:00
|
|
|
coverage: $(TARGET)
|
|
|
|
LLVM_PROFILE_FILE="$(TARGET).profraw" ./$(TARGET)
|
|
|
|
llvm-profdata merge -sparse "$(TARGET).profraw" -o "$(TARGET).profdata"
|
|
|
|
llvm-cov show ./$(TARGET) -instr-profile="$(TARGET).profdata" ../src
|
|
|
|
|
2021-01-12 15:56:02 +00:00
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
@echo " LINK $@"
|
|
|
|
$(Q)$(CXX) $(CFLAGS) -o $(TARGET) $(OBJS)
|
|
|
|
|
2021-01-26 00:25:35 +00:00
|
|
|
generate-inputs: $(SRCOBJS) generate-inputs.o
|
|
|
|
@echo " LINK $@"
|
|
|
|
$(Q)$(CXX) $(CFLAGS) -o generate-inputs $(SRCOBJS) generate-inputs.o
|
|
|
|
./generate-inputs
|
|
|
|
|
|
|
|
afl: $(SRCOBJS) afl.o
|
|
|
|
@echo " LINK $@"
|
|
|
|
$(Q)afl-clang++ $(CFLAGS) -o afl $(SRCOBJS) afl.o
|
|
|
|
|
2021-01-12 15:56:02 +00:00
|
|
|
clean:
|
2021-01-26 00:25:35 +00:00
|
|
|
$(Q)$(RM) $(SRCDIR)/*.o $(TESTDIR)/*.o $(SRCDIR)/*.d $(TESTDIR)/*.d $(TARGET) kernel test afl generate-inputs *.profraw *.profdata
|