All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles
@ 2022-08-11 16:48 Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
                   ` (33 more replies)
  0 siblings, 34 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Nick Rosbrook, Elena Ufimtseva, Andrew Cooper,
	Jan Beulich, Roger Pau Monné,
	David Scott, George Dunlap, Juergen Gross, Julien Grall,
	Stefano Stabellini, Christian Lindig, Wei Liu, Tim Deegan,
	Daniel P. Smith

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.toolstack-build-system-v4

Changes in v4:
- several new patches
- some changes to other patches listed in their changelogs

Changes in v3:
- rebased
- several new patches, starting with 13/25 "tools/libs/util: cleanup Makefile"
- introducing macros to deal with linking with in-tree xen libraries
- Add -Werror to CFLAGS for all builds in tools/

Changes in v2:
- one new patch
- other changes described in patch notes

Hi everyone,

I've been looking at reworking the build system we have for the "tools/", and
transforming it to something that suit it better. There are a lot of
dependencies between different sub-directories so it would be nice if GNU make
could actually handle them. This is possible with "non-recursive makefiles".

With non-recursive makefiles, make will have to load/include all the makefiles
and thus will have complete overview of all the dependencies. This will allow
make to build the necessary targets in other directory, and we won't need to
build sub-directories one by one.

To help with this transformation, I've chosen to go with a recent project
called "subdirmk". It help to deal with the fact that all makefiles will share
the same namespace, it is hooked into autoconf, we can easily run `make` from
any subdirectory. Together "autoconf" and "subdirmk" will also help to get
closer to be able to do out-of-tree build of the tools, but I'm mainly looking
to have non-recursive makefile.

Link to the project:
    https://www.chiark.greenend.org.uk/ucgi/~ian/git/subdirmk.git/

But before getting to the main course, I've got quite a few cleanup and some
changes to the makefiles. I start the patch series with patches that remove old
left over stuff, then start reworking makefiles. They are some common changes like
removing the "build" targets in many places as "all" would be the more common
way to spell it and "all" is the default target anyway. They are other changes
related to the conversion to "subdirmk", I start to use the variable $(TARGETS)
in several makefiles, this variable will have a special meaning in subdirmk
which will build those target by default.

As for the conversion to non-recursive makefile, with subdirmk, I have this WIP
branch, it contains some changes that I'm trying out, some notes, and the
conversion, one Makefile per commit. Cleanup are still needed, some makefile
not converted yet, but it's otherwise mostly done.

    https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.toolstack-build-system-v1-wip-extra

With that branch, you could tried something like:
    ./configure; cd tools/xl; make
and `xl` should be built as well as all the xen library needed.
Also, things like `make clean` or rebuild should be faster in the all tools/
directory.

Cheers,

Anthony PERARD (32):
  tools/debugger/gdbsx: Fix and cleanup makefiles
  tools/firmware/hvmloader: rework Makefile
  tools/fuzz/x86_instruction_emulator: rework makefile
  tools/hotplug: cleanup Makefiles
  tools/libfsimage: Cleanup makefiles
  tools/xenpaging: Rework makefile
  tools/xentop: rework makefile
  tools/xentrace: rework Makefile
  .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
  tools/libs/util: cleanup Makefile
  tools/flask/utils: list build targets in $(TARGETS)
  libs/libs.mk: Rename $(LIB) to $(TARGETS)
  libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
  libs/libs.mk: Rework target headers.chk dependencies
  tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
  tools: Introduce $(xenlibs-ldlibs, ) macro
  tools: Introduce $(xenlibs-ldflags, ) macro
  tools/helper: Cleanup Makefile
  tools/console: Use $(xenlibs-ldlibs,)
  tools: Add -Werror by default to all tools/
  tools: Remove -Werror everywhere else
  tools/hotplug: Generate "hotplugpath.sh" with configure
  libs/light/gentypes.py: allow to generate headers in subdirectory
  git-checkout.sh: handle running git-checkout from a different
    directory
  libs: Avoid exposing -Wl,--version-script to other built library
  libs: Fix auto-generation of version-script for unstable libs
  tools/include: Rework Makefile
  libs/light: Rework acpi table build targets
  libs/light: Rework generation of include/_libxl_*.h
  libs/light: Rework targets prerequisites
  libs/light: Makefile cleanup
  tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go

 tools/configure.ac                            |  2 +
 tools/Makefile                                |  2 +-
 tools/console/client/Makefile                 |  4 +-
 tools/console/daemon/Makefile                 |  7 +-
 tools/debugger/gdbsx/Makefile                 | 20 +++---
 tools/debugger/gdbsx/gx/Makefile              | 15 ++--
 tools/debugger/gdbsx/xg/Makefile              | 25 ++-----
 tools/debugger/kdd/Makefile                   |  1 -
 tools/firmware/hvmloader/Makefile             | 19 +++--
 tools/flask/utils/Makefile                    | 11 ++-
 tools/fuzz/cpu-policy/Makefile                |  2 +-
 tools/fuzz/x86_instruction_emulator/Makefile  | 35 +++++----
 tools/golang/xenlight/Makefile                |  8 ++-
 tools/helpers/Makefile                        | 23 +++---
 tools/hotplug/FreeBSD/Makefile                | 11 +--
 tools/hotplug/Linux/Makefile                  | 16 ++---
 tools/hotplug/Linux/systemd/Makefile          | 16 ++---
 tools/hotplug/NetBSD/Makefile                 |  9 +--
 tools/hotplug/common/Makefile                 | 20 ++----
 tools/include/Makefile                        | 28 ++++----
 tools/libfsimage/common/Makefile              | 11 +--
 tools/libfsimage/ext2fs-lib/Makefile          |  9 ---
 tools/libfsimage/ext2fs/Makefile              |  9 ---
 tools/libfsimage/fat/Makefile                 |  9 ---
 tools/libfsimage/iso9660/Makefile             | 11 ---
 tools/libfsimage/reiserfs/Makefile            |  9 ---
 tools/libfsimage/ufs/Makefile                 |  9 ---
 tools/libfsimage/xfs/Makefile                 |  9 ---
 tools/libfsimage/zfs/Makefile                 |  9 ---
 tools/libs/call/Makefile                      |  1 +
 tools/libs/ctrl/Makefile                      |  3 -
 tools/libs/devicemodel/Makefile               |  1 +
 tools/libs/evtchn/Makefile                    |  1 +
 tools/libs/foreignmemory/Makefile             |  1 +
 tools/libs/gnttab/Makefile                    |  1 +
 tools/libs/guest/Makefile                     |  3 -
 tools/libs/hypfs/Makefile                     |  1 +
 tools/libs/light/Makefile                     | 72 +++++++++++--------
 tools/libs/stat/Makefile                      |  2 +-
 tools/libs/store/Makefile                     |  1 +
 tools/libs/toolcore/Makefile                  |  1 +
 tools/libs/toollog/Makefile                   |  1 +
 tools/libs/util/Makefile                      |  6 +-
 tools/libs/vchan/Makefile                     |  3 -
 tools/misc/Makefile                           |  1 -
 tools/tests/cpu-policy/Makefile               |  2 +-
 tools/tests/depriv/Makefile                   |  2 +-
 tools/tests/resource/Makefile                 |  1 -
 tools/tests/tsx/Makefile                      |  1 -
 tools/tests/xenstore/Makefile                 |  1 -
 tools/xcutils/Makefile                        |  2 -
 tools/xenmon/Makefile                         |  1 -
 tools/xenpaging/Makefile                      | 25 ++++---
 tools/xenpmd/Makefile                         |  1 -
 tools/xentop/Makefile                         | 23 +++---
 tools/xentrace/Makefile                       | 29 +++-----
 tools/xl/Makefile                             |  2 +-
 tools/Rules.mk                                | 55 ++++++++++----
 tools/debugger/gdbsx/Rules.mk                 |  2 +-
 tools/firmware/Rules.mk                       |  2 -
 tools/libfsimage/Rules.mk                     | 26 +++----
 tools/libfsimage/common.mk                    | 11 +++
 tools/libs/libs.mk                            | 48 +++++++------
 tools/libs/light/libxl_x86_acpi.c             |  2 +-
 tools/ocaml/common.make                       |  2 +-
 .gitignore                                    | 38 ----------
 config/Tools.mk.in                            |  1 +
 scripts/git-checkout.sh                       |  4 +-
 tools/configure                               | 29 +++++++-
 .../fuzz/x86_instruction_emulator/.gitignore  |  7 ++
 tools/golang/xenlight/gengotypes.py           | 10 ++-
 tools/hotplug/common/hotplugpath.sh.in        | 16 +++++
 tools/libs/.gitignore                         |  2 +
 tools/libs/light/gentypes.py                  |  9 ++-
 tools/xenstore/Makefile.common                |  1 -
 75 files changed, 371 insertions(+), 442 deletions(-)
 create mode 100644 tools/libfsimage/common.mk
 create mode 100644 tools/fuzz/x86_instruction_emulator/.gitignore
 create mode 100644 tools/hotplug/common/hotplugpath.sh.in

-- 
Anthony PERARD



^ permalink raw reply	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-19 12:57   ` Ping: " Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile Anthony PERARD
                   ` (32 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Elena Ufimtseva, Wei Liu

gdbsx/:
  - Make use of subdir facility for the "clean" target.
  - No need to remove the *.a, they aren't in this dir.
  - Avoid calling "distclean" in subdirs as "distclean" targets do only
    call "clean", and the "clean" also runs "clean" in subdirs.
  - Avoid the need to make "gx_all.a" and "xg_all.a" in the "all"
    recipe by forcing make to check for update of "xg/xg_all.a" and
    "gx/gx_all.a" by having "FORCE" as prerequisite. Now, when making
    "gdbsx", make will recurse even when both *.a already exist.
  - List target in $(TARGETS).

gdbsx/*/:
  - Fix dependency on *.h.
  - Remove some dead code.
  - List targets in $(TARGETS).
  - Remove "build" target.
  - Cleanup "clean" targets.
  - remove comments about the choice of "ar" instead of "ld"
  - Use "$(AR)" instead of plain "ar".

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---

Notes:
    v2:
    - also replace plain "ar" by "$(AR)"

 tools/debugger/gdbsx/Makefile    | 20 ++++++++++----------
 tools/debugger/gdbsx/gx/Makefile | 15 +++++++--------
 tools/debugger/gdbsx/xg/Makefile | 25 +++++++------------------
 3 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/tools/debugger/gdbsx/Makefile b/tools/debugger/gdbsx/Makefile
index 5571450a89..4aaf427c45 100644
--- a/tools/debugger/gdbsx/Makefile
+++ b/tools/debugger/gdbsx/Makefile
@@ -1,20 +1,20 @@
 XEN_ROOT = $(CURDIR)/../../..
 include ./Rules.mk
 
+SUBDIRS-y += gx
+SUBDIRS-y += xg
+
+TARGETS := gdbsx
+
 .PHONY: all
-all:
-	$(MAKE) -C gx
-	$(MAKE) -C xg
-	$(MAKE) gdbsx
+all: $(TARGETS)
 
 .PHONY: clean
-clean:
-	rm -f xg_all.a gx_all.a gdbsx
-	set -e; for d in xg gx; do $(MAKE) -C $$d clean; done
+clean: subdirs-clean
+	rm -f $(TARGETS)
 
 .PHONY: distclean
 distclean: clean
-	set -e; for d in xg gx; do $(MAKE) -C $$d distclean; done
 
 .PHONY: install
 install: all
@@ -28,7 +28,7 @@ uninstall:
 gdbsx: gx/gx_all.a xg/xg_all.a 
 	$(CC) $(LDFLAGS) -o $@ $^
 
-xg/xg_all.a:
+xg/xg_all.a: FORCE
 	$(MAKE) -C xg
-gx/gx_all.a:
+gx/gx_all.a: FORCE
 	$(MAKE) -C gx
diff --git a/tools/debugger/gdbsx/gx/Makefile b/tools/debugger/gdbsx/gx/Makefile
index 3b8467f799..e9859aea9c 100644
--- a/tools/debugger/gdbsx/gx/Makefile
+++ b/tools/debugger/gdbsx/gx/Makefile
@@ -2,21 +2,20 @@ XEN_ROOT = $(CURDIR)/../../../..
 include ../Rules.mk
 
 GX_OBJS := gx_comm.o gx_main.o gx_utils.o gx_local.o
-GX_HDRS := $(wildcard *.h)
+
+TARGETS := gx_all.a
 
 .PHONY: all
-all: gx_all.a
+all: $(TARGETS)
 
 .PHONY: clean
 clean:
-	rm -rf gx_all.a *.o .*.d
+	rm -f *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
 
-#%.o: %.c $(GX_HDRS) Makefile
-#	$(CC) -c $(CFLAGS) -o $@ $<
-
-gx_all.a: $(GX_OBJS) Makefile $(GX_HDRS)
-	ar cr $@ $(GX_OBJS)        # problem with ld using -m32 
+gx_all.a: $(GX_OBJS) Makefile
+	$(AR) cr $@ $(GX_OBJS)
 
+-include $(DEPS_INCLUDE)
diff --git a/tools/debugger/gdbsx/xg/Makefile b/tools/debugger/gdbsx/xg/Makefile
index acdcddf0d5..05325d6d81 100644
--- a/tools/debugger/gdbsx/xg/Makefile
+++ b/tools/debugger/gdbsx/xg/Makefile
@@ -1,35 +1,24 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include ../Rules.mk
 
-XG_HDRS := xg_public.h 
 XG_OBJS := xg_main.o 
 
 CFLAGS += -D__XEN_TOOLS__
 CFLAGS += $(CFLAGS_xeninclude)
 
+TARGETS := xg_all.a
 
 .PHONY: all
-all: build
+all: $(TARGETS)
 
-.PHONY: build
-build: xg_all.a $(XG_HDRS) $(XG_OBJS) Makefile
-# build: mk-symlinks xg_all.a $(XG_HDRS) $(XG_OBJS) Makefile
-# build: mk-symlinks xg_all.a
-
-xg_all.a: $(XG_OBJS) Makefile $(XG_HDRS)
-	ar cr $@ $(XG_OBJS)    # problems using -m32 in ld 
-#	$(LD) -b elf32-i386 $(LDFLAGS) -r -o $@ $^
-#	$(CC) -m32 -c -o $@ $^
-
-# xg_main.o: xg_main.c Makefile $(XG_HDRS)
-#$(CC) -c $(CFLAGS) -o $@ $<
-
-# %.o: %.c $(XG_HDRS) Makefile  -- doesn't work as it won't overwrite Rules.mk
-#%.o: %.c       -- doesn't recompile when .c changed
+xg_all.a: $(XG_OBJS) Makefile
+	$(AR) cr $@ $(XG_OBJS)
 
 .PHONY: clean
 clean:
-	rm -rf xen xg_all.a $(XG_OBJS)  .*.d
+	rm -f $(TARGETS) $(XG_OBJS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
+
+-include $(DEPS_INCLUDE)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-12 13:36   ` Jan Beulich
  2022-08-11 16:48 ` [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile Anthony PERARD
                   ` (31 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Luca Fancellu, Jan Beulich, Andrew Cooper,
	Roger Pau Monné,
	Wei Liu

Setup proper dependencies with libacpi so we don't need to run "make
hvmloader" in the "all" target. ("build.o" new prerequisite isn't
exactly proper but a side effect of building the $(DSDT_FILES) is to
generate the "ssdt_*.h" needed by "build.o".)

Make use if "-iquote" instead of a plain "-I".

For "roms.inc" target, use "$(SHELL)" instead of plain "sh". And use
full path to "mkhex" instead of a relative one. Lastly, add "-f" flag
to "mv" to avoid a prompt in case the target already exist and we
don't have write permission.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---

Notes:
    v4:
    - fix reason for 'mv -f' in patch description.
    - add a comment about build.o's new prerequisites.

 tools/firmware/hvmloader/Makefile | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index b754220839..2bb5deb0c6 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -60,8 +60,7 @@ ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
 .PHONY: all
