Replace the remaining symlink-ing (of test harness and core emulator files) as well, to avoid mixing approaches. This way various explicit dependencies can also go away.
Signed-off-by: Jan Beulich <[email protected]> --- a/tools/fuzz/x86_instruction_emulator/Makefile +++ b/tools/fuzz/x86_instruction_emulator/Makefile @@ -8,22 +8,23 @@ else x86-insn-fuzz-all: endif +CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ + +# Add the core emulator to the build +vpath x86_emulate/%.c $(XEN_ROOT)/xen/arch/x86 +vpath x86_emulate/%.h $(XEN_ROOT)/xen/arch/x86 +CFLAGS += -iquote $(XEN_ROOT)/xen/arch/x86 + +# Add the emulator test harness to the build +vpath %.c ../../tests/x86_emulator +vpath %.h ../../tests/x86_emulator +CFLAGS += -iquote ../../tests/x86_emulator + # Add libx86 to the build vpath %.c $(XEN_ROOT)/xen/lib/x86 -x86_emulate: FORCE +x86_emulate: mkdir -p $@ - ln -sf $(XEN_ROOT)/xen/arch/x86/$@/*.[ch] $@/ - -x86_emulate/%.c: x86_emulate ; -x86_emulate/%.h: x86_emulate ; - -%.c: $(XEN_ROOT)/tools/tests/x86_emulator/%.c FORCE - ln -nsf $< $@ -%.h: $(XEN_ROOT)/tools/tests/x86_emulator/%.h FORCE - ln -nsf $< $@ - -CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote . GCOV_FLAGS := --coverage %-cov.o: %.c @@ -33,18 +34,13 @@ OBJS := fuzz-emul.o x86-emulate.o OBJS += x86_emulate/0f01.o x86_emulate/0fae.o x86_emulate/0fc7.o OBJS += x86_emulate/decode.o x86_emulate/fpu.o -WRAPPED = $(shell sed -n 's,^ *WRAP(\([[:alnum:]_]*\));,\1,p' x86-emulate.h) - -private.h := x86-emulate.h x86_emulate/x86_emulate.h x86_emulate/private.h - -x86-emulate.h: x86_emulate/x86_emulate.h -x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(private.h) -fuzz-emul.o fuzz-emul-cov.o wrappers.o: x86-emulate.h +WRAPPED = $(shell sed -n 's,^ *WRAP(\([[:alnum:]_]*\));,\1,p' \ + ../../tests/x86_emulator/x86-emulate.h) -$(filter x86_emulate/%.o,$(OBJS)): x86_emulate/%.o: x86_emulate/%.c $(private.h) +$(filter x86_emulate/%.o,$(OBJS)): x86_emulate/%.o: x86_emulate/%.c x86_emulate $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS) -$(patsubst %.o,%-cov.o,$(filter x86_emulate/%.o,$(OBJS))): x86_emulate/%-cov.o: x86_emulate/%.c $(private.h) +$(patsubst %.o,%-cov.o,$(filter x86_emulate/%.o,$(OBJS))): x86_emulate/%-cov.o: x86_emulate/%.c x86_emulate $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) $(GCOV_FLAGS) -c -o $@ $< $(APPEND_CFLAGS) x86-insn-fuzzer.a: $(OBJS) cpuid.o @@ -70,7 +66,7 @@ distclean: clean clean: rm -f *.a *.o $(DEPS_RM) *.gcda *.gcno *.gcov rm -f afl-harness afl-harness-cov libfuzzer-harness - rm -rf x86_emulate x86-emulate.c x86-emulate.h wrappers.c + rm -rf x86_emulate .PHONY: install install: all
