All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: "Anthony PERARD" <anthony.perard@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [XEN PATCH v3 06/25] tools/fuzz/x86_instruction_emulator: rework makefile
Date: Fri, 24 Jun 2022 17:04:03 +0100	[thread overview]
Message-ID: <20220624160422.53457-7-anthony.perard@citrix.com> (raw)
In-Reply-To: <20220624160422.53457-1-anthony.perard@citrix.com>

Rework dependencies of all objects. We don't need to add dependencies
for headers that $(CC) is capable of generating, we only need to
include $(DEPS_INCLUDE). Some dependencies are still needed so make
knows to generate symlinks for them.

We remove the use of "vpath" for cpuid.c. While it works fine for now,
when we will convert this makefile to subdirmk, vpath will not be
usable. Also, "-iquote" is now needed to build "cpuid.o".

Replace "-I." by "-iquote .", so it applies to double-quote includes
only.

Rather than checking if a symlink exist, always regenerate the
symlink. So if the source tree changed location, the symlink is
updated.

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v2:
    - create a new per-directory .gitignore to add the new entry and existing ones

 tools/fuzz/x86_instruction_emulator/Makefile  | 32 ++++++++-----------
 .gitignore                                    |  6 ----
 .../fuzz/x86_instruction_emulator/.gitignore  |  7 ++++
 3 files changed, 21 insertions(+), 24 deletions(-)
 create mode 100644 tools/fuzz/x86_instruction_emulator/.gitignore

diff --git a/tools/fuzz/x86_instruction_emulator/Makefile b/tools/fuzz/x86_instruction_emulator/Makefile
index 1a6dbf94e1..f11437e6a2 100644
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -8,33 +8,27 @@ else
 x86-insn-fuzz-all:
 endif
 
-# Add libx86 to the build
-vpath %.c $(XEN_ROOT)/xen/lib/x86
+cpuid.c: %: $(XEN_ROOT)/xen/lib/x86/% FORCE
+	ln -nsf $< $@
 
-x86_emulate:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@
+x86_emulate: FORCE
+	ln -nsf $(XEN_ROOT)/xen/arch/x86/$@
 
 x86_emulate/%: x86_emulate ;
 
-x86-emulate.c x86-emulate.h wrappers.c: %:
-	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
+x86-emulate.c x86-emulate.h wrappers.c: %: $(XEN_ROOT)/tools/tests/x86_emulator/% FORCE
+	ln -nsf $< $@
 
-CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
+CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote .
+cpuid.o: CFLAGS += -iquote $(XEN_ROOT)/xen/lib/x86
 
 GCOV_FLAGS := --coverage
 %-cov.o: %.c
 	$(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
-x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h) \
-         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
-                     cpuid.h cpuid-autogen.h)
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
-
-# x86-emulate.c will be implicit for both
-x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
-
-fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h)
+x86-emulate.h: x86_emulate/x86_emulate.h
+x86-emulate.o x86-emulate-cov.o: x86-emulate.h x86_emulate/x86_emulate.c
+fuzz-emul.o fuzz-emul-cov.o wrappers.o: x86-emulate.h
 
 x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o
 	$(AR) rc $@ $^
@@ -51,7 +45,7 @@ all: x86-insn-fuzz-all
 
 .PHONY: distclean
 distclean: clean
-	rm -f x86_emulate x86-emulate.c x86-emulate.h
+	rm -f x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
 
 .PHONY: clean
 clean:
@@ -67,3 +61,5 @@ afl: afl-harness
 
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
+
+-include $(DEPS_INCLUDE)
diff --git a/.gitignore b/.gitignore
index 6410dfbc72..8b6886f3fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,12 +195,6 @@ tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
-tools/fuzz/x86_instruction_emulator/asm
-tools/fuzz/x86_instruction_emulator/afl-harness
-tools/fuzz/x86_instruction_emulator/afl-harness-cov
-tools/fuzz/x86_instruction_emulator/wrappers.c
-tools/fuzz/x86_instruction_emulator/x86_emulate
-tools/fuzz/x86_instruction_emulator/x86-emulate.[ch]
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
diff --git a/tools/fuzz/x86_instruction_emulator/.gitignore b/tools/fuzz/x86_instruction_emulator/.gitignore
new file mode 100644
index 0000000000..65c3cf9702
--- /dev/null
+++ b/tools/fuzz/x86_instruction_emulator/.gitignore
@@ -0,0 +1,7 @@
+/asm
+/afl-harness
+/afl-harness-cov
+/cpuid.c
+/wrappers.c
+/x86_emulate
+/x86-emulate.[ch]
-- 
Anthony PERARD



  parent reply	other threads:[~2022-06-24 16:05 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 16:03 [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-06-24 16:03 ` [XEN PATCH v3 01/25] tools/console: have one Makefile per program/directory Anthony PERARD
2022-07-08 15:08   ` Luca Fancellu
2022-06-24 16:03 ` [XEN PATCH v3 02/25] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
2022-07-08 15:23   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 03/25] tools/examples: cleanup Makefile Anthony PERARD
2022-07-08 15:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 04/25] tools/firmware/hvmloader: rework Makefile Anthony PERARD
2022-07-08 15:39   ` Luca Fancellu
2022-07-11 13:38     ` Anthony PERARD
2022-07-11 13:40       ` Luca Fancellu
2022-07-11 13:41     ` Jan Beulich
2022-07-11 13:52   ` Jan Beulich
2022-07-11 17:01     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 05/25] tools/fuzz/libelf: rework makefile Anthony PERARD
2022-07-11 11:23   ` Luca Fancellu
2022-06-24 16:04 ` Anthony PERARD [this message]
2022-07-11 13:16   ` [XEN PATCH v3 06/25] tools/fuzz/x86_instruction_emulator: " Luca Fancellu
2022-07-11 14:08   ` Jan Beulich
2022-08-02 17:09     ` Anthony PERARD
2022-08-03  5:56       ` Jan Beulich
2022-08-03 10:15         ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 07/25] tools/hotplug: cleanup Makefiles Anthony PERARD
2022-07-22 11:02   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 08/25] tools/libfsimage: Cleanup makefiles Anthony PERARD
2022-07-22 12:07   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 09/25] tools/xenpaging: Rework makefile Anthony PERARD
2022-07-22 12:17   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 10/25] tools/xentop: rework makefile Anthony PERARD
2022-07-22 13:13   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 11/25] tools/xentrace: rework Makefile Anthony PERARD
2022-07-22 13:30   ` Luca Fancellu
2022-08-08 15:35     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 12/25] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
2022-06-29 10:15   ` Juergen Gross
2022-07-05 13:17   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 13/25] tools/libs/util: cleanup Makefile Anthony PERARD
2022-06-29 10:18   ` Juergen Gross
2022-07-05 13:20   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 14/25] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
2022-07-12  1:30   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 15/25] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
2022-06-29 10:19   ` Juergen Gross
2022-07-05 13:21   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 16/25] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
2022-06-29 10:22   ` Juergen Gross
2022-07-05 13:27   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 17/25] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
2022-06-29 10:23   ` Juergen Gross
2022-07-05 13:29   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 18/25] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Anthony PERARD
2022-06-29 10:26   ` Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 19/25] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
2022-06-29 10:29   ` Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 20/25] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
2022-07-12  1:40   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 21/25] tools/helper: Cleanup Makefile Anthony PERARD
2022-07-22 14:06   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 22/25] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
2022-07-22 14:15   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 23/25] tools/helpers: Fix build of xen-init-dom0 with -Werror Anthony PERARD
2022-07-12  1:31   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 24/25] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-07-22 14:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 25/25] tools: Remove -Werror everywhere else Anthony PERARD
2022-06-29  8:59   ` Luca Fancellu
2022-06-29 17:22     ` Stefano Stabellini
2022-06-30  7:33       ` Bertrand Marquis
2022-06-30 21:03         ` Stefano Stabellini
2022-07-01 13:26           ` Bertrand Marquis
2022-07-01 17:47             ` Stefano Stabellini
2022-06-29 10:31   ` Juergen Gross
2022-06-27  7:25 ` [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624160422.53457-7-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.