-all: acpi
-	$(MAKE) hvmloader
+all: hvmloader
 
 .PHONY: acpi
 acpi:
@@ -73,12 +72,18 @@ smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
 ACPI_PATH = ../../libacpi
 DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
 ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
-$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
+$(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
 CFLAGS += -I$(ACPI_PATH)
 vpath build.c $(ACPI_PATH)
 vpath static_tables.c $(ACPI_PATH)
 OBJS += $(ACPI_OBJS)
 
+$(DSDT_FILES): acpi
+
+# Add DSDT_FILES as a prerequisite of "build.o" so that make will also
+# generates the "ssdt_*.h" headers needed by "build.o".
+build.o: $(DSDT_FILES)
+
 hvmloader: $(OBJS) hvmloader.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
 
@@ -87,21 +92,21 @@ roms.inc: $(ROMS)
 
 ifneq ($(ROMBIOS_ROM),)
 	echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
-	sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex rombios $(ROMBIOS_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
 ifneq ($(CIRRUSVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
-	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
-	mv $@.new $@
+	mv -f $@.new $@
 
 .PHONY: clean
 clean:
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-12 13:41   ` Jan Beulich
  2022-08-11 16:48 ` [XEN PATCH v4 04/32] tools/hotplug: cleanup Makefiles Anthony PERARD
                   ` (30 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Luca Fancellu, Andrew Cooper, George Dunlap,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Roger Pau Monné

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>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---

Notes:
    v4:
    - Use pattern rules to link sources from libx86 and from x86 emulator
      tests
    - fix rm of .*.d2 dependency files
    
    v2:
    - create a new per-directory .gitignore to add the new entry and existing ones

 tools/fuzz/x86_instruction_emulator/Makefile  | 35 +++++++++----------
 .gitignore                                    |  6 ----
 .../fuzz/x86_instruction_emulator/.gitignore  |  7 ++++
 3 files changed, 24 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..13aa238503 100644
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -9,32 +9,29 @@ x86-insn-fuzz-all:
 endif
 
 # Add libx86 to the build
-vpath %.c $(XEN_ROOT)/xen/lib/x86
+%.c: $(XEN_ROOT)/xen/lib/x86/%.c 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/$*
+%.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__ -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,11 +48,11 @@ 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:
-	rm -f *.a *.o .*.d afl-harness afl-harness-cov *.gcda *.gcno *.gcov
+	rm -f *.a *.o $(DEPS_RM) afl-harness afl-harness-cov *.gcda *.gcno *.gcov
 
 .PHONY: install
 install: all
@@ -67,3 +64,5 @@ afl: afl-harness
 
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
+
+-include $(DEPS_INCLUDE)
diff --git a/.gitignore b/.gitignore
index ed7bd8bdc7..ff1d668489 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



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 04/32] tools/hotplug: cleanup Makefiles
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (2 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 05/32] tools/libfsimage: Cleanup makefiles Anthony PERARD
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

Remove "build" targets.

Use simply expanded variables when recursively expanded variable
aren't needed. (Use ":=" instead of "=".)

Don't check if a directory already exist when installing, just create
it.

Fix $(HOTPLUGPATH), it shouldn't have any double-quote.

Some reindentation.

FreeBSD, "hotplugpath.sh" is already installed by common/.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/hotplug/FreeBSD/Makefile       | 11 +++--------
 tools/hotplug/Linux/Makefile         | 16 ++++++----------
 tools/hotplug/Linux/systemd/Makefile | 16 +++++++---------
 tools/hotplug/NetBSD/Makefile        |  9 +++------
 tools/hotplug/common/Makefile        | 16 ++++++----------
 5 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/tools/hotplug/FreeBSD/Makefile b/tools/hotplug/FreeBSD/Makefile
index de9928cd86..a6552c9884 100644
--- a/tools/hotplug/FreeBSD/Makefile
+++ b/tools/hotplug/FreeBSD/Makefile
@@ -2,18 +2,15 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge block
+XEN_SCRIPTS := vif-bridge block
 
-XEN_SCRIPT_DATA =
+XEN_SCRIPT_DATA :=
 
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendriverdomain
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
@@ -44,12 +41,10 @@ install-rcd:
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
 	done
-	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
 
 .PHONY: uninstall-rcd
 uninstall-rcd:
 	rm -f $(addprefix $(DESTDIR)$(INITD_DIR)/, $(XEN_RCD_PROG))
-	rm -f $(DESTDIR)$(XEN_SCRIPT_DIR)/hotplugpath.sh
 
 .PHONY: clean
 clean:
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 0b1d111d7e..9a7b3a3515 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge
+XEN_SCRIPTS := vif-bridge
 XEN_SCRIPTS += vif-route
 XEN_SCRIPTS += vif-nat
 XEN_SCRIPTS += vif-openvswitch
@@ -22,16 +22,13 @@ XEN_SCRIPTS += launch-xenstore
 
 SUBDIRS-$(CONFIG_SYSTEMD) += systemd
 
-XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
+XEN_SCRIPT_DATA := xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
 XEN_SCRIPT_DATA += block-common.sh
 
 .PHONY: all
 all: subdirs-all
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-initd install-scripts subdirs-install
 
@@ -41,9 +38,9 @@ uninstall: uninstall-initd uninstall-scripts subdirs-uninstall
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
 install-initd:
-	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
-	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
-	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DATA) init.d/sysconfig.xendomains $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_DATA) init.d/sysconfig.xencommons $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
 	$(INSTALL_PROG) xendomains $(DESTDIR)$(LIBEXEC_BIN)
@@ -64,8 +61,7 @@ uninstall-initd:
 
 .PHONY: install-scripts
 install-scripts:
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	    do \
 	    $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
index a5d41d86ef..26df2a43b1 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -1,12 +1,12 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-XEN_SYSTEMD_MODULES = xen.conf
+XEN_SYSTEMD_MODULES := xen.conf
 
-XEN_SYSTEMD_MOUNT =  proc-xen.mount
+XEN_SYSTEMD_MOUNT := proc-xen.mount
 XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
 
-XEN_SYSTEMD_SERVICE  = xenstored.service
+XEN_SYSTEMD_SERVICE := xenstored.service
 XEN_SYSTEMD_SERVICE += xenconsoled.service
 XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
 XEN_SYSTEMD_SERVICE += xendomains.service
@@ -14,7 +14,7 @@ XEN_SYSTEMD_SERVICE += xen-watchdog.service
 XEN_SYSTEMD_SERVICE += xen-init-dom0.service
 XEN_SYSTEMD_SERVICE += xendriverdomain.service
 
-ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
+ALL_XEN_SYSTEMD :=	$(XEN_SYSTEMD_MODULES)  \
 			$(XEN_SYSTEMD_MOUNT)	\
 			$(XEN_SYSTEMD_SERVICE)
 
@@ -30,10 +30,8 @@ distclean: clean
 
 .PHONY: install
 install: $(ALL_XEN_SYSTEMD)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
-	[ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
 	$(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
@@ -48,5 +46,5 @@ $(XEN_SYSTEMD_MODULES):
 	rm -f $@.tmp
 	for mod in $(LINUX_BACKEND_MODULES) ; do \
 		echo $$mod ; \
-		done > $@.tmp
+	done > $@.tmp
 	$(call move-if-changed,$@.tmp,$@)
diff --git a/tools/hotplug/NetBSD/Makefile b/tools/hotplug/NetBSD/Makefile
index f909ffa367..1cd3db2ccb 100644
--- a/tools/hotplug/NetBSD/Makefile
+++ b/tools/hotplug/NetBSD/Makefile
@@ -2,22 +2,19 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+XEN_SCRIPTS :=
 XEN_SCRIPTS += locking.sh
 XEN_SCRIPTS += block
 XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
 XEN_SCRIPTS += qemu-ifup
 
-XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
+XEN_SCRIPT_DATA :=
+XEN_RCD_PROG := rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
 
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: install-scripts install-rcd
 
diff --git a/tools/hotplug/common/Makefile b/tools/hotplug/common/Makefile
index ef48bfacc9..e8a8dbea6c 100644
--- a/tools/hotplug/common/Makefile
+++ b/tools/hotplug/common/Makefile
@@ -1,22 +1,19 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-HOTPLUGPATH="hotplugpath.sh"
+HOTPLUGPATH := hotplugpath.sh
 
 # OS-independent hotplug scripts go in this directory
 
 # Xen scripts to go there.
-XEN_SCRIPTS =
-XEN_SCRIPT_DATA = $(HOTPLUGPATH)
+XEN_SCRIPTS :=
+XEN_SCRIPT_DATA := $(HOTPLUGPATH)
 
 genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
 $(eval $(genpath-target))
 
 .PHONY: all
-all: build
-
-.PHONY: build
-build: $(HOTPLUGPATH)
+all: $(HOTPLUGPATH)
 
 .PHONY: install
 install: install-scripts
@@ -25,9 +22,8 @@ install: install-scripts
 uninstall: uninstall-scripts
 
 .PHONY: install-scripts
-install-scripts: build
-	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+install-scripts: all
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 05/32] tools/libfsimage: Cleanup makefiles
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (3 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 04/32] tools/hotplug: cleanup Makefiles Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 06/32] tools/xenpaging: Rework makefile Anthony PERARD
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

Remove the need for "fs-*" targets by creating a "common.mk" which
have flags that are common to libfsimage/common/ and the other
libfsimages/*/ directories.

In common.mk, make $(PIC_OBJS) a recursively expanded variable so it
doesn't matter where $(LIB_SRCS-y) is defined, and remove the extra
$(PIC_OBJS) from libfsimage/common/Makefile.

Use a $(TARGETS) variable to list things to be built. And $(TARGETS)
can be use in the clean target in common.mk.

iso9660/:
    Remove the explicit dependency between fsys_iso9660.c and
    iso9660.h, this is handled automaticaly by the .*.d dependency files,
    and iso9660.h already exist.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/libfsimage/common/Makefile     | 11 +++--------
 tools/libfsimage/ext2fs-lib/Makefile |  9 ---------
 tools/libfsimage/ext2fs/Makefile     |  9 ---------
 tools/libfsimage/fat/Makefile        |  9 ---------
 tools/libfsimage/iso9660/Makefile    | 11 -----------
 tools/libfsimage/reiserfs/Makefile   |  9 ---------
 tools/libfsimage/ufs/Makefile        |  9 ---------
 tools/libfsimage/xfs/Makefile        |  9 ---------
 tools/libfsimage/zfs/Makefile        |  9 ---------
 tools/libfsimage/Rules.mk            | 26 ++++++++------------------
 tools/libfsimage/common.mk           | 11 +++++++++++
 11 files changed, 22 insertions(+), 100 deletions(-)
 create mode 100644 tools/libfsimage/common.mk

diff --git a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile
index 0c5a34baea..79f8cfd28e 100644
--- a/tools/libfsimage/common/Makefile
+++ b/tools/libfsimage/common/Makefile
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 MINOR = 0
@@ -13,12 +13,10 @@ LDFLAGS += $(PTHREAD_LDFLAGS)
 
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-LIB = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
+TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
 
 .PHONY: all
-all: $(LIB)
+all: $(TARGETS)
 
 .PHONY: install
 install: all
@@ -40,9 +38,6 @@ uninstall:
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
 
-clean distclean::
-	rm -f $(LIB)
-
 libxenfsimage.so: libxenfsimage.so.$(MAJOR)
 	ln -sf $< $@
 libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
diff --git a/tools/libfsimage/ext2fs-lib/Makefile b/tools/libfsimage/ext2fs-lib/Makefile
index 431a79068e..b9b560df75 100644
--- a/tools/libfsimage/ext2fs-lib/Makefile
+++ b/tools/libfsimage/ext2fs-lib/Makefile
@@ -9,13 +9,4 @@ FS_LIBDEPS = $(EXTFS_LIBS)
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ext2fs/Makefile b/tools/libfsimage/ext2fs/Makefile
index c62ae359ac..fe01f98148 100644
--- a/tools/libfsimage/ext2fs/Makefile
+++ b/tools/libfsimage/ext2fs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ext2fs.c
 
 FS = ext2fs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/fat/Makefile b/tools/libfsimage/fat/Makefile
index 7ee5e7588d..58bcc0751d 100644
--- a/tools/libfsimage/fat/Makefile
+++ b/tools/libfsimage/fat/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_fat.c
 
 FS = fat
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/iso9660/Makefile b/tools/libfsimage/iso9660/Makefile
index bc86baf2c0..acf3164046 100644
--- a/tools/libfsimage/iso9660/Makefile
+++ b/tools/libfsimage/iso9660/Makefile
@@ -4,15 +4,4 @@ LIB_SRCS-y = fsys_iso9660.c
 
 FS = iso9660
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
-fsys_iso9660.c: iso9660.h
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/reiserfs/Makefile b/tools/libfsimage/reiserfs/Makefile
index 5acfedf25e..42b751e007 100644
--- a/tools/libfsimage/reiserfs/Makefile
+++ b/tools/libfsimage/reiserfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_reiserfs.c
 
 FS = reiserfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ufs/Makefile b/tools/libfsimage/ufs/Makefile
index f32b9178bd..cca4f0a588 100644
--- a/tools/libfsimage/ufs/Makefile
+++ b/tools/libfsimage/ufs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ufs.c
 
 FS = ufs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/xfs/Makefile b/tools/libfsimage/xfs/Makefile
index 54eeb6e35e..ebac7baf14 100644
--- a/tools/libfsimage/xfs/Makefile
+++ b/tools/libfsimage/xfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_xfs.c
 
 FS = xfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/zfs/Makefile b/tools/libfsimage/zfs/Makefile
index 084e5ec08d..434a9c3580 100644
--- a/tools/libfsimage/zfs/Makefile
+++ b/tools/libfsimage/zfs/Makefile
@@ -28,13 +28,4 @@ LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
 
 FS = zfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk
index bb6d42abb4..cf37d6cb0d 100644
--- a/tools/libfsimage/Rules.mk
+++ b/tools/libfsimage/Rules.mk
@@ -1,25 +1,18 @@
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
-CFLAGS += -Werror -D_GNU_SOURCE
-LDFLAGS += -L../common/
-
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-FSDIR = $(libdir)/xenfsimage
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 FSLIB = fsimage.so
+TARGETS += $(FSLIB)
 
-.PHONY: fs-all
-fs-all: $(FSLIB)
+.PHONY: all
+all: $(TARGETS)
 
-.PHONY: fs-install
-fs-install: fs-all
+.PHONY: install
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
-.PHONY: fs-uninstall
-fs-uninstall:
+.PHONY: uninstall
+uninstall:
 	rm -f $(addprefix $(DESTDIR)$(FSDIR)/$(FS)/, $(FSLIB))
 	if [ -d $(DESTDIR)$(FSDIR)/$(FS) ]; then \
 		rmdir $(DESTDIR)$(FSDIR)/$(FS); \
@@ -28,7 +21,4 @@ fs-uninstall:
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lxenfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
-clean distclean::
-	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
-
 -include $(DEPS_INCLUDE)
diff --git a/tools/libfsimage/common.mk b/tools/libfsimage/common.mk
new file mode 100644
index 0000000000..77bc957f27
--- /dev/null
+++ b/tools/libfsimage/common.mk
@@ -0,0 +1,11 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+FSDIR := $(libdir)/xenfsimage
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
+CFLAGS += -Werror -D_GNU_SOURCE
+LDFLAGS += -L../common/
+
+PIC_OBJS = $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+
+clean distclean::
+	rm -f $(PIC_OBJS) $(TARGETS) $(DEPS_RM)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 06/32] tools/xenpaging: Rework makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (4 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 05/32] tools/libfsimage: Cleanup makefiles Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 07/32] tools/xentop: rework makefile Anthony PERARD
                   ` (27 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

- Rename $(SRCS) to $(OBJS-y), we don't need to collect sources.
- Rename $(IBINS) to $(TARGETS)
- Stop cleaning "xen" and non-set variable $(LIB).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenpaging/Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/xenpaging/Makefile b/tools/xenpaging/Makefile
index 04743b335c..e2ed9eaa3f 100644
--- a/tools/xenpaging/Makefile
+++ b/tools/xenpaging/Makefile
@@ -5,33 +5,33 @@ CFLAGS += $(CFLAGS_libxentoollog) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl) $(
 LDLIBS += $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(PTHREAD_LIBS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
 
-POLICY    = default
+POLICY   := default
 
-SRC      :=
-SRCS     += file_ops.c xenpaging.c policy_$(POLICY).c
-SRCS     += pagein.c
+OBJS-y   := file_ops.o
+OBJS-y   += xenpaging.o
+OBJS-y   += policy_$(POLICY).o
+OBJS-y   += pagein.o
 
 CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 
-OBJS     = $(SRCS:.c=.o)
-IBINS    = xenpaging
+TARGETS := xenpaging
 
-all: $(IBINS)
+all: $(TARGETS)
 
-xenpaging: $(OBJS)
+xenpaging: $(OBJS-y)
 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) -m 0700 $(DESTDIR)$(XEN_PAGING_DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)
 
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(IBINS))
+	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(TARGETS))
 
 clean:
-	rm -f *.o *~ $(DEPS_RM) xen TAGS $(IBINS) $(LIB)
+	rm -f *.o *~ $(DEPS_RM) TAGS $(TARGETS)
 
 distclean: clean
 
@@ -39,6 +39,6 @@ distclean: clean
 
 .PHONY: TAGS
 TAGS:
-	etags -t $(SRCS) *.h
+	etags -t *.c *.h
 
 -include $(DEPS_INCLUDE)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 07/32] tools/xentop: rework makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (5 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 06/32] tools/xenpaging: Rework makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 08/32] tools/xentrace: rework Makefile Anthony PERARD
                   ` (26 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

Add "xentop" to "TARGETS" because this variable will be useful later.

Always define all the targets, even when configured with
--disable-monitor, instead don't visit the subdirectory.
This mean xentop/ isn't visited anymore during "make clean" that's how
most other subdirs in the tools/ works.

Also add missing "xentop" rules. It only works without it because we
still have make's built-ins rules and variables, but fix this to not
have to rely on them.

Use $(TARGETS) with $(INSTALL_PROG), and thus install into the
directory rather than spelling the program name.

In the "clean" rule, use $(RM) and remove all "*.o" instead of just
one object.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---

Notes:
    v2:
    - use $(RM) in clean.
    - remove all *.o instead of just one object in "clean" rule.
    - in "install" rule, make use of $(TARGETS). install into a dir rather
      than to a specific path, in case there's more targets.

 tools/Makefile        |  2 +-
 tools/xentop/Makefile | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 79b4c7e3de..0c1d8b64a4 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -17,7 +17,7 @@ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
 SUBDIRS-$(CONFIG_X86) += firmware
 SUBDIRS-y += console
 SUBDIRS-y += xenmon
-SUBDIRS-y += xentop
+SUBDIRS-$(XENSTAT_XENTOP) += xentop
 SUBDIRS-y += libfsimage
 SUBDIRS-$(CONFIG_Linux) += vchan
 
diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 0034114684..7bd96f34d5 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -13,36 +13,33 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-ifneq ($(XENSTAT_XENTOP),y)
-.PHONY: all install xentop uninstall
-all install xentop uninstall:
-else
-
 CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
-LDFLAGS += $(APPEND_LDFLAGS)
+
+TARGETS := xentop
 
 .PHONY: all
-all: xentop
+all: $(TARGETS)
+
+xentop: xentop.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
-install: xentop
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) xentop $(DESTDIR)$(sbindir)/xentop
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(sbindir)/xentop
 
-endif
-
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 08/32] tools/xentrace: rework Makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (6 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 07/32] tools/xentop: rework makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-19 12:59   ` Ping: " Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 09/32] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
                   ` (25 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, George Dunlap, Wei Liu

Remove "build" targets.

Use "$(TARGETS)" to list binary to be built.

Cleanup "clean" rule.

Also drop conditional install of $(BIN) and $(LIBBIN) as those two
variables are now always populated.

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

Notes:
    v4:
    - also use := for BIN, SBIN, LIBBIN, SCRIPTS
    
    v2:
    - fix typo in title
    - drop conditional install of $(BIN) and $(LIBBIN)

 tools/xentrace/Makefile | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile
index 9fb7fc96e7..63f2f6532d 100644
--- a/tools/xentrace/Makefile
+++ b/tools/xentrace/Makefile
@@ -9,41 +9,36 @@ LDLIBS += $(LDLIBS_libxenevtchn)
 LDLIBS += $(LDLIBS_libxenctrl)
 LDLIBS += $(ARGP_LDFLAGS)
 
-BIN      = xenalyze
-SBIN     = xentrace xentrace_setsize
-LIBBIN   = xenctx
-SCRIPTS  = xentrace_format
+BIN     := xenalyze
+SBIN    := xentrace xentrace_setsize
+LIBBIN  := xenctx
+SCRIPTS := xentrace_format
 
-.PHONY: all
-all: build
+TARGETS := $(BIN) $(SBIN) $(LIBBIN)
 
-.PHONY: build
-build: $(BIN) $(SBIN) $(LIBBIN)
+.PHONY: all
+all: $(TARGETS)
 
 .PHONY: install
-install: build
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(bindir)
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	[ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-ifneq ($(BIN),)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) $(BIN) $(DESTDIR)$(bindir)
-endif
 	$(INSTALL_PROG) $(SBIN) $(DESTDIR)$(sbindir)
 	$(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
-	[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
 	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(LIBBIN))
 	rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
 	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(SBIN))
-ifneq ($(BIN),)
 	rm -f $(addprefix $(DESTDIR)$(bindir)/, $(BIN))
-endif
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 09/32] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (7 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 08/32] tools/xentrace: rework Makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 10/32] tools/libs/util: cleanup Makefile Anthony PERARD
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Juergen Gross, Bertrand Marquis, Andrew Cooper,
	George Dunlap, Jan Beulich, Julien Grall, Stefano Stabellini,
	Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---

Notes:
    v2:
    - move new .gitignore entries to the one in tools/libs/

 .gitignore            | 26 --------------------------
 tools/libs/.gitignore |  2 ++
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index ff1d668489..e3fe06cd13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,26 +106,8 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/toolcore/headers.chk
-tools/libs/toolcore/xentoolcore.pc
-tools/libs/toollog/headers.chk
-tools/libs/toollog/xentoollog.pc
-tools/libs/evtchn/headers.chk
-tools/libs/evtchn/xenevtchn.pc
-tools/libs/gnttab/headers.chk
-tools/libs/gnttab/xengnttab.pc
-tools/libs/hypfs/headers.chk
-tools/libs/hypfs/xenhypfs.pc
-tools/libs/call/headers.chk
-tools/libs/call/xencall.pc
 tools/libs/ctrl/libxenctrl.map
-tools/libs/ctrl/xencontrol.pc
-tools/libs/foreignmemory/headers.chk
-tools/libs/foreignmemory/xenforeignmemory.pc
-tools/libs/devicemodel/headers.chk
-tools/libs/devicemodel/xendevicemodel.pc
 tools/libs/guest/libxenguest.map
-tools/libs/guest/xenguest.pc
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -145,21 +127,13 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/light/xenlight.pc
-tools/libs/stat/headers.chk
 tools/libs/stat/libxenstat.map
-tools/libs/stat/xenstat.pc
-tools/libs/store/headers.chk
 tools/libs/store/list.h
 tools/libs/store/utils.h
-tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
-tools/libs/util/*.pc
 tools/libs/util/libxlu_cfg_y.output
 tools/libs/util/libxenutil.map
-tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
-tools/libs/vchan/xenvchan.pc
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
diff --git a/tools/libs/.gitignore b/tools/libs/.gitignore
index 4a13126144..1ad7c7f0cb 100644
--- a/tools/libs/.gitignore
+++ b/tools/libs/.gitignore
@@ -1 +1,3 @@
+*/*.pc
+*/headers.chk
 */headers.lst
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 10/32] tools/libs/util: cleanup Makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (8 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 09/32] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
                   ` (23 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Bertrand Marquis, Wei Liu

Remove -I. from CFLAGS, it isn't necessary.

Removed $(AUTOSRCS), it isn't used.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/util/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index ffe507b379..493d2e00be 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -11,7 +11,7 @@ OBJS-y += libxlu_pci.o
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
-CFLAGS += -I. $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenctrl)
 
 CFLAGS += $(PTHREAD_CFLAGS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
@@ -29,7 +29,6 @@ ifeq ($(BISON),)
 endif
 
 AUTOINCS = libxlu_cfg_y.h libxlu_cfg_l.h libxlu_disk_l.h
-AUTOSRCS = libxlu_cfg_y.c libxlu_cfg_l.c
 
 LIBHEADER := libxlutil.h
 PKG_CONFIG_NAME := Xlutil
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS)
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (9 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 10/32] tools/libs/util: cleanup Makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-15 11:31   ` Daniel P. Smith
  2022-08-11 16:48 ` [XEN PATCH v4 12/32] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
                   ` (22 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Henry Wang, Daniel P. Smith, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 tools/flask/utils/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
index db567b13dc..6be134142a 100644
--- a/tools/flask/utils/Makefile
+++ b/tools/flask/utils/Makefile
@@ -4,10 +4,10 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
-CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
+TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
 
 .PHONY: all
-all: $(CLIENTS)
+all: $(TARGETS)
 
 flask-loadpolicy: loadpolicy.o
 	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
@@ -29,7 +29,7 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(CLIENTS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
@@ -37,10 +37,10 @@ distclean: clean
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
-	$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(sbindir)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
 
 .PHONY: uninstall
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(CLIENTS))
+	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(TARGETS))
 
 -include $(DEPS_INCLUDE)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 12/32] libs/libs.mk: Rename $(LIB) to $(TARGETS)
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (10 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 13/32] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Bertrand Marquis, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 58d8166b09..e02f91f95e 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -23,9 +23,9 @@ LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
 LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
-LIB := lib$(LIB_FILE_NAME).a
+TARGETS := lib$(LIB_FILE_NAME).a
 ifneq ($(nosharedlibs),y)
-LIB += lib$(LIB_FILE_NAME).so
+TARGETS += lib$(LIB_FILE_NAME).so
 endif
 
 PKG_CONFIG ?= $(LIB_FILE_NAME).pc
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -124,7 +124,7 @@ TAGS:
 
 .PHONY: clean
 clean::
-	rm -rf $(LIB) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
+	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 13/32] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (11 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 12/32] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 14/32] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Bertrand Marquis, Wei Liu

We can simply use $(PKG_CONFIG) to set the parameters, and add it to
$(TARGETS) as necessary.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index e02f91f95e..7aee449370 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -37,10 +37,10 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG)
+$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
 PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
@@ -55,7 +55,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -127,7 +127,6 @@ clean::
 	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
-	rm -f $(PKG_CONFIG)
 
 .PHONY: distclean
 distclean: clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 14/32] libs/libs.mk: Rework target headers.chk dependencies
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (12 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 13/32] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 15/32] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Anthony PERARD
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Bertrand Marquis, Wei Liu

There is no need to call the "headers.chk" target when it isn't
wanted, so it never need to be .PHONY.

Also, there is no more reason to separate the prerequisites from the
recipe.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7aee449370..f778a7df82 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -55,22 +55,20 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
-headers.chk:
+all: headers.chk
+
+headers.chk: $(LIBHEADERS) $(AUTOINCS)
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
 	          -S -o /dev/null $$i || exit 1; \
 	    echo $$i; \
 	done >$@.new
 	mv $@.new $@
-else
-.PHONY: headers.chk
 endif
 
-headers.chk: $(LIBHEADERS) $(AUTOINCS)
-
 headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 15/32] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (13 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 14/32] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 16/32] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Wei Liu

This patch introduce a new macro $(xenlibs-dependencies,) to generate
a list of all the xen library that a library is list against, and they
are listed only once. We use the side effect of $(sort ) which remove
duplicates.

This is used by another macro $(xenlibs-rpath,) which is to replace
$(SHDEPS_libxen*).

In libs.mk, we don't need to $(sort ) SHLIB_lib* anymore as this was used
to remove duplicates and they are no more duplicates.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 29 ++++++++++++++++-------------
 tools/libs/libs.mk |  2 +-
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 47424935ba..23979ed254 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -61,13 +61,8 @@ endif
 #           public headers. Users of libfoo are therefore transitively
 #           using libbaz's header but not linking against libbaz.
 #
-# SHDEPS_libfoo: Flags for linking recursive dependencies of
-#                libfoo. Must contain SHLIB for every library which
-#                libfoo links against. So must contain both
-#                $(SHLIB_libbar) and $(SHLIB_libbaz).
-#
 # SHLIB_libfoo: Flags for recursively linking against libfoo. Must
-#               contains SHDEPS_libfoo and:
+#               contains $(call xenlibs-rpath,foo) and:
 #                   -Wl,-rpath-link=<directory containing libfoo.so>
 #
 # CFLAGS_libfoo: Flags for compiling against libfoo. Must add the
@@ -79,23 +74,31 @@ endif
 #                libfoo.
 #
 # LDLIBS_libfoo: Flags for linking against libfoo. Must contain
-#                $(SHDEPS_libfoo) and the path to libfoo.so
+#                $(call xenlibs-rpath,foo) and the path to libfoo.so
 #
 # Consumers of libfoo should include $(CFLAGS_libfoo) and
 # $(LDLIBS_libfoo) in their appropriate directories. They should not
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
-#
-# Consumers of libfoo should not directly use $(SHDEPS_libfoo) or
-# $(SHLIB_libfoo)
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
+
+# Flags for linking recursive dependencies of Xen libraries in $(1)
+define xenlibs-rpath
+    $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
+endef
 
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
- SHDEPS_libxen$(1) = $$(foreach use,$$(USELIBS_$(1)),$$(SHLIB_libxen$$(use)))
- LDLIBS_libxen$(1) = $$(SHDEPS_libxen$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
- SHLIB_libxen$(1) = $$(SHDEPS_libxen$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
+ LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index f778a7df82..d7e1274249 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -32,7 +32,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
+PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 16/32] tools: Introduce $(xenlibs-ldlibs, ) macro
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (14 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 15/32] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
                   ` (17 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross, Wei Liu

This can be used when linking against multiple in-tree Xen libraries,
and avoid duplicated flags. It can be used instead of multiple
$(LDLIBS_libxen*).

For now, replace the open-coding in libs.mk.

The macro $(xenlibs-libs, ) will be useful later when only the path to
the libraries is wanted (e.g. for checking for dependencies).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/Rules.mk     | 16 ++++++++++++++--
 tools/libs/libs.mk |  2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 23979ed254..ce77dd2eb1 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -93,12 +93,24 @@ define xenlibs-rpath
     $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
 endef
 
+# Provide a path for each library in $(1)
+define xenlibs-libs
+    $(foreach lib,$(1), \
+        $(XEN_ROOT)/tools/libs/$(lib)/lib$(FILENAME_$(lib))$(libextension))
+endef
+
+# Flags for linking against all Xen libraries listed in $(1)
+define xenlibs-ldlibs
+    $(call xenlibs-rpath,$(1)) $(call xenlibs-libs,$(1)) \
+    $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
+endef
+
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
  CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
  SHLIB_libxen$(1) = $$(call xenlibs-rpath,$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
- LDLIBS_libxen$(1) = $$(call xenlibs-rpath,$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
+ LDLIBS_libxen$(1) = $$(call xenlibs-ldlibs,$(1))
 endef
 
 $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
@@ -108,7 +120,7 @@ $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
 CFLAGS_libxenctrl += -D__XEN_TOOLS__
 
 ifeq ($(CONFIG_Linux),y)
-LDLIBS_libxenstore += -ldl
+xenlibs-ldlibs-store := -ldl
 endif
 
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index d7e1274249..2b8e7a6128 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -18,7 +18,7 @@ CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
-LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
+LDLIBS += $(call xenlibs-ldlibs,$(USELIBS_$(LIBNAME)))
 
 PIC_OBJS := $(OBJS-y:.o=.opic)
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, ) macro
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (15 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 16/32] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-19 13:09   ` Ping: " Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 18/32] tools/helper: Cleanup Makefile Anthony PERARD
                   ` (16 subsequent siblings)
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Henry Wang, Wei Liu, Nick Rosbrook

This avoid the need to open-coding the list of flags needed to link
with an in-tree Xen library when using -lxen*.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 tools/golang/xenlight/Makefile | 2 +-
 tools/Rules.mk                 | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
index 64671f246c..00e6d17f2b 100644
--- a/tools/golang/xenlight/Makefile
+++ b/tools/golang/xenlight/Makefile
@@ -27,7 +27,7 @@ GOXL_GEN_FILES = types.gen.go helpers.gen.go
 # so that it can find the actual library.
 .PHONY: build
 build: xenlight.go $(GOXL_GEN_FILES)
-	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
+	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(call xenlibs-ldflags,light toollog) $(APPEND_LDFLAGS)" $(GO) build -x
 
 .PHONY: install
 install: build
diff --git a/tools/Rules.mk b/tools/Rules.mk
index ce77dd2eb1..26958b2948 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -105,6 +105,14 @@ define xenlibs-ldlibs
     $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
 endef
 
+# Provide needed flags for linking an in-tree Xen library by an external
+# project (or when it is necessary to link with "-lxen$(1)" instead of using
+# the full path to the library).
+define xenlibs-ldflags
+    $(call xenlibs-rpath,$(1)) \
+    $(foreach lib,$(1),-L$(XEN_ROOT)/tools/libs/$(lib))
+endef
+
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 18/32] tools/helper: Cleanup Makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (16 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 19/32] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

Use $(TARGETS) to collect targets. Use := for the first target instead
of +=.
Collect library to link against in $(LDLIBS).
Remove extra "-f" flags that is already part of $(RM).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---

Notes:
    v4:
    - use := for the first TARGETS
    v3:
    - apply changes to the new "init-dom0less" helper.
    - make use of the new macro $(xenlibs-ldlibs,)

 tools/helpers/Makefile | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/helpers/Makefile b/tools/helpers/Makefile
index 8d78ab1e90..09590eb5b6 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -5,13 +5,13 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGS += xen-init-dom0
+TARGETS := xen-init-dom0
 ifeq ($(CONFIG_Linux),y)
 ifeq ($(CONFIG_X86),y)
-PROGS += init-xenstore-domain
+TARGETS += init-xenstore-domain
 endif
 ifeq ($(CONFIG_ARM),y)
-PROGS += init-dom0less
+TARGETS += init-dom0less
 endif
 endif
 
@@ -20,6 +20,7 @@ $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
+xen-init-dom0: LDLIBS += $(call xenlibs-ldlibs,ctrl toollog store light)
 
 INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -28,6 +29,7 @@ $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h
+init-xenstore-domain: LDLIBS += $(call xenlibs-ldlibs,toollog store ctrl guest light)
 
 INIT_DOM0LESS_OBJS = init-dom0less.o init-dom-json.o
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -35,30 +37,31 @@ $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenstore)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 $(INIT_DOM0LESS_OBJS): CFLAGS += $(CFLAGS_libxenevtchn)
+init-dom0less: LDLIBS += $(call xenlibs-ldlibs,ctrl evtchn toollog store light guest foreignmemory)
 
 .PHONY: all
-all: $(PROGS)
+all: $(TARGETS)
 
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 init-dom0less: $(INIT_DOM0LESS_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenevtchn) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(LDLIBS_libxenguest) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(INIT_DOM0LESS_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	for i in $(PROGS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
+	for i in $(TARGETS); do $(INSTALL_PROG) $$i $(DESTDIR)$(LIBEXEC_BIN); done
 
 .PHONY: uninstall
 uninstall:
-	for i in $(PROGS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
+	for i in $(TARGETS); do rm -f $(DESTDIR)$(LIBEXEC_BIN)/$$i; done
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 distclean: clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 19/32] tools/console: Use $(xenlibs-ldlibs,)
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (17 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 18/32] tools/helper: Cleanup Makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 20/32] tools: Add -Werror by default to all tools/ Anthony PERARD
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/console/client/Makefile | 3 +--
 tools/console/daemon/Makefile | 6 +-----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/tools/console/client/Makefile b/tools/console/client/Makefile
index 44176c6d93..e2f2554f92 100644
--- a/tools/console/client/Makefile
+++ b/tools/console/client/Makefile
@@ -6,8 +6,7 @@ CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store)
 LDLIBS += $(SOCKET_LIBS)
 
 OBJS-y := main.o
diff --git a/tools/console/daemon/Makefile b/tools/console/daemon/Makefile
index 0f004f0b14..99bb33b6a2 100644
--- a/tools/console/daemon/Makefile
+++ b/tools/console/daemon/Makefile
@@ -10,11 +10,7 @@ CFLAGS += $(CFLAGS_libxenforeignmemory)
 CFLAGS-$(CONFIG_ARM) += -DCONFIG_ARM
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-LDLIBS += $(LDLIBS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenstore)
-LDLIBS += $(LDLIBS_libxenevtchn)
-LDLIBS += $(LDLIBS_libxengnttab)
-LDLIBS += $(LDLIBS_libxenforeignmemory)
+LDLIBS += $(call xenlibs-ldlibs,ctrl store evtchn gnttab foreignmemory)
 LDLIBS += $(SOCKET_LIBS)
 LDLIBS += $(UTIL_LIBS)
 LDLIBS += -lrt
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 20/32] tools: Add -Werror by default to all tools/
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (18 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 19/32] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Luca Fancellu, Wei Liu

