1XEN_ROOT = $(CURDIR)/../../.. 2include $(XEN_ROOT)/tools/Rules.mk 3 4# libelf fuzz target 5vpath %.c ../../../xen/common/libelf 6CFLAGS += -I../../../xen/common/libelf 7ELF_SRCS-y += libelf-tools.c libelf-loader.c libelf-dominfo.c 8ELF_LIB_OBJS := $(patsubst %.c,%.o,$(ELF_SRCS-y)) 9 10$(patsubst %.c,%.o,$(ELF_SRCS-y)): CFLAGS += -Wno-pointer-sign 11 12$(ELF_LIB_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude) 13 14libelf-fuzzer.o: CFLAGS += $(CFLAGS_xeninclude) 15 16libelf.a: libelf-fuzzer.o $(ELF_LIB_OBJS) 17 $(AR) rc $@ $^ 18 19.PHONY: libelf-fuzzer-all 20libelf-fuzzer-all: libelf.a libelf-fuzzer.o 21 22afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(ELF_LIB_OBJS) 23 $(CC) $(CFLAGS) $^ -o $@ 24 25# Common targets 26.PHONY: all 27all: libelf-fuzzer-all 28 29.PHONY: distclean 30distclean: clean 31 32.PHONY: clean 33clean: 34 rm -f *.o .*.d *.a *-libelf-fuzzer 35 36.PHONY: install 37install: all 38 39.PHONY: uninstall 40 41.PHONY: afl 42afl: afl-libelf-fuzzer 43