Files
xen/tools/fuzz/libelf/Makefile
T
Anthony PERARD ee38108991 tools/fuzz/libelf: rework makefile
Rename ELF_LIB_OBJS to LIBELF_OBJS as to have the same name as in
libs/guest/.

Replace "-I" by "-iquote".

Remove the use of "vpath". It will not works when we will convert this
makefile to subdirmk. Instead, we create symlinks to the source files.

Since we are creating a new .gitignore for the links, also move the
existing entry to it.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
2022-07-12 08:36:37 +02:00

42 lines
904 B
Makefile

XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
LIBELF_OBJS := libelf-tools.o libelf-loader.o libelf-dominfo.o
CFLAGS += -iquote ../../../xen/common/libelf
$(LIBELF_OBJS): CFLAGS += -Wno-pointer-sign
$(LIBELF_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude)
libelf-fuzzer.o: CFLAGS += $(CFLAGS_xeninclude)
$(LIBELF_OBJS:.o=.c): libelf-%.c: ../../../xen/common/libelf/libelf-%.c FORCE
ln -nsf $< $@
libelf.a: libelf-fuzzer.o $(LIBELF_OBJS)
$(AR) rc $@ $^
.PHONY: libelf-fuzzer-all
libelf-fuzzer-all: libelf.a libelf-fuzzer.o
afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(LIBELF_OBJS)
$(CC) $(CFLAGS) $^ -o $@
# Common targets
.PHONY: all
all: libelf-fuzzer-all
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
rm -f *.o .*.d *.a *-libelf-fuzzer $(LIBELF_OBJS:.o=.c)
.PHONY: install
install: all
.PHONY: uninstall
.PHONY: afl
afl: afl-libelf-fuzzer