And provide an option to ./configure to disable it.

A follow-up patch will remove -Werror from every other Makefile in
tools/. ("tools: Remove -Werror everywhere else")

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/configure.ac |  1 +
 tools/Rules.mk     |  4 ++++
 config/Tools.mk.in |  1 +
 tools/configure    | 26 ++++++++++++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/tools/configure.ac b/tools/configure.ac
index 32cbe6bd3c..09059bc569 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -81,6 +81,7 @@ m4_include([../m4/header.m4])
 AX_XEN_EXPAND_CONFIG()
 
 # Enable/disable options
+AX_ARG_DEFAULT_ENABLE([werror], [Build tools without -Werror])
 AX_ARG_DEFAULT_DISABLE([rpath], [Build tools with -Wl,-rpath,LIBDIR])
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 26958b2948..a165dc4bda 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -133,6 +133,10 @@ endif
 
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
 
+ifeq ($(CONFIG_WERROR),y)
+CFLAGS += -Werror
+endif
+
 ifeq ($(debug),y)
 # Use -Og if available, -O0 otherwise
 dbg_opt_level := $(call cc-option,$(CC),-Og,-O0)
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 6c1a0a676f..d0d460f922 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -1,5 +1,6 @@
 -include $(XEN_ROOT)/config/Paths.mk
 
+CONFIG_WERROR       := @werror@
 CONFIG_RUMP         := @CONFIG_RUMP@
 ifeq ($(CONFIG_RUMP),y)
 XEN_OS              := NetBSDRump
diff --git a/tools/configure b/tools/configure
index 41deb7fb96..acd9a04c3b 100755
--- a/tools/configure
+++ b/tools/configure
@@ -716,6 +716,7 @@ ocamltools
 monitors
 githttp
 rpath
+werror
 DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
@@ -805,6 +806,7 @@ with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
+enable_werror
 enable_rpath
 enable_githttp
 enable_monitors
@@ -1490,6 +1492,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-largefile     omit support for large files
+  --disable-werror        Build tools without -Werror (default is ENABLED)
   --enable-rpath          Build tools with -Wl,-rpath,LIBDIR (default is
                           DISABLED)
   --enable-githttp        Download GIT repositories via HTTP (default is
@@ -4111,6 +4114,29 @@ DEBUG_DIR=$debugdir_path
 
 # Enable/disable options
 
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+  enableval=$enable_werror;
+fi
+
+
+if test "x$enable_werror" = "xno"; then :
+
+    ax_cv_werror="n"
+
+elif test "x$enable_werror" = "xyes"; then :
+
+    ax_cv_werror="y"
+
+elif test -z $ax_cv_werror; then :
+
+    ax_cv_werror="y"
+
+fi
+werror=$ax_cv_werror
+
+
+
 # Check whether --enable-rpath was given.
 if test "${enable_rpath+set}" = set; then :
   enableval=$enable_rpath;
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (19 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 20/32] tools: Add -Werror by default to all tools/ Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-15 11:34   ` Daniel P. Smith
                     ` (2 more replies)
  2022-08-11 16:48 ` [XEN PATCH v4 22/32] tools/hotplug: Generate "hotplugpath.sh" with configure Anthony PERARD
                   ` (12 subsequent siblings)
  33 siblings, 3 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Christian Lindig, Wei Liu, Elena Ufimtseva,
	Tim Deegan, Daniel P. Smith, Roger Pau Monné,
	Juergen Gross, David Scott

Patch "tools: Add -Werror by default to all tools/" have added
"-Werror" to CFLAGS in tools/Rules.mk, remove it from every other
makefiles as it is now duplicated.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/console/client/Makefile   | 1 -
 tools/console/daemon/Makefile   | 1 -
 tools/debugger/kdd/Makefile     | 1 -
 tools/flask/utils/Makefile      | 1 -
 tools/fuzz/cpu-policy/Makefile  | 2 +-
 tools/misc/Makefile             | 1 -
 tools/tests/cpu-policy/Makefile | 2 +-
 tools/tests/depriv/Makefile     | 2 +-
 tools/tests/resource/Makefile   | 1 -
 tools/tests/tsx/Makefile        | 1 -
 tools/tests/xenstore/Makefile   | 1 -
 tools/xcutils/Makefile          | 2 --
 tools/xenmon/Makefile           | 1 -
 tools/xenpaging/Makefile        | 1 -
 tools/xenpmd/Makefile           | 1 -
 tools/xentop/Makefile           | 2 +-
 tools/xentrace/Makefile         | 2 --
 tools/xl/Makefile               | 2 +-
 tools/debugger/gdbsx/Rules.mk   | 2 +-
 tools/firmware/Rules.mk         | 2 --
 tools/libfsimage/common.mk      | 2 +-
 tools/libs/libs.mk              | 2 +-
 tools/ocaml/common.make         | 2 +-
 tools/xenstore/Makefile.common  | 1 -
 24 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/tools/console/client/Makefile b/tools/console/client/Makefile
index e2f2554f92..62d89fdeb9 100644
--- a/tools/console/client/Makefile
+++ b/tools/console/client/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
diff --git a/tools/console/daemon/Makefile b/tools/console/daemon/Makefile
index 99bb33b6a2..9fc3b6711f 100644
--- a/tools/console/daemon/Makefile
+++ b/tools/console/daemon/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(CFLAGS_libxenevtchn)
diff --git a/tools/debugger/kdd/Makefile b/tools/debugger/kdd/Makefile
index 26116949d4..a72ad3b1e0 100644
--- a/tools/debugger/kdd/Makefile
+++ b/tools/debugger/kdd/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenctrl)
 CFLAGS  += -DXC_WANT_COMPAT_MAP_FOREIGN_API
 LDLIBS  += $(LDLIBS_libxenctrl)
diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
index 6be134142a..88d7edb6b1 100644
--- a/tools/flask/utils/Makefile
+++ b/tools/flask/utils/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
 TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
diff --git a/tools/fuzz/cpu-policy/Makefile b/tools/fuzz/cpu-policy/Makefile
index 41a2230408..6e7743e0aa 100644
--- a/tools/fuzz/cpu-policy/Makefile
+++ b/tools/fuzz/cpu-policy/Makefile
@@ -17,7 +17,7 @@ install: all
 
 .PHONY: uninstall
 
-CFLAGS += -Werror $(CFLAGS_xeninclude) -D__XEN_TOOLS__
+CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__
 CFLAGS += $(APPEND_CFLAGS) -Og
 
 vpath %.c ../../../xen/lib/x86
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 0e02401227..1c6e1d6a04 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makefile
index 93af9d76fa..c5b81afc71 100644
--- a/tools/tests/cpu-policy/Makefile
+++ b/tools/tests/cpu-policy/Makefile
@@ -36,7 +36,7 @@ install: all
 uninstall:
 	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
 
-CFLAGS += -Werror -D__XEN_TOOLS__
+CFLAGS += -D__XEN_TOOLS__
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(APPEND_CFLAGS)
 
diff --git a/tools/tests/depriv/Makefile b/tools/tests/depriv/Makefile
index 3cba28da25..7d9e3b01bb 100644
--- a/tools/tests/depriv/Makefile
+++ b/tools/tests/depriv/Makefile
@@ -1,7 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror -Wno-declaration-after-statement
+CFLAGS += -Wno-declaration-after-statement
 
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index b3cd70c06d..a5856bf095 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -27,7 +27,6 @@ install: all
 uninstall:
 	$(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenforeginmemory)
diff --git a/tools/tests/tsx/Makefile b/tools/tests/tsx/Makefile
index d7d2a5d95e..a4f516b725 100644
--- a/tools/tests/tsx/Makefile
+++ b/tools/tests/tsx/Makefile
@@ -26,7 +26,6 @@ uninstall:
 .PHONY: uninstall
 uninstall:
 
-CFLAGS += -Werror
 CFLAGS += -I$(XEN_ROOT)/tools/libs/ctrl -I$(XEN_ROOT)/tools/libs/guest
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
diff --git a/tools/tests/xenstore/Makefile b/tools/tests/xenstore/Makefile
index 239e1dce47..202dda0d3c 100644
--- a/tools/tests/xenstore/Makefile
+++ b/tools/tests/xenstore/Makefile
@@ -27,7 +27,6 @@ install: all
 uninstall:
 	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(APPEND_CFLAGS)
 
diff --git a/tools/xcutils/Makefile b/tools/xcutils/Makefile
index e40a2c4bfa..3687f6cd8f 100644
--- a/tools/xcutils/Makefile
+++ b/tools/xcutils/Makefile
@@ -13,8 +13,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 TARGETS := readnotes lsevtchn
 
-CFLAGS += -Werror
-
 CFLAGS_readnotes.o  := $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS_lsevtchn.o   := $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl)
 
diff --git a/tools/xenmon/Makefile b/tools/xenmon/Makefile
index 3e150b0659..679c4b41a3 100644
--- a/tools/xenmon/Makefile
+++ b/tools/xenmon/Makefile
@@ -13,7 +13,6 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS  += -Werror
 CFLAGS  += $(CFLAGS_libxenevtchn)
 CFLAGS  += $(CFLAGS_libxenctrl)
 LDLIBS  += $(LDLIBS_libxenctrl)
diff --git a/tools/xenpaging/Makefile b/tools/xenpaging/Makefile
index e2ed9eaa3f..835cf2b965 100644
--- a/tools/xenpaging/Makefile
+++ b/tools/xenpaging/Makefile
@@ -12,7 +12,6 @@ OBJS-y   += xenpaging.o
 OBJS-y   += policy_$(POLICY).o
 OBJS-y   += pagein.o
 
-CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 
 TARGETS := xenpaging
diff --git a/tools/xenpmd/Makefile b/tools/xenpmd/Makefile
index e0d3f06ab2..8da20510b5 100644
--- a/tools/xenpmd/Makefile
+++ b/tools/xenpmd/Makefile
@@ -1,7 +1,6 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 
 LDLIBS += $(LDLIBS_libxenstore)
diff --git a/tools/xentop/Makefile b/tools/xentop/Makefile
index 7bd96f34d5..70cc2211c5 100644
--- a/tools/xentop/Makefile
+++ b/tools/xentop/Makefile
@@ -13,7 +13,7 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat)
+CFLAGS += -DGCC_PRINTF $(CFLAGS_libxenstat)
 LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm
 CFLAGS += -DHOST_$(XEN_OS)
 
diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile
index 63f2f6532d..d50d400472 100644
--- a/tools/xentrace/Makefile
+++ b/tools/xentrace/Makefile
@@ -1,8 +1,6 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
-
 CFLAGS += $(CFLAGS_libxenevtchn)
 CFLAGS += $(CFLAGS_libxenctrl)
 LDLIBS += $(LDLIBS_libxenevtchn)
diff --git a/tools/xl/Makefile b/tools/xl/Makefile
index b7f439121a..5f7aa5f46c 100644
--- a/tools/xl/Makefile
+++ b/tools/xl/Makefile
@@ -5,7 +5,7 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \
+CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
 CFLAGS += -fPIC
 
diff --git a/tools/debugger/gdbsx/Rules.mk b/tools/debugger/gdbsx/Rules.mk
index 920f1c87fb..0610db873b 100644
--- a/tools/debugger/gdbsx/Rules.mk
+++ b/tools/debugger/gdbsx/Rules.mk
@@ -1,6 +1,6 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS   += -Werror -Wmissing-prototypes 
+CFLAGS   += -Wmissing-prototypes 
 # (gcc 4.3x and later)   -Wconversion -Wno-sign-conversion
 
 CFLAGS-$(clang) += -Wno-ignored-attributes
diff --git a/tools/firmware/Rules.mk b/tools/firmware/Rules.mk
index 278cca01e4..d3482c9ec4 100644
--- a/tools/firmware/Rules.mk
+++ b/tools/firmware/Rules.mk
@@ -11,8 +11,6 @@ ifneq ($(debug),y)
 CFLAGS += -DNDEBUG
 endif
 
-CFLAGS += -Werror
-
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 $(call cc-option-add,CFLAGS,CC,-fcf-protection=none)
diff --git a/tools/libfsimage/common.mk b/tools/libfsimage/common.mk
index 77bc957f27..4fc8c66795 100644
--- a/tools/libfsimage/common.mk
+++ b/tools/libfsimage/common.mk
@@ -2,7 +2,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 FSDIR := $(libdir)/xenfsimage
 CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
-CFLAGS += -Werror -D_GNU_SOURCE
+CFLAGS += -D_GNU_SOURCE
 LDFLAGS += -L../common/
 
 PIC_OBJS = $(patsubst %.c,%.opic,$(LIB_SRCS-y))
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 2b8e7a6128..e47fb30ed4 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -14,7 +14,7 @@ MINOR ?= 0
 
 SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
 
-CFLAGS   += -Werror -Wmissing-prototypes
+CFLAGS   += -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index d5478f626f..0c8a597d5b 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -9,7 +9,7 @@ OCAMLLEX ?= ocamllex
 OCAMLYACC ?= ocamlyacc
 OCAMLFIND ?= ocamlfind
 
-CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
+CFLAGS += -fPIC -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
diff --git a/tools/xenstore/Makefile.common b/tools/xenstore/Makefile.common
index 21b78b0538..ddbac052ac 100644
--- a/tools/xenstore/Makefile.common
+++ b/tools/xenstore/Makefile.common
@@ -9,7 +9,6 @@ XENSTORED_OBJS-$(CONFIG_NetBSD) += xenstored_posix.o
 XENSTORED_OBJS-$(CONFIG_FreeBSD) += xenstored_posix.o
 XENSTORED_OBJS-$(CONFIG_MiniOS) += xenstored_minios.o
 
-CFLAGS += -Werror
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += -I./include
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 22/32] tools/hotplug: Generate "hotplugpath.sh" with configure
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (20 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 23/32] libs/light/gentypes.py: allow to generate headers in subdirectory Anthony PERARD
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu

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

Notes:
    v4:
    - new patch

 tools/configure.ac                     |  1 +
 tools/hotplug/common/Makefile          | 10 ++--------
 tools/configure                        |  3 ++-
 tools/hotplug/common/hotplugpath.sh.in | 16 ++++++++++++++++
 4 files changed, 21 insertions(+), 9 deletions(-)
 create mode 100644 tools/hotplug/common/hotplugpath.sh.in

diff --git a/tools/configure.ac b/tools/configure.ac
index 09059bc569..18e481d77e 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -7,6 +7,7 @@ AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
 AC_CONFIG_SRCDIR([libs/light/libxl.c])
 AC_CONFIG_FILES([
 ../config/Tools.mk
+hotplug/common/hotplugpath.sh
 hotplug/FreeBSD/rc.d/xencommons
 hotplug/FreeBSD/rc.d/xendriverdomain
 hotplug/Linux/init.d/sysconfig.xencommons
diff --git a/tools/hotplug/common/Makefile b/tools/hotplug/common/Makefile
index e8a8dbea6c..62afe1019e 100644
--- a/tools/hotplug/common/Makefile
+++ b/tools/hotplug/common/Makefile
@@ -1,19 +1,14 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-HOTPLUGPATH := hotplugpath.sh
-
 # OS-independent hotplug scripts go in this directory
 
 # Xen scripts to go there.
 XEN_SCRIPTS :=
-XEN_SCRIPT_DATA := $(HOTPLUGPATH)
-
-genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH))
-$(eval $(genpath-target))
+XEN_SCRIPT_DATA := hotplugpath.sh
 
 .PHONY: all
-all: $(HOTPLUGPATH)
+all:
 
 .PHONY: install
 install: install-scripts
@@ -40,7 +35,6 @@ uninstall-scripts:
 
 .PHONY: clean
 clean:
-	rm -f $(HOTPLUGPATH)
 
 .PHONY: distclean
 distclean: clean
diff --git a/tools/configure b/tools/configure
index acd9a04c3b..6199823f5a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -2456,7 +2456,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/libs/xs/paths.ml ocaml/xenstored/paths.ml ocaml/xenstored/oxenstored.conf"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/common/hotplugpath.sh hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain ocaml/libs/xs/paths.ml ocaml/xenstored/paths.ml ocaml/xenstored/oxenstored.conf"
 
 ac_config_headers="$ac_config_headers config.h"
 
@@ -10947,6 +10947,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
+    "hotplug/common/hotplugpath.sh") CONFIG_FILES="$CONFIG_FILES hotplug/common/hotplugpath.sh" ;;
     "hotplug/FreeBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xencommons" ;;
     "hotplug/FreeBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xendriverdomain" ;;
     "hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;
diff --git a/tools/hotplug/common/hotplugpath.sh.in b/tools/hotplug/common/hotplugpath.sh.in
new file mode 100644
index 0000000000..1036b884b8
--- /dev/null
+++ b/tools/hotplug/common/hotplugpath.sh.in
@@ -0,0 +1,16 @@
+sbindir="@sbindir@"
+bindir="@bindir@"
+LIBEXEC="@LIBEXEC@"
+LIBEXEC_BIN="@LIBEXEC_BIN@"
+libdir="@libdir@"
+SHAREDIR="@SHAREDIR@"
+XENFIRMWAREDIR="@XENFIRMWAREDIR@"
+XEN_CONFIG_DIR="@XEN_CONFIG_DIR@"
+XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@"
+XEN_LOCK_DIR="@XEN_LOCK_DIR@"
+XEN_RUN_DIR="@XEN_RUN_DIR@"
+XEN_PAGING_DIR="@XEN_PAGING_DIR@"
+XEN_DUMP_DIR="@XEN_DUMP_DIR@"
+XEN_LOG_DIR="@XEN_LOG_DIR@"
+XEN_LIB_DIR="@XEN_LIB_DIR@"
+XEN_RUN_STORED="@XEN_RUN_STORED@"
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 23/32] libs/light/gentypes.py: allow to generate headers in subdirectory
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (21 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 22/32] tools/hotplug: Generate "hotplugpath.sh" with configure Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 24/32] git-checkout.sh: handle running git-checkout from a different directory Anthony PERARD
                   ` (10 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

This doesn't matter yet but it will when for example the script will
be run from tools/ to generate files tools/libs/light/.

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

Notes:
    v4:
    - new patch

 tools/libs/light/gentypes.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/gentypes.py b/tools/libs/light/gentypes.py
index 9a45e45acc..3fe3873242 100644
--- a/tools/libs/light/gentypes.py
+++ b/tools/libs/light/gentypes.py
@@ -584,6 +584,9 @@ def libxl_C_enum_from_string(ty, str, e, indent = "    "):
         s = indent + s
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
+def clean_header_define(header_path):
+    return header_path.split('/')[-1].upper().replace('.','_')
+
 
 if __name__ == '__main__':
     if len(sys.argv) != 6:
@@ -598,7 +601,7 @@ if __name__ == '__main__':
 
     f = open(header, "w")
 
-    header_define = header.upper().replace('.','_')
+    header_define = clean_header_define(header)
     f.write("""#ifndef %s
 #define %s
 
@@ -648,7 +651,7 @@ if __name__ == '__main__':
 
     f = open(header_json, "w")
 
-    header_json_define = header_json.upper().replace('.','_')
+    header_json_define = clean_header_define(header_json)
     f.write("""#ifndef %s
 #define %s
 
@@ -672,7 +675,7 @@ if __name__ == '__main__':
 
     f = open(header_private, "w")
 
-    header_private_define = header_private.upper().replace('.','_')
+    header_private_define = clean_header_define(header_private)
     f.write("""#ifndef %s
 #define %s
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 24/32] git-checkout.sh: handle running git-checkout from a different directory
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (22 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 23/32] libs/light/gentypes.py: allow to generate headers in subdirectory Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 25/32] libs: Avoid exposing -Wl,--version-script to other built library Anthony PERARD
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu

"$DIR" might not be a full path and it might not have `pwd` as ".."
directory. So use `cd -` to undo the first `cd` command.

Also, use `basename` to make a symbolic link with a relative path.

This doesn't matter yet but it will when for example the commands to
clone OVMF is been run from tools/ rather than tools/firmware/.

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

Notes:
    v4:
    - new patch

 scripts/git-checkout.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index 20ae31ff23..fd4425ac4e 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -19,9 +19,9 @@ if test \! -d $DIR-remote; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
 		$GIT checkout -b dummy $TAG
-		cd ..
+		cd -
 	fi
 	mv $DIR-remote.tmp $DIR-remote
 fi
 rm -f $DIR
-ln -sf $DIR-remote $DIR
+ln -sf $(basename $DIR-remote) $DIR
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 25/32] libs: Avoid exposing -Wl,--version-script to other built library
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (23 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 24/32] git-checkout.sh: handle running git-checkout from a different directory Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 26/32] libs: Fix auto-generation of version-script for unstable libs Anthony PERARD
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

$(SHLIB_LDFLAGS) is used by more targets that the single targets that
except it (libxenfoo.so.X.Y). There is also some dynamic libraries in
stats/ that uses $(SHLIB_LDFLAGS) (even if those are never built), and
there's libxenlight_test.so which doesn't needs a version script.

Also, libxenlight_test.so might failed to build if the version script
doesn't exist yet.

For these reasons, avoid changing the generic $(SHLIB_LDFLAGS) flags,
and add the flag directly on the command line.

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

Notes:
    v4:
    - new patch

 tools/libs/libs.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index e47fb30ed4..3eb91fc8f3 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -12,8 +12,6 @@ MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 endif
 MINOR ?= 0
 
-SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
-
 CFLAGS   += -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
@@ -85,7 +83,7 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 	$(SYMLINK_SHLIB) $< $@
 
 lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=libxen$(LIBNAME).map $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 26/32] libs: Fix auto-generation of version-script for unstable libs
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (24 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 25/32] libs: Avoid exposing -Wl,--version-script to other built library Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 27/32] tools/include: Rework Makefile Anthony PERARD
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu, Juergen Gross

When there isn't a version-script for a shared library (like for
unstable libs), we create one based on the current Xen version. But
that version-script became out-of-date as soon as Xen's version
changes and make as no way to regenerate the version-script on
rebuild.

In order to allow regenerating the script, we'll have a different
filename. In order to check if the content is up-to-date, we'll always
generated it and compare.

But we also need to know if there's already an existing version script
or if we need to generate one, for that we introduce $(version-script)
to be used to point to the path of the existing script. (Guessing if a
version script exist for a stable library with for example $(wildcard)
won't work as a file will exist when building the library without this
patch.)

We don't need the version-script unless we are making the shared
library so it is removed from the "all" target.

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

Alternatively, we could remove the need for to generate a
version-script, but that would mean the exported symbols won't have a
version anymore (like before, a few versions of Xen ago). Or, we could
use --default-symver, but the symboled would be versionned with the
soname (e.g. "libxenctrl.so.4.16.0") instead of "VERS_4.16.0".
---

Notes:
    v4:
    - new patch

 tools/libs/call/Makefile          |  1 +
 tools/libs/ctrl/Makefile          |  3 ---
 tools/libs/devicemodel/Makefile   |  1 +
 tools/libs/evtchn/Makefile        |  1 +
 tools/libs/foreignmemory/Makefile |  1 +
 tools/libs/gnttab/Makefile        |  1 +
 tools/libs/guest/Makefile         |  3 ---
 tools/libs/hypfs/Makefile         |  1 +
 tools/libs/light/Makefile         |  1 -
 tools/libs/stat/Makefile          |  2 +-
 tools/libs/store/Makefile         |  1 +
 tools/libs/toolcore/Makefile      |  1 +
 tools/libs/toollog/Makefile       |  1 +
 tools/libs/util/Makefile          |  3 ---
 tools/libs/vchan/Makefile         |  3 ---
 tools/libs/libs.mk                | 19 +++++++++++++------
 .gitignore                        |  6 ------
 17 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile
index 103f5ad360..56a964b517 100644
--- a/tools/libs/call/Makefile
+++ b/tools/libs/call/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 3
+version-script := libxencall.map
 
 include Makefile.common
 
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 93442ab389..094e84b8d8 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -10,6 +10,3 @@ PKG_CONFIG_NAME := Xencontrol
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-	rm -f libxenctrl.map
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index b70dd774e4..20d1d112e7 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxendevicemodel.map
 
 include Makefile.common
 
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index 3dad3840c6..18cdaab89e 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxenevtchn.map
 
 include Makefile.common
 
diff --git a/tools/libs/foreignmemory/Makefile b/tools/libs/foreignmemory/Makefile
index b70dd774e4..81398e88b1 100644
--- a/tools/libs/foreignmemory/Makefile
+++ b/tools/libs/foreignmemory/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxenforeignmemory.map
 
 include Makefile.common
 
diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile
index 3dad3840c6..4528830bdc 100644
--- a/tools/libs/gnttab/Makefile
+++ b/tools/libs/gnttab/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxengnttab.map
 
 include Makefile.common
 
diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile
index 19d3ff2fdb..93338a9301 100644
--- a/tools/libs/guest/Makefile
+++ b/tools/libs/guest/Makefile
@@ -14,6 +14,3 @@ NO_HEADERS_CHK := y
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
-
-clean::
-	rm -f libxenguest.map
diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile
index 630e1e6f3e..7fae5c750d 100644
--- a/tools/libs/hypfs/Makefile
+++ b/tools/libs/hypfs/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 0
+version-script := libxenhypfs.map
 
 LDLIBS += -lz
 
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 13545654c2..1d5716dbba 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -252,6 +252,5 @@ clean::
 	$(RM) testidl.c.new testidl.c *.api-ok
 	$(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
 	$(RM) -r __pycache__
-	$(RM) libxenlight.map
 	$(RM) $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
diff --git a/tools/libs/stat/Makefile b/tools/libs/stat/Makefile
index 7eaf50e91e..ee5c42bf7b 100644
--- a/tools/libs/stat/Makefile
+++ b/tools/libs/stat/Makefile
@@ -134,4 +134,4 @@ uninstall:: uninstall-perl-bindings
 endif
 
 clean::
-	$(RM) libxenstat.map $(BINDINGS) $(BINDINGSRC)
+	$(RM) $(BINDINGS) $(BINDINGSRC)
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
index 2334c953bb..300c271eb0 100644
--- a/tools/libs/store/Makefile
+++ b/tools/libs/store/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 4
 MINOR = 0
+version-script := libxenstore.map
 
 ifeq ($(CONFIG_Linux),y)
 LDLIBS += -ldl
diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile
index 0d92b68b3b..20671dadd0 100644
--- a/tools/libs/toolcore/Makefile
+++ b/tools/libs/toolcore/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
+version-script := libxentoolcore.map
 
 LIBHEADER := xentoolcore.h
 
diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile
index 2361b8cbf1..d612227c85 100644
--- a/tools/libs/toollog/Makefile
+++ b/tools/libs/toollog/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
+version-script := libxentoollog.map
 
 include Makefile.common
 
diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index 493d2e00be..e016baf888 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -47,6 +47,3 @@ $(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 %.c %.h:: %.l
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
-
-clean::
-	$(RM) libxenutil.map
diff --git a/tools/libs/vchan/Makefile b/tools/libs/vchan/Makefile
index ac2bff66f5..a1ef60ac8e 100644
--- a/tools/libs/vchan/Makefile
+++ b/tools/libs/vchan/Makefile
@@ -11,6 +11,3 @@ OBJS-y += io.o
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-	rm -f libxenvchan.map
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 3eb91fc8f3..cab8e9704a 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -4,6 +4,8 @@
 #   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
+#   version-script: Specify the name of a version script to the linker.
+#     (If empty, a temporary one for unstable library is created)
 
 LIBNAME := $(notdir $(CURDIR))
 
@@ -12,6 +14,10 @@ MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 endif
 MINOR ?= 0
 
+ifeq ($(origin version-script), undefined)
+version-script := libxen$(LIBNAME).map.tmp
+endif
+
 CFLAGS   += -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
@@ -53,7 +59,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 all: headers.chk
@@ -71,8 +77,9 @@ headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
 
-libxen$(LIBNAME).map:
-	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
+libxen$(LIBNAME).map.tmp: FORCE
+	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >.$@.tmp
+	$(call move-if-changed,.$@.tmp,$@)
 
 lib$(LIB_FILE_NAME).a: $(OBJS-y)
 	$(AR) rc $@ $^
@@ -82,8 +89,8 @@ lib$(LIB_FILE_NAME).so: lib$(LIB_FILE_NAME).so.$(MAJOR)
 lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 	$(SYMLINK_SHLIB) $< $@
 
-lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=libxen$(LIBNAME).map $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
+lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) $(version-script)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=$(version-script) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
@@ -122,7 +129,7 @@ TAGS:
 clean::
 	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
-	rm -f headers.chk headers.lst
+	rm -f headers.chk headers.lst libxen*.map.tmp
 
 .PHONY: distclean
 distclean: clean
diff --git a/.gitignore b/.gitignore
index e3fe06cd13..1e415fbb99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,8 +106,6 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/ctrl/libxenctrl.map
-tools/libs/guest/libxenguest.map
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -117,7 +115,6 @@ tools/libs/light/_*.[ch]
 tools/libs/light/*.pyc
 tools/libs/light/_libxl.api-for-check
 tools/libs/light/*.api-ok
-tools/libs/light/libxenlight.map
 tools/libs/light/libxl-save-helper
 tools/libs/light/dsdt*
 tools/libs/light/mk_dsdt
@@ -127,13 +124,10 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/stat/libxenstat.map
 tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xs_lib.c
 tools/libs/util/libxlu_cfg_y.output
-tools/libs/util/libxenutil.map
-tools/libs/vchan/libxenvchan.map
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 27/32] tools/include: Rework Makefile
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (25 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 26/32] libs: Fix auto-generation of version-script for unstable libs Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 28/32] libs/light: Rework acpi table build targets Anthony PERARD
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu

Rework "xen-xsm" rules to not have to change directory to run
mkflask.sh, and store mkflask.sh path in a var, and use a full path
for FLASK_H_DEPEND, and output directory is made relative.

Rename "all-y" target to a more descriptive "xen/lib/x86/all".

Removed the "dist" target which was the only one existing in tools/.

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

Notes:
    v4:
    - new patch

 tools/include/Makefile | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/tools/include/Makefile b/tools/include/Makefile
index b488f7ca9f..81c3d09039 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -7,17 +7,20 @@ include $(XEN_ROOT)/tools/Rules.mk
 # taken into account, i.e. there should be no rules added here for generating
 # any tools/include/*.h files.
 
-# Relative to $(XEN_ROOT)/xen/xsm/flask
-FLASK_H_DEPEND := policy/initial_sids
+.PHONY: all
+all: xen-foreign xen-dir xen-xsm/.dir
+ifeq ($(CONFIG_X86),y)
+all: xen/lib/x86/all
+endif
 
-.PHONY: all all-y build xen-dir
-all build: all-y xen-foreign xen-dir xen-xsm/.dir
-all-y:
+.PHONY: build
+build: all
 
 .PHONY: xen-foreign
 xen-foreign:
 	$(MAKE) -C xen-foreign
 
+.PHONY: xen-dir
 xen-dir:
 	mkdir -p xen/libelf acpi
 	find xen/ acpi/ -type l -exec rm '{}' +
@@ -36,16 +39,18 @@ ifeq ($(CONFIG_X86),y)
 	ln -s $(XEN_ROOT)/xen/include/xen/lib/x86/Makefile xen/lib/x86/
 endif
 
-all-$(CONFIG_X86): xen-dir
+.PHONY: xen/lib/x86/all
+xen/lib/x86/all: xen-dir
 	$(MAKE) -C xen/lib/x86 all XEN_ROOT=$(XEN_ROOT) PYTHON=$(PYTHON)
 
+MKFLASK := $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh
+FLASK_H_DEPEND := $(XEN_ROOT)/xen/xsm/flask/policy/initial_sids
+
 # Not xen/xsm as that clashes with link to
 # $(XEN_ROOT)/xen/include/public/xsm above.
-xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
-	      $(patsubst %,$(XEN_ROOT)/xen/xsm/flask/%,$(FLASK_H_DEPEND))
+xen-xsm/.dir: $(MKFLASK) $(FLASK_H_DEPEND)
 	mkdir -p xen-xsm/flask
-	cd $(XEN_ROOT)/xen/xsm/flask/ && \
-		$(SHELL) policy/mkflask.sh $(AWK) $(CURDIR)/xen-xsm/flask $(FLASK_H_DEPEND)
+	$(SHELL) $(MKFLASK) $(AWK) xen-xsm/flask $(FLASK_H_DEPEND)
 	touch $@
 
 .PHONY: install
@@ -84,8 +89,5 @@ clean:
 	$(MAKE) -C xen-foreign clean
 	rm -f _*.h
 
-.PHONY: dist
-dist: install
-
 .PHONY: distclean
 distclean: clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 28/32] libs/light: Rework acpi table build targets
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (26 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 27/32] tools/include: Rework Makefile Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 29/32] libs/light: Rework generation of include/_libxl_*.h Anthony PERARD
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

Currently, a rebuild of libxl will always rebuild for example
"build.o". This is because the target depends on "acpi" which never
exist. So instead we will have "build.o" have as prerequisites targets
that are actually generated by "acpi", that is $(DSDT_FILES-y).

While "dsdt_*.c" isn't really a dependency for "build.o", a side
effect of building that dsdt_*.c is to also generate the "ssdt_*.h"
that "build.o" needs, but I don't want to list all the headers needed
by "build.o" and duplicate the information available in
"libacpi/Makefile" at this time.

Also avoid duplicating the "acpi" target for Arm, and unique one for
both architecture. And move the "acpi" target to be with other targets
rather than in the middle of the source listing. For the same reason,
move the prerequisites listing for both $(DSDT_FILES-y) and "build.o".

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

Notes:
    v4:
    - new patch

 tools/libs/light/Makefile | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 1d5716dbba..4a8b0f7bcf 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -32,14 +32,10 @@ ACPI_PATH  = $(XEN_ROOT)/tools/libacpi
 DSDT_FILES-$(CONFIG_X86) = dsdt_pvh.c
 ACPI_OBJS  = $(patsubst %.c,%.o,$(DSDT_FILES-y)) build.o static_tables.o
 ACPI_PIC_OBJS = $(patsubst %.o,%.opic,$(ACPI_OBJS))
-$(DSDT_FILES-y) build.o build.opic: acpi
+
 vpath build.c $(ACPI_PATH)/
 vpath static_tables.c $(ACPI_PATH)/
 
-.PHONY: acpi
-acpi:
-	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES-y)"
-
 OBJS-$(CONFIG_X86) += $(ACPI_OBJS)
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
@@ -58,8 +54,6 @@ ifeq ($(CONFIG_ARM_64),y)
 DSDT_FILES-y = dsdt_anycpu_arm.c
 OBJS-y += libxl_arm_acpi.o
 OBJS-y += $(DSDT_FILES-y:.c=.o)
-dsdt_anycpu_arm.c:
-	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES-y)"
 else
 OBJS-$(CONFIG_ARM) += libxl_arm_no_acpi.o
 endif
@@ -191,6 +185,12 @@ all: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
 
 $(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok
 
+$(DSDT_FILES-y): acpi
+
+# Depends on the source files generated by the "acpi" target even if "build.o"
+# don't needs them but do need the headers that are also generated by "acpi".
+build.o build.opic: $(DSDT_FILES-y)
+
 libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
@@ -227,6 +227,10 @@ _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_
 $(XEN_INCLUDE)/_%.h: _%.h
 	$(call move-if-changed,_$*.h,$(XEN_INCLUDE)/_$*.h)
 
+.PHONY: acpi
+acpi:
+	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES-y)"
+
 libxenlight_test.so: $(PIC_OBJS) $(LIBXL_TEST_OBJS)
 	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 29/32] libs/light: Rework generation of include/_libxl_*.h
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (27 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 28/32] libs/light: Rework acpi table build targets Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 30/32] libs/light: Rework targets prerequisites Anthony PERARD
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

Instead of moving the public "_libxl_*.h" headers, we make a copy to
the destination so that make doesn't try to remake the targets
"_libxl_*.h" in libs/light/ again.

A new .PRECIOUS target is added to tell make to not deletes the
intermediate targets generated by "gentypes.py".

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

Notes:
    v4:
    - new patch

 tools/libs/light/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 4a8b0f7bcf..9329055c98 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -215,6 +215,8 @@ libxl_internal_json.h: _libxl_types_internal_json.h
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
+# This exploits the 'multi-target pattern rule' trick.
+# gentypes.py should be executed only once to make all the targets.
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
 	$(eval stem = $(notdir $*))
 	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
@@ -224,8 +226,10 @@ _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_
 	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
 	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
 
-$(XEN_INCLUDE)/_%.h: _%.h
-	$(call move-if-changed,_$*.h,$(XEN_INCLUDE)/_$*.h)
+.PRECIOUS: _libxl_type%.h _libxl_type%.c
+
+$(XEN_INCLUDE)/_libxl_%.h: _libxl_%.h
+	cp -f $< $@
 
 .PHONY: acpi
 acpi:
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 30/32] libs/light: Rework targets prerequisites
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (28 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 29/32] libs/light: Rework generation of include/_libxl_*.h Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 31/32] libs/light: Makefile cleanup Anthony PERARD
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

No need for $(AUTOSRCS), GNU make can generate them as needed when
trying to build them as needed when trying to build the object. Also,
those two AUTOSRCS don't need to be a prerequisite of "all". As for
the "clean" target, those two files are already removed via "_*.c".

We don't need $(AUTOINCS) either:
- As for both _libxl_savm_msgs*.h headers, we are adding more
  selective dependencies so the headers will still be generated as
  needed.
- "clean" rule already delete the _*.h files, so AUTOINCS aren't needed
  there.

"libxl_internal_json.h" doesn't seems to have ever existed, so the
dependency is removed.

Add few prerequisite for "libxl_internal.h" so all headers that it
depends on should be generated. And have $(SAVE_HELPER_OBJS) depends
on "libxl_internal.h".

Rework objects prerequisites, to have them dependents on either
"libxl.h" or "libxl_internal.h". "libxl.h" is not normally included
directly in the source code as "libxl_internal.h" is used instead. But
we are adding "libxl.h" as prerequisite of "libxl_internal.h", so
generated headers will still be generated as needed.

"testidl.c" doesn't depends on "libxl.h" but "testidl.o" does. Also
use automatic variables $< and $@.

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

Notes:
    v4:
    - new patch

 tools/libs/light/Makefile | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 9329055c98..274e8350bb 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -147,9 +147,6 @@ LIBXL_TEST_OBJS += $(foreach t, $(LIBXL_TESTS_INSIDE),libxl_test_$t.opic)
 TEST_PROG_OBJS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t.o) test_common.o
 TEST_PROGS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t)
 
-AUTOINCS = _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
-AUTOSRCS = _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
-
 CLIENTS = testidl libxl-save-helper
 
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
@@ -177,13 +174,13 @@ libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
-testidl.c: libxl_types.idl gentest.py $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
-	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
-	mv testidl.c.new testidl.c
+testidl.c: libxl_types.idl gentest.py
+	$(PYTHON) gentest.py $< $@.new
+	mv -f $@.new $@
 
-all: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
+all: $(CLIENTS) $(TEST_PROGS)
 
-$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok
+$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): libxl.api-ok
 
 $(DSDT_FILES-y): acpi
 
@@ -195,7 +192,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
+_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>$@.new
@@ -207,13 +204,22 @@ _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 	$(PERL) -w $< $@ >$@.new
 	$(call move-if-changed,$@.new,$@)
 
+#
+# headers dependencies on generated headers
+#
 $(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h
 $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h
+libxl_internal.h: $(XEN_INCLUDE)/libxl.h $(XEN_INCLUDE)/libxl_json.h
 libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h _libxl_types_internal_private.h
-libxl_internal_json.h: _libxl_types_internal_json.h
+libxl_internal.h: _libxl_save_msgs_callout.h
 
-$(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h
+#
+# objects dependencies on headers that depends on generated headers
+#
+$(TEST_PROG_OBJS): $(XEN_INCLUDE)/libxl.h
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
+$(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h _libxl_save_msgs_helper.h
+testidl.o: $(XEN_INCLUDE)/libxl.h
 
 # This exploits the 'multi-target pattern rule' trick.
 # gentypes.py should be executed only once to make all the targets.
@@ -260,5 +266,4 @@ clean::
 	$(RM) testidl.c.new testidl.c *.api-ok
 	$(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
 	$(RM) -r __pycache__
-	$(RM) $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 31/32] libs/light: Makefile cleanup
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (29 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 30/32] libs/light: Rework targets prerequisites Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-08-11 16:48 ` [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
                   ` (2 subsequent siblings)
  33 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Juergen Gross

Rework "libacpi.h" include in "libxl_x86_acpi.c" as to be more
selective about the include path and only add "tools/libacpi/". Also
"libxl_dom.c" don't use "libacpi.h" anymore. Use "-iquote" for libacpi
headers.

Get rid of the weird "$(eval stem =" in the middle of a recipe and use
a make automatic variable "$(*F)" instead.

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

Notes:
    v4:
    - new patch

 tools/libs/light/Makefile         | 16 +++++++---------
 tools/libs/light/libxl_x86_acpi.c |  2 +-
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 274e8350bb..250cc3bd2c 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -169,8 +169,7 @@ LDLIBS += $(LDLIBS-y)
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
 $(ACPI_OBJS) $(ACPI_PIC_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/libxl_x86_acpi.h\"
 $(TEST_PROG_OBJS) _libxl.api-for-check: CFLAGS += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
-libxl_dom.o libxl_dom.opic: CFLAGS += -I$(XEN_ROOT)/tools  # include libacpi/x86.h
-libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools
+libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -iquote $(ACPI_PATH)
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
@@ -224,13 +223,12 @@ testidl.o: $(XEN_INCLUDE)/libxl.h
 # This exploits the 'multi-target pattern rule' trick.
 # gentypes.py should be executed only once to make all the targets.
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
-	$(eval stem = $(notdir $*))
-	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
-		__libxl_type$(stem)_json.h  __libxl_type$(stem).c
-	$(call move-if-changed,__libxl_type$(stem).h,_libxl_type$(stem).h)
-	$(call move-if-changed,__libxl_type$(stem)_private.h,_libxl_type$(stem)_private.h)
-	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
-	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
+	$(PYTHON) gentypes.py libxl_type$(*F).idl __libxl_type$(*F).h __libxl_type$(*F)_private.h \
+		__libxl_type$(*F)_json.h  __libxl_type$(*F).c
+	$(call move-if-changed,__libxl_type$(*F).h,_libxl_type$(*F).h)
+	$(call move-if-changed,__libxl_type$(*F)_private.h,_libxl_type$(*F)_private.h)
+	$(call move-if-changed,__libxl_type$(*F)_json.h,_libxl_type$(*F)_json.h)
+	$(call move-if-changed,__libxl_type$(*F).c,_libxl_type$(*F).c)
 
 .PRECIOUS: _libxl_type%.h _libxl_type%.c
 
diff --git a/tools/libs/light/libxl_x86_acpi.c b/tools/libs/light/libxl_x86_acpi.c
index 57a6b63790..22eb160659 100644
--- a/tools/libs/light/libxl_x86_acpi.c
+++ b/tools/libs/light/libxl_x86_acpi.c
@@ -16,7 +16,7 @@
 #include "libxl_arch.h"
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/e820.h>
-#include "libacpi/libacpi.h"
+#include "libacpi.h"
 
  /* Number of pages holding ACPI tables */
 #define NUM_ACPI_PAGES 16
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (30 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 31/32] libs/light: Makefile cleanup Anthony PERARD
@ 2022-08-11 16:48 ` Anthony PERARD
  2022-10-13  8:43   ` Henry Wang
  2022-08-12  7:53 ` [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig
  2022-08-15  7:01 ` Jan Beulich
  33 siblings, 1 reply; 48+ messages in thread
From: Anthony PERARD @ 2022-08-11 16:48 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, George Dunlap, Nick Rosbrook, Wei Liu

gengotypes.py creates both "types.gen.go" and "helpers.gen.go", but
make can start gengotypes.py twice. Rework the rules so that
gengotypes.py is executed only once.

Also, add the ability to provide a path to tell gengotypes.py where to
put the files. This doesn't matter yet but it will when for example
the script will be run from tools/ to generate the targets.

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

Notes:
    v4:
    - new patch

 tools/golang/xenlight/Makefile      |  6 ++++--
 tools/golang/xenlight/gengotypes.py | 10 +++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
index 00e6d17f2b..c5bb6b94a8 100644
--- a/tools/golang/xenlight/Makefile
+++ b/tools/golang/xenlight/Makefile
@@ -15,8 +15,10 @@ all: build
 
 GOXL_GEN_FILES = types.gen.go helpers.gen.go
 
-%.gen.go: gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(LIBXL_SRC_DIR)/idl.py
-	LIBXL_SRC_DIR=$(LIBXL_SRC_DIR) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl
+# This exploits the 'multi-target pattern rule' trick.
+# gentypes.py should be executed only once to make all the targets.
+$(subst .gen.,.%.,$(GOXL_GEN_FILES)): gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(LIBXL_SRC_DIR)/idl.py
+	LIBXL_SRC_DIR=$(LIBXL_SRC_DIR) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(@D)/types.gen.go $(@D)/helpers.gen.go
 
 # Go will do its own dependency checking, and not actuall go through
 # with the build if none of the input files have changed.
diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index ac1cf060dd..ff4c2ad216 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -723,7 +723,13 @@ def xenlight_golang_fmt_name(name, exported = True):
     return words[0] + ''.join(x.title() for x in words[1:])
 
 if __name__ == '__main__':
+    if len(sys.argv) != 4:
+        print("Usage: gengotypes.py <idl> <types.gen.go> <helpers.gen.go>", file=sys.stderr)
+        sys.exit(1)
+
     idlname = sys.argv[1]
+    path_types = sys.argv[2]
+    path_helpers = sys.argv[3]
 
     (builtins, types) = idl.parse(idlname)
 
@@ -735,9 +741,11 @@ if __name__ == '__main__':
 // source: {}
 
 """.format(os.path.basename(sys.argv[0]),
-           ' '.join([os.path.basename(a) for a in sys.argv[1:]]))
+           os.path.basename(sys.argv[1]))
 
     xenlight_golang_generate_types(types=types,
+                                   path=path_types,
                                    comment=header_comment)
     xenlight_golang_generate_helpers(types=types,
+                                     path=path_helpers,
                                      comment=header_comment)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (31 preceding siblings ...)
  2022-08-11 16:48 ` [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
@ 2022-08-12  7:53 ` Christian Lindig
  2022-08-15  7:01 ` Jan Beulich
  33 siblings, 0 replies; 48+ messages in thread
From: Christian Lindig @ 2022-08-12  7:53 UTC (permalink / raw)
  To: Anthony Perard
  Cc: Xen-devel, Nick Rosbrook, Elena Ufimtseva, Andrew Cooper,
	Jan Beulich, Roger Pau Monne, David Scott, George Dunlap,
	Juergen Gross, Julien Grall, Stefano Stabellini, Wei Liu,
	Tim (Xen.org),
	Daniel P. Smith

[-- Attachment #1: Type: text/plain, Size: 2047 bytes --]



On 11 Aug 2022, at 17:48, Anthony PERARD <anthony.perard@citrix.com<mailto:anthony.perard@citrix.com>> wrote:

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.toolstack-build-system-v4

Changes in v4:
- several new patches
- some changes to other patches listed in their changelogs
[..]
Anthony PERARD (32):
 tools/debugger/gdbsx: Fix and cleanup makefiles
 tools/firmware/hvmloader: rework Makefile
 tools/fuzz/x86_instruction_emulator: rework makefile
 tools/hotplug: cleanup Makefiles
 tools/libfsimage: Cleanup makefiles
 tools/xenpaging: Rework makefile
 tools/xentop: rework makefile
 tools/xentrace: rework Makefile
 .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
 tools/libs/util: cleanup Makefile
 tools/flask/utils: list build targets in $(TARGETS)
 libs/libs.mk: Rename $(LIB) to $(TARGETS)
 libs/libs.mk: Remove the need for $(PKG_CONFIG_INST)
 libs/libs.mk: Rework target headers.chk dependencies
 tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
 tools: Introduce $(xenlibs-ldlibs, ) macro
 tools: Introduce $(xenlibs-ldflags, ) macro
 tools/helper: Cleanup Makefile
 tools/console: Use $(xenlibs-ldlibs,)
 tools: Add -Werror by default to all tools/
 tools: Remove -Werror everywhere else
 tools/hotplug: Generate "hotplugpath.sh" with configure
 libs/light/gentypes.py: allow to generate headers in subdirectory
 git-checkout.sh: handle running git-checkout from a different
   directory
 libs: Avoid exposing -Wl,--version-script to other built library
 libs: Fix auto-generation of version-script for unstable libs
 tools/include: Rework Makefile
 libs/light: Rework acpi table build targets
 libs/light: Rework generation of include/_libxl_*.h
 libs/light: Rework targets prerequisites
 libs/light: Makefile cleanup
 tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go

Acked-by: Christian Lindig <christian.lindig@citrix.com<mailto:christian.lindig@citrix.com>>



[-- Attachment #2: Type: text/html, Size: 3669 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile
  2022-08-11 16:48 ` [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile Anthony PERARD
@ 2022-08-12 13:36   ` Jan Beulich
  2022-08-12 14:28     ` Anthony PERARD
  0 siblings, 1 reply; 48+ messages in thread
From: Jan Beulich @ 2022-08-12 13:36 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Luca Fancellu, Andrew Cooper, Roger Pau Monné, Wei Liu, xen-devel

On 11.08.2022 18:48, Anthony PERARD wrote:
> Setup proper dependencies with libacpi so we don't need to run "make
> hvmloader" in the "all" target. ("build.o" new prerequisite isn't
> exactly proper but a side effect of building the $(DSDT_FILES) is to
> generate the "ssdt_*.h" needed by "build.o".)
> 
> Make use if "-iquote" instead of a plain "-I".
> 
> For "roms.inc" target, use "$(SHELL)" instead of plain "sh". And use
> full path to "mkhex" instead of a relative one. Lastly, add "-f" flag
> to "mv" to avoid a prompt in case the target already exist and we
> don't have write permission.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
with one nit (which I'd be happy to take care of while committing):

> @@ -73,12 +72,18 @@ smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
>  ACPI_PATH = ../../libacpi
>  DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
>  ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
> -$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
> +$(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
>  CFLAGS += -I$(ACPI_PATH)
>  vpath build.c $(ACPI_PATH)
>  vpath static_tables.c $(ACPI_PATH)
>  OBJS += $(ACPI_OBJS)
>  
> +$(DSDT_FILES): acpi
> +
> +# Add DSDT_FILES as a prerequisite of "build.o" so that make will also
> +# generates the "ssdt_*.h" headers needed by "build.o".

s/generates/generate/ ?

Jan


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile
  2022-08-11 16:48 ` [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile Anthony PERARD
@ 2022-08-12 13:41   ` Jan Beulich
  0 siblings, 0 replies; 48+ messages in thread
From: Jan Beulich @ 2022-08-12 13:41 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Luca Fancellu, Andrew Cooper, George Dunlap, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	xen-devel

On 11.08.2022 18:48, Anthony PERARD wrote:
> 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>
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile
  2022-08-12 13:36   ` Jan Beulich
@ 2022-08-12 14:28     ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-12 14:28 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Luca Fancellu, Andrew Cooper, Roger Pau Monné, Wei Liu, xen-devel

On Fri, Aug 12, 2022 at 03:36:12PM +0200, Jan Beulich wrote:
> On 11.08.2022 18:48, Anthony PERARD wrote:
> > Setup proper dependencies with libacpi so we don't need to run "make
> > hvmloader" in the "all" target. ("build.o" new prerequisite isn't
> > exactly proper but a side effect of building the $(DSDT_FILES) is to
> > generate the "ssdt_*.h" needed by "build.o".)
> > 
> > Make use if "-iquote" instead of a plain "-I".
> > 
> > For "roms.inc" target, use "$(SHELL)" instead of plain "sh". And use
> > full path to "mkhex" instead of a relative one. Lastly, add "-f" flag
> > to "mv" to avoid a prompt in case the target already exist and we
> > don't have write permission.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> with one nit (which I'd be happy to take care of while committing):
> 
> > @@ -73,12 +72,18 @@ smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
> >  ACPI_PATH = ../../libacpi
> >  DSDT_FILES = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
> >  ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
> > -$(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
> > +$(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
> >  CFLAGS += -I$(ACPI_PATH)
> >  vpath build.c $(ACPI_PATH)
> >  vpath static_tables.c $(ACPI_PATH)
> >  OBJS += $(ACPI_OBJS)
> >  
> > +$(DSDT_FILES): acpi
> > +
> > +# Add DSDT_FILES as a prerequisite of "build.o" so that make will also
> > +# generates the "ssdt_*.h" headers needed by "build.o".
> 
> s/generates/generate/ ?

Yes, thanks.

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles
  2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
                   ` (32 preceding siblings ...)
  2022-08-12  7:53 ` [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig
@ 2022-08-15  7:01 ` Jan Beulich
  2022-08-19 13:40   ` Anthony PERARD
  33 siblings, 1 reply; 48+ messages in thread
From: Jan Beulich @ 2022-08-15  7:01 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Nick Rosbrook, Elena Ufimtseva, Andrew Cooper,
	Roger Pau Monné,
	David Scott, George Dunlap, Juergen Gross, Julien Grall,
	Stefano Stabellini, Christian Lindig, Wei Liu, Tim Deegan,
	Daniel P. Smith, xen-devel

On 11.08.2022 18:48, Anthony PERARD wrote:
> Patch series available in this git branch:
> https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.toolstack-build-system-v4
> 
> Changes in v4:
> - several new patches
> - some changes to other patches listed in their changelogs

I've committed a non-contiguous initial part of this series, omitting
patches where acks still look to be missing, and hence only up to a
point where I could be reasonably certain that the skipped patches
won't interact with later ones. If you can indicate which further
sufficiently reviewed/acked parts of the series are independent of
earlier parts which aren't fully ready yet, I'd be happy to throw in
more.

Jan


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS)
  2022-08-11 16:48 ` [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
@ 2022-08-15 11:31   ` Daniel P. Smith
  0 siblings, 0 replies; 48+ messages in thread
From: Daniel P. Smith @ 2022-08-15 11:31 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel; +Cc: Henry Wang, Wei Liu

On 8/11/22 12:48, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Henry Wang <Henry.Wang@arm.com>
> ---
>   tools/flask/utils/Makefile | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
> index db567b13dc..6be134142a 100644
> --- a/tools/flask/utils/Makefile
> +++ b/tools/flask/utils/Makefile
> @@ -4,10 +4,10 @@ include $(XEN_ROOT)/tools/Rules.mk
>   CFLAGS += -Werror
>   CFLAGS += $(CFLAGS_libxenctrl)
>   
> -CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
> +TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
>   
>   .PHONY: all
> -all: $(CLIENTS)
> +all: $(TARGETS)
>   
>   flask-loadpolicy: loadpolicy.o
>   	$(CC) $(LDFLAGS) $< $(LDLIBS) $(LDLIBS_libxenctrl) -o $@
> @@ -29,7 +29,7 @@ flask-set-bool: set-bool.o
>   
>   .PHONY: clean
>   clean:
> -	$(RM) *.o $(CLIENTS) $(DEPS_RM)
> +	$(RM) *.o $(TARGETS) $(DEPS_RM)
>   
>   .PHONY: distclean
>   distclean: clean
> @@ -37,10 +37,10 @@ distclean: clean
>   .PHONY: install
>   install: all
>   	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
> -	$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(sbindir)
> +	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(sbindir)
>   
>   .PHONY: uninstall
>   uninstall:
> -	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(CLIENTS))
> +	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(TARGETS))
>   
>   -include $(DEPS_INCLUDE)

Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else
  2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
@ 2022-08-15 11:34   ` Daniel P. Smith
  2022-08-19 13:25   ` Ping: " Anthony PERARD
  2022-08-19 14:56   ` Jan Beulich
  2 siblings, 0 replies; 48+ messages in thread
From: Daniel P. Smith @ 2022-08-15 11:34 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel
  Cc: Christian Lindig, Wei Liu, Elena Ufimtseva, Tim Deegan,
	Roger Pau Monné,
	Juergen Gross, David Scott

On 8/11/22 12:48, Anthony PERARD wrote:
> Patch "tools: Add -Werror by default to all tools/" have added
> "-Werror" to CFLAGS in tools/Rules.mk, remove it from every other
> makefiles as it is now duplicated.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Christian Lindig <christian.lindig@citrix.com>
> ---
>   tools/console/client/Makefile   | 1 -
>   tools/console/daemon/Makefile   | 1 -
>   tools/debugger/kdd/Makefile     | 1 -
>   tools/flask/utils/Makefile      | 1 -
>   tools/fuzz/cpu-policy/Makefile  | 2 +-
>   tools/misc/Makefile             | 1 -
>   tools/tests/cpu-policy/Makefile | 2 +-
>   tools/tests/depriv/Makefile     | 2 +-
>   tools/tests/resource/Makefile   | 1 -
>   tools/tests/tsx/Makefile        | 1 -
>   tools/tests/xenstore/Makefile   | 1 -
>   tools/xcutils/Makefile          | 2 --
>   tools/xenmon/Makefile           | 1 -
>   tools/xenpaging/Makefile        | 1 -
>   tools/xenpmd/Makefile           | 1 -
>   tools/xentop/Makefile           | 2 +-
>   tools/xentrace/Makefile         | 2 --
>   tools/xl/Makefile               | 2 +-
>   tools/debugger/gdbsx/Rules.mk   | 2 +-
>   tools/firmware/Rules.mk         | 2 --
>   tools/libfsimage/common.mk      | 2 +-
>   tools/libs/libs.mk              | 2 +-
>   tools/ocaml/common.make         | 2 +-
>   tools/xenstore/Makefile.common  | 1 -
>   24 files changed, 9 insertions(+), 27 deletions(-)

...

> diff --git a/tools/flask/utils/Makefile b/tools/flask/utils/Makefile
> index 6be134142a..88d7edb6b1 100644
> --- a/tools/flask/utils/Makefile
> +++ b/tools/flask/utils/Makefile
> @@ -1,7 +1,6 @@
>   XEN_ROOT=$(CURDIR)/../../..
>   include $(XEN_ROOT)/tools/Rules.mk
>   
> -CFLAGS += -Werror
>   CFLAGS += $(CFLAGS_libxenctrl)
>   
>   TARGETS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool

Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Ping: [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles
  2022-08-11 16:48 ` [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
@ 2022-08-19 12:57   ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 12:57 UTC (permalink / raw)
  To: Elena Ufimtseva; +Cc: Wei Liu, xen-devel

Hi Elena,

Could you give a ack or review this patch?

Thanks,

On Thu, Aug 11, 2022 at 05:48:14PM +0100, Anthony PERARD wrote:
> gdbsx/:
>   - Make use of subdir facility for the "clean" target.
>   - No need to remove the *.a, they aren't in this dir.
>   - Avoid calling "distclean" in subdirs as "distclean" targets do only
>     call "clean", and the "clean" also runs "clean" in subdirs.
>   - Avoid the need to make "gx_all.a" and "xg_all.a" in the "all"
>     recipe by forcing make to check for update of "xg/xg_all.a" and
>     "gx/gx_all.a" by having "FORCE" as prerequisite. Now, when making
>     "gdbsx", make will recurse even when both *.a already exist.
>   - List target in $(TARGETS).
> 
> gdbsx/*/:
>   - Fix dependency on *.h.
>   - Remove some dead code.
>   - List targets in $(TARGETS).
>   - Remove "build" target.
>   - Cleanup "clean" targets.
>   - remove comments about the choice of "ar" instead of "ld"
>   - Use "$(AR)" instead of plain "ar".
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Ping: [XEN PATCH v4 08/32] tools/xentrace: rework Makefile
  2022-08-11 16:48 ` [XEN PATCH v4 08/32] tools/xentrace: rework Makefile Anthony PERARD
@ 2022-08-19 12:59   ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 12:59 UTC (permalink / raw)
  To: George Dunlap; +Cc: Wei Liu, xen-devel

Hi George

Could you give a ack or review this patch?

Thanks,

On Thu, Aug 11, 2022 at 05:48:21PM +0100, Anthony PERARD wrote:
> Remove "build" targets.
> 
> Use "$(TARGETS)" to list binary to be built.
> 
> Cleanup "clean" rule.
> 
> Also drop conditional install of $(BIN) and $(LIBBIN) as those two
> variables are now always populated.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Ping: [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, ) macro
  2022-08-11 16:48 ` [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
@ 2022-08-19 13:09   ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 13:09 UTC (permalink / raw)
  To: George Dunlap, Nick Rosbrook; +Cc: Wei Liu, xen-devel

Hi Nick, George,

Could you give a ack or review this patch?

Also sorry George, it seems that the use of "--remove-duplicates" with
`get_maintainer.pl` have removed your email from CC the list.

Thanks,

On Thu, Aug 11, 2022 at 05:48:30PM +0100, Anthony PERARD wrote:
> This avoid the need to open-coding the list of flags needed to link
> with an in-tree Xen library when using -lxen*.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Henry Wang <Henry.Wang@arm.com>
> ---
>  tools/golang/xenlight/Makefile | 2 +-
>  tools/Rules.mk                 | 8 ++++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/golang/xenlight/Makefile b/tools/golang/xenlight/Makefile
> index 64671f246c..00e6d17f2b 100644
> --- a/tools/golang/xenlight/Makefile
> +++ b/tools/golang/xenlight/Makefile
> @@ -27,7 +27,7 @@ GOXL_GEN_FILES = types.gen.go helpers.gen.go
>  # so that it can find the actual library.
>  .PHONY: build
>  build: xenlight.go $(GOXL_GEN_FILES)
> -	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -L$(XEN_libxenlight) -L$(XEN_libxentoollog) $(APPEND_LDFLAGS)" $(GO) build -x
> +	CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(call xenlibs-ldflags,light toollog) $(APPEND_LDFLAGS)" $(GO) build -x
>  
>  .PHONY: install
>  install: build
> diff --git a/tools/Rules.mk b/tools/Rules.mk
> index ce77dd2eb1..26958b2948 100644
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -105,6 +105,14 @@ define xenlibs-ldlibs
>      $(foreach lib,$(1),$(xenlibs-ldlibs-$(lib)))
>  endef
>  
> +# Provide needed flags for linking an in-tree Xen library by an external
> +# project (or when it is necessary to link with "-lxen$(1)" instead of using
> +# the full path to the library).
> +define xenlibs-ldflags
> +    $(call xenlibs-rpath,$(1)) \
> +    $(foreach lib,$(1),-L$(XEN_ROOT)/tools/libs/$(lib))
> +endef
> +
>  define LIB_defs
>   FILENAME_$(1) ?= xen$(1)
>   XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
> -- 
> Anthony PERARD
> 

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Ping: [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else
  2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
  2022-08-15 11:34   ` Daniel P. Smith
@ 2022-08-19 13:25   ` Anthony PERARD
  2022-08-19 14:56   ` Jan Beulich
  2 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 13:25 UTC (permalink / raw)
  To: Elena Ufimtseva, Tim Deegan, Roger Pau Monné,
	Jan Beulich, Andrew Cooper, George Dunlap
  Cc: Wei Liu, Juergen Gross, xen-devel

Hi Elena, Tim, Jan, Andrew, Roger, George,

Elena, could you give a ack or review this patch, for the change in
"tools/debugger/gdbsx/Rules.mk" ?

Tim, could you give a ack or review this patch, for the change in
"tools/debugger/kdd/Makefile" ?

Jan, Andrew, Roger, could you give a ack or review this patch, for the
change in "tools/fuzz/cpu-policy/Makefile" and
"tools/tests/cpu-policy/Makefile" ?

George, could you give a ack or review this patch, for the change in
"tools/xentrace/Makefile" ?

I would also need a review from someone on the whole patch.

Also, sorry to Jan, Andrew, and George, it seems that the use of
"--remove-duplicates" with `get_maintainer.pl` have removed your emails
from CC the list.

Thanks,


On Thu, Aug 11, 2022 at 05:48:34PM +0100, Anthony PERARD wrote:
> Patch "tools: Add -Werror by default to all tools/" have added
> "-Werror" to CFLAGS in tools/Rules.mk, remove it from every other
> makefiles as it is now duplicated.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Christian Lindig <christian.lindig@citrix.com>

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles
  2022-08-15  7:01 ` Jan Beulich
@ 2022-08-19 13:40   ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 13:40 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Nick Rosbrook, Elena Ufimtseva, Andrew Cooper,
	Roger Pau Monné,
	David Scott, George Dunlap, Juergen Gross, Julien Grall,
	Stefano Stabellini, Christian Lindig, Wei Liu, Tim Deegan,
	Daniel P. Smith, xen-devel

On Mon, Aug 15, 2022 at 09:01:12AM +0200, Jan Beulich wrote:
> I've committed a non-contiguous initial part of this series, omitting
> patches where acks still look to be missing, and hence only up to a
> point where I could be reasonably certain that the skipped patches
> won't interact with later ones. If you can indicate which further
> sufficiently reviewed/acked parts of the series are independent of
> earlier parts which aren't fully ready yet, I'd be happy to throw in
> more.

Hi Jan,

Thanks. I think the following are ready, they don't depend on
uncommitted patches:

15: tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*)
16: tools: Introduce $(xenlibs-ldlibs, ) macro
18: tools/helper: Cleanup Makefile
19: tools/console: Use $(xenlibs-ldlibs,)


Also, while "tools: Add -Werror by default to all tools/" seems ready,
it's probably better to have committed at the same time as the follow-up
"tools: Remove -Werror everywhere else".

Cheers,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else
  2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
  2022-08-15 11:34   ` Daniel P. Smith
  2022-08-19 13:25   ` Ping: " Anthony PERARD
@ 2022-08-19 14:56   ` Jan Beulich
  2022-08-19 15:18     ` Anthony PERARD
  2 siblings, 1 reply; 48+ messages in thread
From: Jan Beulich @ 2022-08-19 14:56 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Christian Lindig, Wei Liu, Elena Ufimtseva, Tim Deegan,
	Daniel P. Smith, Roger Pau Monné,
	Juergen Gross, David Scott, xen-devel

On 11.08.2022 18:48, Anthony PERARD wrote:
> Patch "tools: Add -Werror by default to all tools/" have added
> "-Werror" to CFLAGS in tools/Rules.mk, remove it from every other
> makefiles as it is now duplicated.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Christian Lindig <christian.lindig@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
for the tiny parts where it's applicable.

I'm curious:

> ---
>  tools/console/client/Makefile   | 1 -
>  tools/console/daemon/Makefile   | 1 -
>  tools/debugger/kdd/Makefile     | 1 -
>  tools/flask/utils/Makefile      | 1 -
>  tools/fuzz/cpu-policy/Makefile  | 2 +-
>  tools/misc/Makefile             | 1 -
>  tools/tests/cpu-policy/Makefile | 2 +-
>  tools/tests/depriv/Makefile     | 2 +-
>  tools/tests/resource/Makefile   | 1 -
>  tools/tests/tsx/Makefile        | 1 -
>  tools/tests/xenstore/Makefile   | 1 -
>  tools/xcutils/Makefile          | 2 --
>  tools/xenmon/Makefile           | 1 -
>  tools/xenpaging/Makefile        | 1 -
>  tools/xenpmd/Makefile           | 1 -
>  tools/xentop/Makefile           | 2 +-
>  tools/xentrace/Makefile         | 2 --
>  tools/xl/Makefile               | 2 +-
>  tools/debugger/gdbsx/Rules.mk   | 2 +-
>  tools/firmware/Rules.mk         | 2 --
>  tools/libfsimage/common.mk      | 2 +-
>  tools/libs/libs.mk              | 2 +-
>  tools/ocaml/common.make         | 2 +-
>  tools/xenstore/Makefile.common  | 1 -
>  24 files changed, 9 insertions(+), 27 deletions(-)

Normally these are sorted (as are the actual patch hunks), helping
the quick spotting of individual files of interest. Was there
anything unusual you did to prevent the (full) sorting?

Jan


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else
  2022-08-19 14:56   ` Jan Beulich
@ 2022-08-19 15:18     ` Anthony PERARD
  0 siblings, 0 replies; 48+ messages in thread
From: Anthony PERARD @ 2022-08-19 15:18 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Christian Lindig, Wei Liu, Elena Ufimtseva, Tim Deegan,
	Daniel P. Smith, Roger Pau Monné,
	Juergen Gross, David Scott, xen-devel

On Fri, Aug 19, 2022 at 04:56:05PM +0200, Jan Beulich wrote:
> On 11.08.2022 18:48, Anthony PERARD wrote:
> >  tools/console/client/Makefile   | 1 -
> >  tools/console/daemon/Makefile   | 1 -
> >  tools/debugger/kdd/Makefile     | 1 -
> >  tools/flask/utils/Makefile      | 1 -
> >  tools/fuzz/cpu-policy/Makefile  | 2 +-
> >  tools/misc/Makefile             | 1 -
> >  tools/tests/cpu-policy/Makefile | 2 +-
> >  tools/tests/depriv/Makefile     | 2 +-
> >  tools/tests/resource/Makefile   | 1 -
> >  tools/tests/tsx/Makefile        | 1 -
> >  tools/tests/xenstore/Makefile   | 1 -
> >  tools/xcutils/Makefile          | 2 --
> >  tools/xenmon/Makefile           | 1 -
> >  tools/xenpaging/Makefile        | 1 -
> >  tools/xenpmd/Makefile           | 1 -
> >  tools/xentop/Makefile           | 2 +-
> >  tools/xentrace/Makefile         | 2 --
> >  tools/xl/Makefile               | 2 +-
> >  tools/debugger/gdbsx/Rules.mk   | 2 +-
> >  tools/firmware/Rules.mk         | 2 --
> >  tools/libfsimage/common.mk      | 2 +-
> >  tools/libs/libs.mk              | 2 +-
> >  tools/ocaml/common.make         | 2 +-
> >  tools/xenstore/Makefile.common  | 1 -
> >  24 files changed, 9 insertions(+), 27 deletions(-)
> 
> Normally these are sorted (as are the actual patch hunks), helping
> the quick spotting of individual files of interest. Was there
> anything unusual you did to prevent the (full) sorting?

Yes, I'm using "git config diff.orderfile" to try to put headers first
or regroup makefile changes before anything else, mostly for myself. I
didn't though it would have an impact in `git format-patch`, as it's
often doesn't matter.

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 48+ messages in thread

* RE: [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go
  2022-08-11 16:48 ` [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
@ 2022-10-13  8:43   ` Henry Wang
  0 siblings, 0 replies; 48+ messages in thread
From: Henry Wang @ 2022-10-13  8:43 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel; +Cc: George Dunlap, Nick Rosbrook, Wei Liu

Hi Anthony,

> -----Original Message-----
> Subject: [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py
> and generation of *.gen.go
> 
> gengotypes.py creates both "types.gen.go" and "helpers.gen.go", but
> make can start gengotypes.py twice. Rework the rules so that
> gengotypes.py is executed only once.
> 
> Also, add the ability to provide a path to tell gengotypes.py where to
> put the files. This doesn't matter yet but it will when for example
> the script will be run from tools/ to generate the targets.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

IIUC this is a fix for the occasionally failure in gitlab CI, so:
Release-acked-by: Henry Wang <Henry.Wang@arm.com>

Kind regards,
Henry


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2022-10-13  8:44 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 16:48 [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 01/32] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
2022-08-19 12:57   ` Ping: " Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 02/32] tools/firmware/hvmloader: rework Makefile Anthony PERARD
2022-08-12 13:36   ` Jan Beulich
2022-08-12 14:28     ` Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 03/32] tools/fuzz/x86_instruction_emulator: rework makefile Anthony PERARD
2022-08-12 13:41   ` Jan Beulich
2022-08-11 16:48 ` [XEN PATCH v4 04/32] tools/hotplug: cleanup Makefiles Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 05/32] tools/libfsimage: Cleanup makefiles Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 06/32] tools/xenpaging: Rework makefile Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 07/32] tools/xentop: rework makefile Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 08/32] tools/xentrace: rework Makefile Anthony PERARD
2022-08-19 12:59   ` Ping: " Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 09/32] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 10/32] tools/libs/util: cleanup Makefile Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 11/32] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
2022-08-15 11:31   ` Daniel P. Smith
2022-08-11 16:48 ` [XEN PATCH v4 12/32] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 13/32] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 14/32] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 15/32] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 16/32] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 17/32] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
2022-08-19 13:09   ` Ping: " Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 18/32] tools/helper: Cleanup Makefile Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 19/32] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 20/32] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 21/32] tools: Remove -Werror everywhere else Anthony PERARD
2022-08-15 11:34   ` Daniel P. Smith
2022-08-19 13:25   ` Ping: " Anthony PERARD
2022-08-19 14:56   ` Jan Beulich
2022-08-19 15:18     ` Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 22/32] tools/hotplug: Generate "hotplugpath.sh" with configure Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 23/32] libs/light/gentypes.py: allow to generate headers in subdirectory Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 24/32] git-checkout.sh: handle running git-checkout from a different directory Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 25/32] libs: Avoid exposing -Wl,--version-script to other built library Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 26/32] libs: Fix auto-generation of version-script for unstable libs Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 27/32] tools/include: Rework Makefile Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 28/32] libs/light: Rework acpi table build targets Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 29/32] libs/light: Rework generation of include/_libxl_*.h Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 30/32] libs/light: Rework targets prerequisites Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 31/32] libs/light: Makefile cleanup Anthony PERARD
2022-08-11 16:48 ` [XEN PATCH v4 32/32] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
2022-10-13  8:43   ` Henry Wang
2022-08-12  7:53 ` [XEN PATCH v4 00/32] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig
2022-08-15  7:01 ` Jan Beulich
2022-08-19 13:40   ` Anthony PERARD

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.