Skip to contentSkip to conversation

Toolstack build system improvement, toward non-recursive makefiles

PATCH Superseded Anthony PERARD 5 participants 115 messages Dec 6, 2021 – Dec 21, 2021

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Toolstack build system improvement, toward non-recursive makefiles

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

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.

stubdom has some changes also as it won't be able to use tools/ Makefiles as-is anymore.

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 (57):
.gitignore: Non existing toolcore/include files. tools/configure.ac: Remove left over system_aio tools/Rules.mk: Remove $(CFLAGS.opic) from %.opic: %.S
libs: Remove _paths.h from libs ctrl and util.
libs: Remove -Iinclude from CFLAGS
libs/libs.mk: Remove generic variable that already exist libs/guest: Drop spurious include in Makefile
libs/light: Remove non-existing CFLAGS_libxl.o var libs/light: Remove -I.
libs/stat: Remove duplicated CFLAGS from deps
libs/store: Remove PKG_CONFIG_REMOVE
tools: remove some unneeded subdir-distclean-* targets tools/firmware/hvmloader: remove "subdirs-*" prerequisite tools/flask/utils: remove unused variables/targets from Makefile tools/libacpi: cleanup Makefile, don't check for iasl binary tools/ocaml: Remove generation of _paths.h
tools/xl: Remove unnecessary -I. from CFLAGS
tools: Use config.h from autoconf instead of "buildmakevars2header" tools/configure.ac: Create ZLIB_LIBS and ZLIB_CFLAGS tools/Rules.mk: introduce FORCE target tools/include/xen-foreign: avoid to rely on default .SUFFIXES tools/console: have one Makefile per program/directory tools/debugger: Allow make to recurse into debugger/ tools/debugger/gdbsx: Fix and cleanup makefiles tools/examples: cleanup Makefile
tools/firmware/hvmloader: rework Makefile tools/fuzz/libelf: rework makefile tools/fuzz/x86_instruction_emulator: rework makefile tools/helper: Cleanup Makefile
tools/hotplug: cleanup Makefiles
tools/libfsimage: Cleanup makefiles
tools/misc: rework Makefile
tools/vchan: Collect targets in TARGETS
tools/xcutils: rework Makefile
tools/xenpaging: Rework makefile
tools/xenstore: Cleanup makefile
tools/xentop: rework makefile
tools/xenstrace: rework Makefile
libs: Remove both "libs" and "build" target
libs: rename LDUSELIBS to LDLIBS and use it instead of APPEND_LDFLAGS
libs: Remove need for *installlocal targets libs,tools/include: Clean "clean" targets
libs: Rename $(SRCS-y) to $(OBJS-y)
libs/guest: rename ELF_OBJS to LIBELF_OBJS
libs/guest: rework CFLAGS
libs/store: use of -iquote instead of -I
libs/stat: Fix and rework python-bindings build
libs/stat: Fix and rework perl-binding build libs/toolcore: don't install xentoolcore_internal.h anymore tools/Rules.mk: Cleanup %.pc rules
.gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}
stubdom: only build libxen*.a from tools/libs/
stubdom: introduce xenlibs.mk
tools/libs: create Makefile.common to be used by stubdom build system tools/xenstore: introduce Makefile.common to be used by stubdom
stubdom: build xenstore*-stubdom using new Makefile.common
stubdom: xenlibs linkfarm, ignore non-regular files

 tools/configure.ac                           |  20 +-
 Config.mk                                    |   9 -
 stubdom/xenlibs.mk                           |  13 ++
 tools/Rules.mk                               |   9 +-
 tools/libfsimage/Rules.mk                    |  26 +--
 tools/libfsimage/common.mk                   |  11 +
 tools/libs/libs.mk                           |  36 +--
 .gitignore                                   |  44 +---
 config/Tools.mk.in                           |   3 +-
 configure                                    |  45 ++++
 docs/configure                               |  45 ++++
 m4/paths.m4                                  |   9 +
 stubdom/Makefile                             |  26 ++-
 tools/Makefile                               |  32 +--
 tools/config.h.in                            |  27 +++
 tools/configure                              |  67 +++++-
 tools/console/Makefile                       |  57 +----
 tools/console/client/Makefile                |  39 ++++
 tools/console/client/main.c                  |   1 -
 tools/console/daemon/Makefile                |  50 +++++
 tools/console/daemon/main.c                  |   1 -
 tools/debugger/Makefile                      |   8 +
 tools/debugger/gdbsx/Makefile                |  20 +-
 tools/debugger/gdbsx/gx/Makefile             |  15 +-
 tools/debugger/gdbsx/xg/Makefile             |  25 +--
 tools/examples/Makefile                      |  21 +-
 tools/firmware/Makefile                      |   3 -
 tools/firmware/hvmloader/Makefile            |  18 +-
 tools/flask/utils/Makefile                   |  16 +-
 tools/fuzz/libelf/Makefile                   |  21 +-
 tools/fuzz/x86_instruction_emulator/Makefile |  32 ++-
 tools/helpers/Makefile                       |  31 +--
 tools/helpers/init-xenstore-domain.c         |   1 -
 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 +-
 tools/include/Makefile                       |   1 +
 tools/include/xen-foreign/Makefile           |   9 +-
 tools/libacpi/Makefile                       |  17 +-
 tools/libacpi/README                         |   6 -
 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                     |   7 +-
 tools/libs/call/Makefile.common              |   6 +
 tools/libs/ctrl/Makefile                     |  55 +----
 tools/libs/ctrl/Makefile.common              |  44 ++++
 tools/libs/ctrl/xc_private.h                 |   2 -
 tools/libs/devicemodel/Makefile              |   7 +-
 tools/libs/devicemodel/Makefile.common       |   6 +
 tools/libs/evtchn/Makefile                   |   7 +-
 tools/libs/evtchn/Makefile.common            |   6 +
 tools/libs/foreignmemory/Makefile            |   7 +-
 tools/libs/foreignmemory/Makefile.common     |   6 +
 tools/libs/gnttab/Makefile                   |   9 +-
 tools/libs/gnttab/Makefile.common            |   8 +
 tools/libs/guest/Makefile                    | 109 +--------
 tools/libs/guest/Makefile.common             |  84 +++++++
 tools/libs/guest/xg_dom_core.c               |   1 -
 tools/libs/guest/xg_offline_page.c           |   2 +-
 tools/libs/hypfs/Makefile                    |   4 +-
 tools/libs/light/Makefile                    | 222 +++++++++----------
 tools/libs/light/libxl_dom.c                 |   2 -
 tools/libs/light/libxl_internal.h            |   1 -
 tools/libs/light/libxl_utils.c               |   1 -
 tools/libs/stat/Makefile                     |  70 +++---
 tools/libs/stat/bindings/swig/perl/.empty    |   1 -
 tools/libs/stat/bindings/swig/python/.empty  |   1 -
 tools/libs/stat/xenstat_qmp.c                |   1 -
 tools/libs/store/Makefile                    |  20 +-
 tools/libs/toolcore/Makefile                 |  10 +-
 tools/libs/toolcore/Makefile.common          |   9 +
 tools/libs/toollog/Makefile                  |   3 +-
 tools/libs/toollog/Makefile.common           |   2 +
 tools/libs/util/Makefile                     |  27 +--
 tools/libs/vchan/Makefile                    |   9 +-
 tools/misc/Makefile                          |  16 +-
 tools/ocaml/xenstored/Makefile               |   7 -
 tools/ocaml/xenstored/systemd_stubs.c        |   2 -
 tools/vchan/Makefile                         |   6 +-
 tools/xcutils/Makefile                       |  15 +-
 tools/xenpaging/Makefile                     |  24 +-
 tools/xenstore/Makefile                      |  83 +++----
 tools/xenstore/Makefile.common               |  34 +++
 tools/xentop/Makefile                        |  19 +-
 tools/xentrace/Makefile                      |  11 +-
 tools/xl/Makefile                            |   9 +-
 tools/xl/xl.h                                |   1 -
 96 files changed, 953 insertions(+), 990 deletions(-)
 create mode 100644 stubdom/xenlibs.mk
 create mode 100644 tools/libfsimage/common.mk
 create mode 100644 tools/console/client/Makefile
 create mode 100644 tools/console/daemon/Makefile
 create mode 100644 tools/debugger/Makefile
 create mode 100644 tools/libs/call/Makefile.common
 create mode 100644 tools/libs/ctrl/Makefile.common
 create mode 100644 tools/libs/devicemodel/Makefile.common
 create mode 100644 tools/libs/evtchn/Makefile.common
 create mode 100644 tools/libs/foreignmemory/Makefile.common
 create mode 100644 tools/libs/gnttab/Makefile.common
 create mode 100644 tools/libs/guest/Makefile.common
 delete mode 100644 tools/libs/stat/bindings/swig/perl/.empty
 delete mode 100644 tools/libs/stat/bindings/swig/python/.empty
 create mode 100644 tools/libs/toolcore/Makefile.common
 create mode 100644 tools/libs/toollog/Makefile.common
 create mode 100644 tools/xenstore/Makefile.common
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH 1/57 .gitignore: Non existing toolcore/include files.

4664034cdc (tools/libs: move official headers to common directory) forgot one .gitignore update.

---
 .gitignore | 1 -
 1 file changed, 1 deletion(-)
.gitignore +0 -1
index 9513506dd9..cad5aacd8d 100644
@@ -384,7 +384,6 @@ tools/include/xen-foreign/arm64.h
 .git
 tools/misc/xen-hptool
 tools/misc/xen-mfndump
-tools/libs/toolcore/include/_*.h
 tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
 tools/misc/xenhypfs
Signature · 1 line
Anthony PERARD
#2 lore raw

PATCH 2/57 tools/configure.ac: Remove left over system_aio

In reply to Anthony PERARD

system_aio isn't set since 3d4678108a (tools: remove in tree libaio).

---
 tools/configure.ac | 1 -
 tools/configure    | 2 --
 2 files changed, 3 deletions(-)
tools/configure.ac +0 -1
index 3ac62626a5..5a4fb9022d 100644
@@ -402,7 +402,6 @@ AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
 PKG_CHECK_MODULES([libzstd], [libzstd],
     [zlib="$zlib -DHAVE_ZSTD $libzstd_CFLAGS $libzstd_LIBS"], [true])
 AC_SUBST(zlib)
-AC_SUBST(system_aio)
 AX_CHECK_EXTFS
 AX_CHECK_PTHREAD
 AX_CHECK_PTYFUNCS
tools/configure +0 -2
index 21e3a83795..8e4a59c2cb 100755
@@ -641,7 +641,6 @@ PTHREAD_LIBS
 PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 EXTFS_LIBS
-system_aio
 zlib
 libzstd_LIBS
 libzstd_CFLAGS
@@ -8772,7 +8771,6 @@ $as_echo "yes" >&6; }
 fi
 
 
-
 ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
 if test "x$ac_cv_header_ext2fs_ext2fs_h" = xyes; then :
 
Signature · 1 line
Anthony PERARD
#3 lore raw

PATCH 3/57 tools/Rules.mk: Remove $(CFLAGS.opic) from %.opic: %.S

In reply to Anthony PERARD

$(CFLAGS.opic) isn't set anywere, never was, just remove it.

---
 tools/Rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/Rules.mk +1 -1
index b022da3336..4e9b4ee17f 100644
@@ -155,7 +155,7 @@ INSTALL_PYTHON_PROG = \
 %.o: %.S
 	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(APPEND_CFLAGS)
 %.opic: %.S
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
 
 subdirs-all subdirs-clean subdirs-install subdirs-distclean subdirs-uninstall: .phony
 	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
Signature · 1 line
Anthony PERARD
#4 lore raw

PATCH 4/57 libs: Remove _paths.h from libs ctrl and util.

In reply to Anthony PERARD

libxenutil doesn't include _paths.h so no need to generate it.

libxenctrl doesn't use macros from _paths.h so can be removed. Fix libxenguest to include _paths.h properly instead of relying on xc_private.h

---
 .gitignore                    | 2 --
 tools/libs/ctrl/Makefile      | 5 -----
 tools/libs/ctrl/xc_private.h  | 2 --
 tools/libs/guest/Makefile     | 2 +-
 tools/libs/guest/xg_suspend.c | 1 +
 tools/libs/util/Makefile      | 6 +-----
 6 files changed, 3 insertions(+), 15 deletions(-)
.gitignore +0 -2
index cad5aacd8d..111eb03b86 100644
@@ -117,7 +117,6 @@ tools/libs/hypfs/headers.chk
 tools/libs/hypfs/xenhypfs.pc
 tools/libs/call/headers.chk
 tools/libs/call/xencall.pc
-tools/libs/ctrl/_*.[ch]
 tools/libs/ctrl/libxenctrl.map
 tools/libs/ctrl/xencontrol.pc
 tools/libs/foreignmemory/headers.chk
@@ -157,7 +156,6 @@ tools/libs/store/utils.h
 tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
 tools/libs/util/*.pc
-tools/libs/util/_paths.h
 tools/libs/util/libxlu_cfg_y.output
 tools/libs/util/libxenutil.map
 tools/libs/vchan/headers.chk
tools/libs/ctrl/Makefile +0 -5
index 519246b0d6..5d866b8d04 100644
@@ -54,11 +54,6 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
-$(LIB_OBJS) $(PIC_OBJS): _paths.h
-
 -include $(DEPS_INCLUDE)
 
 clean: cleanlocal
tools/libs/ctrl/xc_private.h +0 -2
index 2e483590e6..824d3cfc21 100644
@@ -29,8 +29,6 @@
 #include <limits.h>
 #include <sys/ioctl.h>
 
-#include "_paths.h"
-
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #define XC_INTERNAL_COMPAT_MAP_FOREIGN_API
 #include "xenctrl.h"
tools/libs/guest/Makefile +1 -1
index 2ce92d247e..b49e5059f2 100644
@@ -111,7 +111,7 @@ libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
 genpath-target = $(call buildmakevars2header,_paths.h)
 $(eval $(genpath-target))
 
-xc_private.h: _paths.h
+$(LIB_OBJS) $(PIC_OBJS): _paths.h
 
 -include $(DEPS_INCLUDE)
 
tools/libs/guest/xg_suspend.c +1 -0
index 0ce6364963..128353029c 100644
@@ -19,6 +19,7 @@
 #include <xenevtchn.h>
 
 #include "xc_private.h"
+#include "_paths.h"
 #include "xenguest.h"
 
 #define SUSPEND_LOCK_FILE    XEN_RUN_DIR "/suspend-evtchn-%d.lock"
tools/libs/util/Makefile +1 -5
index f5f9e89fee..87425d862a 100644
@@ -39,7 +39,7 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS) _paths.h
+$(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS)
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
@@ -49,14 +49,10 @@ $(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS) _paths.h
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
 
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
 -include $(DEPS_INCLUDE)
 
 clean: cleanlocal
 
 .PHONY: cleanlocal
 cleanlocal:
-	$(RM) -f _*.h
 	$(RM) -f libxlutil.map
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 4/57
#5 lore raw

Re: [XEN PATCH 04/57] libs: Remove _paths.h from libs ctrl and util.

Quoted 7 lines · Anthony PERARD

libxenutil doesn't include _paths.h so no need to generate it.

libxenctrl doesn't use macros from _paths.h so can be removed. Fix libxenguest to include _paths.h properly instead of relying on xc_private.h

Juergen

#6 lore raw

PATCH 5/57 libs: Remove -Iinclude from CFLAGS

In reply to Anthony PERARD

They are no more directory libs/*/include.

---
 tools/libs/libs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/libs.mk +1 -1
index ebdb2a4782..830bdc851f 100644
@@ -12,7 +12,7 @@ MINOR ?= 0
 SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
 
 CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
+CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
 LDUSELIBS = $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
Signature · 1 line
Anthony PERARD
#8 lore raw

PATCH 6/57 libs/libs.mk: Remove generic variable that already exist

In reply to Anthony PERARD

comma, empty, space are already defined in "Config.mk".

---
 tools/libs/libs.mk | 3 ---
 1 file changed, 3 deletions(-)
tools/libs/libs.mk +0 -3
index 830bdc851f..dfbbef4080 100644
@@ -26,9 +26,6 @@ ifneq ($(nosharedlibs),y)
 LIB += lib$(LIB_FILE_NAME).so
 endif
 
-comma:= ,
-empty:=
-space:= $(empty) $(empty)
 PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
Signature · 1 line
Anthony PERARD
#10 lore raw

PATCH 7/57 libs/guest: Drop spurious include in Makefile

In reply to Anthony PERARD

This include hasn't been useful since e567964a54 (tools: drop ia64 support).

---
 tools/libs/guest/Makefile | 2 --
 1 file changed, 2 deletions(-)
tools/libs/guest/Makefile +0 -2
index b49e5059f2..c6d882e239 100644
@@ -71,8 +71,6 @@ SRCS-y                 += xg_dom_decompress_unsafe_xz.c
 SRCS-y                 += xg_dom_decompress_unsafe_zstd.c
 endif
 
--include $(XEN_TARGET_ARCH)/Makefile
-
 CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += -I. -I./include $(CFLAGS_xeninclude)
 CFLAGS   += -D__XEN_TOOLS__
Signature · 1 line
Anthony PERARD
#12 lore raw

PATCH 8/57 libs/light: Remove non-existing CFLAGS_libxl.o var

In reply to Anthony PERARD

This var was originally $(CFLAGS_$*.o), and probably was copied from the generic %.o:%.c rules.

Nothing sets CFLAGS_libxl.o, so remove it.

---
 tools/libs/light/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/light/Makefile +1 -1
index 194bc5f268..975413ade8 100644
@@ -200,7 +200,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	touch $@
 
 _libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_libxl.o) -c -E $< $(APPEND_CFLAGS) \
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]
 	mv -f [email protected] $@
Signature · 1 line
Anthony PERARD
#14 lore raw

PATCH 9/57 libs/light: Remove -I.

In reply to Anthony PERARD

There is no need to include current directory.

---
 tools/libs/light/Makefile | 1 -
 1 file changed, 1 deletion(-)
tools/libs/light/Makefile +0 -1
index 975413ade8..bfd58226ce 100644
@@ -44,7 +44,6 @@ SRCS-$(CONFIG_X86) += $(ACPI_OBJS:.o=.c)
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
-CFLAGS += -I.
 
 CFLAGS-$(CONFIG_X86) += -DCONFIG_PCI_SUPP_LEGACY_IRQ
 
Signature · 1 line
Anthony PERARD
#16 lore raw

PATCH 10/57 libs/stat: Remove duplicated CFLAGS from deps

In reply to Anthony PERARD

Those CFLAGS_* are already added in libs.mk via USELIBS_stat.

---
 tools/libs/stat/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/stat/Makefile +1 -1
index c99508ae6b..911a2de8ec 100644
@@ -15,7 +15,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
+CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
 SRCS-y += xenstat.c
 SRCS-y += xenstat_qmp.c
Signature · 1 line
Anthony PERARD
#18 lore raw

PATCH 11/57 libs/store: Remove PKG_CONFIG_REMOVE

In reply to Anthony PERARD

PKG_CONFIG_REMOVE doesn't do anything anymore. Commit dd33fd2e81 (tools: split libxenstore into new tools/libs/store directory) had reintroduced it without saying why.

---
 tools/libs/store/Makefile | 2 --
 1 file changed, 2 deletions(-)
tools/libs/store/Makefile +0 -2
index 43b018aa8c..c208dbb48a 100644
@@ -27,8 +27,6 @@ CFLAGS += -I $(XEN_ROOT)/tools/xenstore
 xs.opic: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
 xs.opic: CFLAGS += -DUSE_DLSYM
-else
-PKG_CONFIG_REMOVE += -ldl
 endif
 
 -include $(DEPS_INCLUDE)
Signature · 1 line
Anthony PERARD
#20 lore raw

PATCH 12/57 tools: remove some unneeded subdir-distclean-* targets

In reply to Anthony PERARD

Those two are already covered by subdir-distclean-% target in Rules.mk.

---
 tools/Makefile          | 3 ---
 tools/firmware/Makefile | 3 ---
 2 files changed, 6 deletions(-)
tools/Makefile +0 -3
index 757a560be0..8936b754c8 100644
@@ -296,9 +296,6 @@ subdir-uninstall-debugger/kdd: .phony
 subdir-all-debugger/kdd: .phony
 	$(MAKE) -C debugger/kdd all
 
-subdir-distclean-firmware: .phony
-	$(MAKE) -C firmware distclean
-
 subtree-force-update:
 ifeq ($(CONFIG_QEMU_XEN),y)
 	$(MAKE) qemu-xen-dir-force-update
tools/firmware/Makefile +0 -3
index 1f27117794..345037b93b 100644
@@ -85,9 +85,6 @@ clean: subdirs-clean
 .PHONY: distclean
 distclean: subdirs-distclean
 
-subdir-distclean-etherboot: .phony
-	$(MAKE) -C etherboot distclean
-
 subdir-distclean-ovmf-dir: .phony
 	rm -rf ovmf-dir ovmf-dir-remote
 
Signature · 1 line
Anthony PERARD
#21 lore raw

PATCH 13/57 tools/firmware/hvmloader: remove "subdirs-*" prerequisite

In reply to Anthony PERARD

hvmloader's last subdir have been removed in 73b72736e6 ("acpi: Move ACPI code to tools/libacpi"), so there is no need to use "subdirs-*" target anymore.

---
 tools/firmware/hvmloader/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/firmware/hvmloader/Makefile +2 -2
index e980ce7c5f..b754220839 100644
@@ -60,7 +60,7 @@ ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
 .PHONY: all
-all: acpi subdirs-all
+all: acpi
 	$(MAKE) hvmloader
 
 .PHONY: acpi
@@ -104,7 +104,7 @@ endif
 	mv [email protected] $@
 
 .PHONY: clean
-clean: subdirs-clean
+clean:
 	rm -f roms.inc roms.inc.new acpi.h
 	rm -f hvmloader hvmloader.tmp *.o $(DEPS_RM)
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) clean
Signature · 1 line
Anthony PERARD
#22 lore raw

PATCH 14/57 tools/flask/utils: remove unused variables/targets from Makefile

In reply to Anthony PERARD

They are no *.opic or *.so in this subdir, so no need to clean them.

The TEST* variables doesn't seems to be used anywhere, and they weren't used by xen.git when introduced.
Both CLIENTS_* variables aren't used.
Both target "print-dir" and "print-end" only exist in this directory and are probably not used anywhere.

---
 tools/flask/utils/Makefile | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
tools/flask/utils/Makefile +1 -15
index ae87102144..5449f05b13 100644
@@ -4,13 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenctrl)
 
-TESTDIR  = testsuite/tmp
-TESTFLAGS= -DTESTING
-TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
-
 CLIENTS := flask-loadpolicy flask-setenforce flask-getenforce flask-label-pci flask-get-bool flask-set-bool
-CLIENTS_SRCS := $(patsubst flask-%,%.c,$(CLIENTS))
-CLIENTS_OBJS := $(patsubst flask-%,%.o,$(CLIENTS))
 
 .PHONY: all
 all: $(CLIENTS)
@@ -35,21 +29,13 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean: 
-	rm -f *.o *.opic *.so
+	rm -f *.o
 	rm -f $(CLIENTS)
 	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
 
-.PHONY: print-dir
-print-dir:
-	@echo -n tools/flask/utils: 
-
-.PHONY: print-end
-print-end:
-	@echo
-
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 14/57
#23 lore raw

Re: [XEN PATCH 14/57] tools/flask/utils: remove unused variables/targets from Makefile

Quoted 10 lines · Anthony PERARD

They are no *.opic or *.so in this subdir, so no need to clean them.

The TEST* variables doesn't seems to be used anywhere, and they weren't used by xen.git when introduced.
Both CLIENTS_* variables aren't used.
Both target "print-dir" and "print-end" only exist in this directory and are probably not used anywhere.

---

#24 lore raw

Re: [XEN PATCH 14/57] tools/flask/utils: remove unused variables/targets from Makefile

In reply to Anthony PERARD

tools/flask/utils/Makefile flask-set-bool: set-bool.o · line 34

Quoted 8 lines · Anthony PERARD
tools/flask/utils/Makefile +1 -1
@@ -35,21 +29,13 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean: 
-	rm -f *.o *.opic *.so
+	rm -f *.o
 	rm -f $(CLIENTS)
 	$(RM) $(DEPS_RM)

Can we collapse this to $(RM) *.o $(CLIENTS) $(DEPS_RM) ?

Here and in plenty of subsequent patches, there's manipulation of raw rm -f's which ought to be cleaned up to $(RM)

I can fix this on commit if you're happy.

~Andrew

#25 lore raw

Re: [XEN PATCH 14/57] tools/flask/utils: remove unused variables/targets from Makefile

Quoted 12 lines · Andrew Cooper

tools/flask/utils/Makefile flask-set-bool: set-bool.o · line 34

Quoted 8 lines · Anthony PERARD
tools/flask/utils/Makefile +1 -1
@@ -35,21 +29,13 @@ flask-set-bool: set-bool.o
 
 .PHONY: clean
 clean: 
-	rm -f *.o *.opic *.so
+	rm -f *.o
 	rm -f $(CLIENTS)
 	$(RM) $(DEPS_RM)

Here and in plenty of subsequent patches, there's manipulation of raw rm -f's which ought to be cleaned up to $(RM)

About using $(RM) or rm -f, I don't think we need to care if one or the other is used in Makefiles, they needs to be equivalent or things are going to fails. GNU make manual says that rm should exist, especially when things like autoconf are used. For example our ./configure scrips is using rm -f and I don't think we can configure that. So having RM configurable doesn't really serve any purpose.

Beyond that, using $(RM) is good in order to be consistent, and changing "rm -f" to "$(RM)" is fine, I might not doing it myself or ask for it.

Quoted 1 line

I can fix this on commit if you're happy.

For the avoidance of doubt, yes, I'm happy with the patch that have been committed.

Thanks,

Signature · 1 line
Anthony PERARD
#26 lore raw

PATCH 15/57 tools/libacpi: cleanup Makefile, don't check for iasl binary

In reply to Anthony PERARD

iasl is been check for presence by ./configure, so this Makefile doesn't have to do it. Also start to use $(IASL) that ./configure generate.

iasl hasn't been download by our build system for a while and the dependency on iasl is in the main xen.git README.

Make use of $< in one rule instead of spelling the %.asl file again.

---
 tools/libacpi/Makefile | 17 ++++-------------
 tools/libacpi/README   |  6 ------
 2 files changed, 4 insertions(+), 19 deletions(-)
tools/libacpi/Makefile +4 -13
index 2448687dbb..60860eaa00 100644
@@ -38,11 +38,10 @@ MKDSDT_CFLAGS-$(CONFIG_X86) = -DCONFIG_X86
 # complete $(ACPI_BUILD_DIR) as path, even if it has '.' symbols.
 TMP_SUFFIX	= tmp
 
-vpath iasl $(PATH)
 all: $(C_SRC) $(H_SRC)
 
-$(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
-	iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
+$(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl
+	$(IASL) -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
 	sed -e 's/AmlCode/$*/g' -e 's/_aml_code//g' $(ACPI_BUILD_DIR)/$*.hex >$@
 	rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
  
@@ -74,21 +73,13 @@ $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
 	$(MK_DSDT) --debug=$(debug) >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
 
-$(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl
-	iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $(ACPI_BUILD_DIR)/$*.asl
+$(C_SRC): $(ACPI_BUILD_DIR)/%.c: $(ACPI_BUILD_DIR)/%.asl
+	$(IASL) -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
 	sed -e 's/AmlCode/$*/g' -e 's/_aml_code//g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX)
 	echo "int $*_len=sizeof($*);" >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
 	rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
 
-iasl:
-	@echo
-	@echo "ACPI ASL compiler (iasl) is needed"
-	@echo "Download and install Intel ACPI CA from"
-	@echo "http://acpica.org/downloads/"
-	@echo 
-	@exit 1
-
 clean:
 	rm -f $(C_SRC) $(H_SRC) $(MK_DSDT) $(C_SRC:=.$(TMP_SUFFIX))
 	rm -f $(patsubst %.c,%.hex,$(C_SRC)) $(patsubst %.c,%.aml,$(C_SRC)) $(patsubst %.c,%.asl,$(C_SRC))
tools/libacpi/README +0 -6
index 2b9d6e188c..4ab5ed2de7 100644
@@ -24,9 +24,3 @@ In case that the acpi_dsdt.asl need to be updated, please
 Follow the instruction:
 
 # make acpi_dsdt.c
-
-Note:
-DSDT compiler "iasl" is needed. By default, it will be downloaded 
-using wget in Makefile. if it failed, please download manually from 
-http://developer.intel.com/technology/iapc/acpi/downloads.htm. 
-then compile and install iasl
Signature · 1 line
Anthony PERARD
Acked-by on v1 15/57
#27 lore raw

Re: [XEN PATCH 15/57] tools/libacpi: cleanup Makefile, don't check for iasl binary

Quoted 10 lines · Anthony PERARD

iasl is been check for presence by ./configure, so this Makefile doesn't have to do it. Also start to use $(IASL) that ./configure generate.

iasl hasn't been download by our build system for a while and the dependency on iasl is in the main xen.git README.

Make use of $< in one rule instead of spelling the %.asl file again.

#28 lore raw

PATCH 16/57 tools/ocaml: Remove generation of _paths.h

In reply to Anthony PERARD

_paths.h isn't useful anymore in systemd_stubs.

---
 .gitignore                            | 1 -
 tools/ocaml/xenstored/Makefile        | 7 -------
 tools/ocaml/xenstored/systemd_stubs.c | 2 --
 3 files changed, 10 deletions(-)
.gitignore +0 -1
index 111eb03b86..b42264e209 100644
@@ -409,7 +409,6 @@ tools/ocaml/libs/xentoollog/xentoollog.ml
 tools/ocaml/libs/xentoollog/xentoollog.mli
 tools/ocaml/libs/xs/paths.ml
 tools/ocaml/libs/xc/xenctrl_abi_check.h
-tools/ocaml/xenstored/_paths.h
 tools/ocaml/xenstored/oxenstored
 tools/ocaml/xenstored/oxenstored.conf
 tools/ocaml/xenstored/paths.ml
tools/ocaml/xenstored/Makefile +0 -7
index 89ec3ec76a..0b5711b507 100644
@@ -30,8 +30,6 @@ systemd_OBJS = systemd
 systemd_C_OBJS = systemd_stubs
 OCAML_LIBRARY += systemd
 
-$(foreach obj,$(systemd_C_OBJS),$(obj).o): _paths.h
-
 LIBS_systemd += $(LDFLAGS-y)
 
 OBJS = paths \
@@ -100,8 +98,3 @@ genpath-target = $(call buildmakevars2module,paths.ml)
 $(eval $(genpath-target))
 
 GENERATED_FILES += paths.ml
-
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
-GENERATE_FILES += _paths.h
tools/ocaml/xenstored/systemd_stubs.c +0 -2
index 31a1a5d384..f4c875075a 100644
@@ -27,8 +27,6 @@
 
 #include <systemd/sd-daemon.h>
 
-#include "_paths.h"
-
 CAMLprim value ocaml_sd_notify_ready(value ignore)
 {
 	CAMLparam1(ignore);
Signature · 1 line
Anthony PERARD
#29 lore raw

Re: [XEN PATCH 16/57] tools/ocaml: Remove generation of _paths.h

Quoted 3 lines · Anthony PERARD

_paths.h isn't useful anymore in systemd_stubs.

I poked Christian, who's looked at this and given it an ack.  For some reason, he doesn't appear to have this email in his inbox.

~Andrew

#30 lore raw

PATCH 17/57 tools/xl: Remove unnecessary -I. from CFLAGS

In reply to Anthony PERARD

GCC will search the directory where the source file is for quote-includes.

---
 tools/xl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xl/Makefile +1 -1
index 656b21c7da..2e129f00e1 100644
@@ -7,7 +7,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
-CFLAGS += -I. -fPIC
+CFLAGS += -fPIC
 
 CFLAGS += $(PTHREAD_CFLAGS)
 LDFLAGS += $(PTHREAD_LDFLAGS)
Signature · 1 line
Anthony PERARD
#31 lore raw

PATCH 18/57 tools: Use config.h from autoconf instead of "buildmakevars2header"

In reply to Anthony PERARD

This avoid the need to generate the _paths.h header when the information is from autoconf anyway.

They are no more users of the "buildmakevars2header" macro, so it can be removed from "Config.mk".

Also removed the extra "-f" flag where "$(RM)" is used (xl/Makefile).

---
 Config.mk                            |  9 ------
 tools/libs/libs.mk                   |  1 -
 .gitignore                           |  6 ----
 configure                            | 45 ++++++++++++++++++++++++++++
 docs/configure                       | 45 ++++++++++++++++++++++++++++
 m4/paths.m4                          |  9 ++++++
 tools/config.h.in                    | 27 +++++++++++++++++
 tools/configure                      | 45 ++++++++++++++++++++++++++++
 tools/console/Makefile               | 12 ++------
 tools/console/client/main.c          |  1 -
 tools/console/daemon/main.c          |  1 -
 tools/helpers/Makefile               |  8 ++---
 tools/helpers/init-xenstore-domain.c |  1 -
 tools/libs/guest/Makefile            |  5 ----
 tools/libs/guest/xg_dom_core.c       |  1 -
 tools/libs/guest/xg_suspend.c        |  1 -
 tools/libs/light/Makefile            |  8 ++---
 tools/libs/light/libxl_dom.c         |  2 --
 tools/libs/light/libxl_internal.h    |  1 -
 tools/libs/light/libxl_utils.c       |  1 -
 tools/libs/stat/Makefile             |  7 +----
 tools/libs/stat/xenstat_qmp.c        |  1 -
 tools/xl/Makefile                    |  7 +----
 tools/xl/xl.h                        |  1 -
 24 files changed, 179 insertions(+), 66 deletions(-)
Config.mk +0 -9
index 6587c7d626..1c1998a5a8 100644
@@ -167,15 +167,6 @@ define buildmakevars2file-closure
 	$(call move-if-changed,$(1).tmp,$(1))
 endef
 
-buildmakevars2header = $(eval $(call buildmakevars2header-closure,$(1)))
-define buildmakevars2header-closure
-    $(1): .phony
-	rm -f $(1).tmp; \
-	$(foreach var, $(BUILD_MAKE_VARS), \
-	          echo "#define $(var) \"$($(var))\"" >>$(1).tmp;) \
-	$(call move-if-changed,$(1).tmp,$(1))
-endef
-
 CFLAGS += -fno-strict-aliasing
 
 CFLAGS += -std=gnu99
tools/libs/libs.mk +0 -1
index dfbbef4080..5c2f16dda4 100644
@@ -132,7 +132,6 @@ clean:
 	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)
-	rm -f _paths.h
 
 .PHONY: distclean
 distclean: clean
.gitignore +0 -6
index b42264e209..b39b996718 100644
@@ -123,7 +123,6 @@ tools/libs/foreignmemory/headers.chk
 tools/libs/foreignmemory/xenforeignmemory.pc
 tools/libs/devicemodel/headers.chk
 tools/libs/devicemodel/xendevicemodel.pc
-tools/libs/guest/_*.[ch]
 tools/libs/guest/libxenguest.map
 tools/libs/guest/xenguest.pc
 tools/libs/guest/xc_bitops.h
@@ -146,7 +145,6 @@ tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
 tools/libs/light/xenlight.pc
-tools/libs/stat/_paths.h
 tools/libs/stat/headers.chk
 tools/libs/stat/libxenstat.map
 tools/libs/stat/xenstat.pc
@@ -163,8 +161,6 @@ tools/libs/vchan/libxenvchan.map
 tools/libs/vchan/xenvchan.pc
 tools/console/xenconsole
 tools/console/xenconsoled
-tools/console/client/_paths.h
-tools/console/daemon/_paths.h
 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
@@ -207,7 +203,6 @@ 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/_paths.h
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
@@ -422,7 +417,6 @@ tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
 tools/python/xen/lowlevel/xl/_pyxl_types.c
 tools/python/xen/lowlevel/xl/_pyxl_types.h
-tools/xl/_paths.h
 tools/xl/xl
 
 docs/txt/misc/*.txt
configure +45 -0

93 lines not on this page · raw message

docs/configure +45 -0

93 lines not on this page · raw message

m4/paths.m4 +9 -0
index 7be314a3e2..826faada45 100644
@@ -39,6 +39,7 @@ AC_SUBST(CONFIG_DIR)
 
 XEN_CONFIG_DIR=$CONFIG_DIR/xen
 AC_SUBST(XEN_CONFIG_DIR)
+AC_DEFINE_UNQUOTED([XEN_CONFIG_DIR], ["$XEN_CONFIG_DIR"], [Xen's config dir])
 
 AC_ARG_WITH([initddir],
     AS_HELP_STRING([--with-initddir=DIR],
@@ -83,6 +84,7 @@ AC_ARG_WITH([xen-scriptdir],
     [xen_scriptdir_path=$XEN_CONFIG_DIR/scripts])
 XEN_SCRIPT_DIR=$xen_scriptdir_path
 AC_SUBST(XEN_SCRIPT_DIR)
+AC_DEFINE_UNQUOTED([XEN_SCRIPT_DIR], ["$XEN_SCRIPT_DIR"], [Xen's script dir])
 
 AC_ARG_WITH([xen-dumpdir],
     AS_HELP_STRING([--with-xen-dumpdir=DIR],
@@ -117,18 +119,22 @@ AC_SUBST(LIBEXEC)
 dnl These variables will be substituted in various .in files
 LIBEXEC_BIN=${LIBEXEC}/bin
 AC_SUBST(LIBEXEC_BIN)
+AC_DEFINE_UNQUOTED([LIBEXEC_BIN], ["$LIBEXEC_BIN"], [Xen's libexec path])
 LIBEXEC_LIB=${LIBEXEC}/lib
 AC_SUBST(LIBEXEC_LIB)
 LIBEXEC_INC=${LIBEXEC}/include
 AC_SUBST(LIBEXEC_INC)
 XENFIRMWAREDIR=${LIBEXEC}/boot
 AC_SUBST(XENFIRMWAREDIR)
+AC_DEFINE_UNQUOTED([XENFIRMWAREDIR], ["$XENFIRMWAREDIR"], [Xen's firmware dir])
 
 XEN_RUN_DIR=$rundir_path/xen
 AC_SUBST(XEN_RUN_DIR)
+AC_DEFINE_UNQUOTED([XEN_RUN_DIR], ["$XEN_RUN_DIR"], [Xen's runstate path])
 
 XEN_LOG_DIR=$localstatedir/log/xen
 AC_SUBST(XEN_LOG_DIR)
+AC_DEFINE_UNQUOTED([XEN_LOG_DIR], ["$XEN_LOG_DIR"], [Xen's log dir])
 
 XEN_LIB_STORED=$localstatedir/lib/xenstored
 AC_SUBST(XEN_LIB_STORED)
@@ -138,6 +144,7 @@ AC_SUBST(XEN_RUN_STORED)
 
 XEN_LIB_DIR=$localstatedir/lib/xen
 AC_SUBST(XEN_LIB_DIR)
+AC_DEFINE_UNQUOTED([XEN_LIB_DIR], ["$XEN_LIB_DIR"], [Xen's lib dir])
 
 SHAREDIR=$prefix/share
 AC_SUBST(SHAREDIR)
@@ -151,12 +158,14 @@ case "$host_os" in
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 AC_SUBST(XEN_LOCK_DIR)
+AC_DEFINE_UNQUOTED([XEN_LOCK_DIR], ["$XEN_LOCK_DIR"], [Xen's lock dir])
 
 XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
 
 XEN_DUMP_DIR=$xen_dumpdir_path
 AC_SUBST(XEN_DUMP_DIR)
+AC_DEFINE_UNQUOTED([XEN_DUMP_DIR], ["$XEN_DUMP_DIR"], [Xen's dump directory])
 
 DEBUG_DIR=$debugdir_path
 AC_SUBST(DEBUG_DIR)
tools/config.h.in +27 -0
index 52e01b2c84..9563d3acb6 100644
@@ -96,6 +96,9 @@
 /* IPXE path */
 #undef IPXE_PATH
 
+/* Xen's libexec path */
+#undef LIBEXEC_BIN
+
 /* OVMF path */
 #undef OVMF_PATH
 
@@ -129,6 +132,30 @@
 /* QMP proxy path */
 #undef STUBDOM_QMP_PROXY_PATH
 
+/* Xen's firmware dir */
+#undef XENFIRMWAREDIR
+
+/* Xen's config dir */
+#undef XEN_CONFIG_DIR
+
+/* Xen's dump directory */
+#undef XEN_DUMP_DIR
+
+/* Xen's lib dir */
+#undef XEN_LIB_DIR
+
+/* Xen's lock dir */
+#undef XEN_LOCK_DIR
+
+/* Xen's log dir */
+#undef XEN_LOG_DIR
+
+/* Xen's runstate path */
+#undef XEN_RUN_DIR
+
+/* Xen's script dir */
+#undef XEN_SCRIPT_DIR
+
 /* Enable large inode numbers on Mac OS X 10.5.  */
 #ifndef _DARWIN_USE_64_BIT_INODE
 # define _DARWIN_USE_64_BIT_INODE 1
tools/configure +45 -0

93 lines not on this page · raw message

tools/console/Makefile +2 -10
index 3f4cddab03..207c04c9cd 100644
@@ -22,27 +22,19 @@ all: $(BIN)
 clean:
 	$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS_RM)
 	$(RM) client/*.o daemon/*.o
-	$(RM) client/_paths.h
-	$(RM) daemon/_paths.h
 
 .PHONY: distclean
 distclean: clean
 
-daemon/main.o: daemon/_paths.h
+daemon/main.o: CFLAGS += -include $(XEN_ROOT)/tools/config.h
 daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CFLAGS_libxenforeignmemory) $(CONSOLE_CFLAGS-y)
 xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
 	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxenforeignmemory) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS)
 
-client/main.o: client/_paths.h
+client/main.o: CFLAGS += -include $(XEN_ROOT)/tools/config.h
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
 	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(APPEND_LDFLAGS)
 
-genpath-target = $(call buildmakevars2header,client/_paths.h)
-$(eval $(genpath-target))
-
-genpath-target = $(call buildmakevars2header,daemon/_paths.h)
-$(eval $(genpath-target))
-
 .PHONY: install
 install: $(BIN)
 	$(INSTALL_DIR) $(DESTDIR)/$(sbindir)
tools/console/client/main.c +0 -1
index 80157be421..ada6728caa 100644
@@ -41,7 +41,6 @@
 
 #include <xenstore.h>
 #include "xenctrl.h"
-#include "_paths.h"
 
 #define ESCAPE_CHARACTER 0x1d
 
tools/console/daemon/main.c +0 -1
index 30124a1c19..aac7233a48 100644
@@ -31,7 +31,6 @@
 
 #include "utils.h"
 #include "io.h"
-#include "_paths.h"
 
 int log_reload = 0;
 int log_guest = 0;
tools/helpers/Makefile +2 -6
index 1bcc97ea8a..7f6c422440 100644
@@ -24,6 +24,7 @@ $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenguest)
 $(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
 
 .PHONY: all
 all: $(PROGS)
@@ -31,8 +32,6 @@ all: $(PROGS)
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
 	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
-$(INIT_XENSTORE_DOMAIN_OBJS): _paths.h
-
 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)
 
@@ -47,9 +46,6 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS_RM) _paths.h
+	$(RM) -f *.o $(PROGS) $(DEPS_RM)
 
 distclean: clean
-
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
tools/helpers/init-xenstore-domain.c +0 -1
index b205a79ee6..dba4292803 100644
@@ -16,7 +16,6 @@
 #include <xen/io/xenbus.h>
 
 #include "init-dom-json.h"
-#include "_paths.h"
 
 #define LAPIC_BASE_ADDRESS  0xfee00000UL
 #define MB(x)               ((uint64_t)x << 20)
tools/libs/guest/Makefile +0 -5
index c6d882e239..8f5f3acd21 100644
@@ -106,11 +106,6 @@ include $(XEN_ROOT)/tools/libs/libs.mk
 libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
 libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
 
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
-$(LIB_OBJS) $(PIC_OBJS): _paths.h
-
 -include $(DEPS_INCLUDE)
 
 .PHONY: cleanlocal
tools/libs/guest/xg_dom_core.c +0 -1
index 2e4c1330ea..c17cf9f712 100644
@@ -33,7 +33,6 @@
 
 #define XG_NEED_UNALIGNED
 #include "xg_private.h"
-#include "_paths.h"
 
 /* ------------------------------------------------------------------------ */
 /* debugging                                                                */
tools/libs/guest/xg_suspend.c +0 -1
index 128353029c..0ce6364963 100644
@@ -19,7 +19,6 @@
 #include <xenevtchn.h>
 
 #include "xc_private.h"
-#include "_paths.h"
 #include "xenguest.h"
 
 #define SUSPEND_LOCK_FILE    XEN_RUN_DIR "/suspend-evtchn-%d.lock"
tools/libs/light/Makefile +2 -6
index bfd58226ce..fb5a9ca87e 100644
@@ -153,7 +153,7 @@ 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 = $(XEN_INCLUDE)/_libxl_list.h _paths.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
+AUTOINCS = $(XEN_INCLUDE)/_libxl_list.h _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
@@ -191,9 +191,6 @@ build: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
 
 $(LIB_OBJS) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok
 
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
 libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
@@ -216,9 +213,8 @@ _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 
 $(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h $(XEN_INCLUDE)/_libxl_list.h
 $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h
-libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h _libxl_types_internal_private.h _paths.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
-xl.h: _paths.h
 
 $(LIB_OBJS) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h
 $(LIB_OBJS) $(PIC_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
tools/libs/light/libxl_dom.c +0 -2
index fe9f760f71..c28867f87b 100644
@@ -24,8 +24,6 @@
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
 
-#include "_paths.h"
-
 //#define DEBUG 1
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
tools/libs/light/libxl_internal.h +0 -1
index 0b4671318c..37d5c27756 100644
@@ -73,7 +73,6 @@
 #endif
 
 #include "libxl.h"
-#include "_paths.h"
 #include "_libxl_save_msgs_callout.h"
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
tools/libs/light/libxl_utils.c +0 -1
index 4699c4a0a3..b91c2cafa2 100644
@@ -18,7 +18,6 @@
 #include <ctype.h>
 
 #include "libxl_internal.h"
-#include "_paths.h"
 
 #ifndef LIBXL_HAVE_NONCONST_LIBXL_BASENAME_RETURN_VALUE
 const
tools/libs/stat/Makefile +1 -6
index 911a2de8ec..01417b5334 100644
@@ -30,8 +30,6 @@ APPEND_LDFLAGS += $(LDLIBS-y)
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(LIB_OBJS) $(PIC_OBJS): _paths.h
-
 PYLIB=bindings/swig/python/_xenstat.so
 PYMOD=bindings/swig/python/xenstat.py
 PYSRC=bindings/swig/python/_xenstat.c
@@ -121,10 +119,7 @@ clean: cleanlocal
 
 .PHONY: cleanlocal
 cleanlocal:
-	rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) _paths.h
+	rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM)
 	rm -f libxenstat.map
 
 -include $(DEPS_INCLUDE)
-
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
tools/libs/stat/xenstat_qmp.c +0 -1
index 2205a04131..9909b9727e 100644
@@ -23,7 +23,6 @@
 #include <xenctrl.h>
 
 #include "xenstat_priv.h"
-#include "_paths.h"
 
 #ifdef HAVE_YAJL_YAJL_VERSION_H
 #  include <yajl/yajl_version.h>
tools/xl/Makefile +1 -6
index 2e129f00e1..b7f439121a 100644
@@ -29,11 +29,6 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
 $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
 
-genpath-target = $(call buildmakevars2header,_paths.h)
-$(eval $(genpath-target))
-
-$(XL_OBJS): _paths.h
-
 .PHONY: all
 all: xl
 
@@ -54,7 +49,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o xl _paths.h $(DEPS_RM)
+	$(RM) *.o xl $(DEPS_RM)
 
 distclean: clean
 
tools/xl/xl.h +0 -1
index cf12c79a9b..c5c4bedbdd 100644
@@ -17,7 +17,6 @@
 
 #include <assert.h>
 
-#include "_paths.h"
 #include <xentoollog.h>
 
 struct cmd_spec {
Signature · 1 line
Anthony PERARD
#32 lore raw

Re: [XEN PATCH 18/57] tools: Use config.h from autoconf instead of "buildmakevars2header"

Quoted 9 lines · Anthony PERARD

This avoid the need to generate the _paths.h header when the information is from autoconf anyway.

They are no more users of the "buildmakevars2header" macro, so it can be removed from "Config.mk".

Also removed the extra "-f" flag where "$(RM)" is used (xl/Makefile).

The changes for configure should be done in the respective configure.ac files and then configure can be generated via a call of "autoconf".

Juergen

#33 lore raw

Re: [XEN PATCH 18/57] tools: Use config.h from autoconf instead of "buildmakevars2header"

Quoted 7 lines · Juergen Gross
Quoted 6 lines · Anthony PERARD

This avoid the need to generate the _paths.h header when the information is from autoconf anyway.

They are no more users of the "buildmakevars2header" macro, so it can be removed from "Config.mk".

Quoted 6 lines
Quoted 3 lines

Also removed the extra "-f" flag where "$(RM)" is used (xl/Makefile).

The changes for configure should be done in the respective configure.ac files and then configure can be generated via a call of "autoconf".

This is what this patch does, via changes in "m4/paths.m4" ;-). All the respective "configure.ac" have "m4_include([m4/paths.m4])", so nearly any modification to "paths.m4" will change the generated "configure" script.

Cheers,

Signature · 1 line
Anthony PERARD
Reviewed-by
#34 lore raw

Re: [XEN PATCH 18/57] tools: Use config.h from autoconf instead of "buildmakevars2header"

Quoted 12 lines · Anthony PERARD
Quoted 11 lines · Juergen Gross
Quoted 9 lines · Anthony PERARD

This avoid the need to generate the _paths.h header when the information is from autoconf anyway.

They are no more users of the "buildmakevars2header" macro, so it can be removed from "Config.mk".

Also removed the extra "-f" flag where "$(RM)" is used (xl/Makefile).

Quoted 7 lines
Quoted 2 lines

The changes for configure should be done in the respective configure.ac files and then configure can be generated via a call of "autoconf".

This is what this patch does, via changes in "m4/paths.m4" ;-). All the respective "configure.ac" have "m4_include([m4/paths.m4])", so nearly any modification to "paths.m4" will change the generated "configure" script.

Oh, I just looked at the modified files and didn't see any *.ac ones.

I was already wondering how you could miss that, especially as you did it correctly in the next patch. :-)

You can then add my:

Juergen

#35 lore raw

PATCH 19/57 tools/configure.ac: Create ZLIB_LIBS and ZLIB_CFLAGS

In reply to Anthony PERARD

Use both ZLIB_CFLAGS and ZLIB_LIBS instead of cherry-picking flags from a single "ZLIB" variable.

---
 tools/configure.ac        | 19 ++++++++++++++-----
 config/Tools.mk.in        |  3 ++-
 tools/configure           | 22 ++++++++++++++--------
 tools/libs/guest/Makefile | 12 +++++-------
 4 files changed, 35 insertions(+), 21 deletions(-)
tools/configure.ac +14 -5
index 5a4fb9022d..56afe7930d 100644
@@ -391,17 +391,26 @@ AX_CHECK_FETCHER
 
 # Checks for libraries.
 AC_CHECK_HEADER([bzlib.h], [
-AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"])
+    AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit],
+        [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_BZLIB"
+         ZLIB_LIBS="$ZLIB_LIBS -lbz2"])
 ])
 AC_CHECK_HEADER([lzma.h], [
-AC_CHECK_LIB([lzma], [lzma_stream_decoder], [zlib="$zlib -DHAVE_LZMA -llzma"])
+    AC_CHECK_LIB([lzma], [lzma_stream_decoder],
+        [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZMA"
+         ZLIB_LIBS="$ZLIB_LIBS -llzma"])
 ])
 AC_CHECK_HEADER([lzo/lzo1x.h], [
-AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
+    AC_CHECK_LIB([lzo2], [lzo1x_decompress],
+        [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZO1X"
+         ZLIB_LIBS="$ZLIB_LIBS -llzo2"])
 ])
 PKG_CHECK_MODULES([libzstd], [libzstd],
-    [zlib="$zlib -DHAVE_ZSTD $libzstd_CFLAGS $libzstd_LIBS"], [true])
-AC_SUBST(zlib)
+    [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_ZSTD $libzstd_CFLAGS"
+     ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS"],
+    [true])
+AC_SUBST([ZLIB_CFLAGS])
+AC_SUBST([ZLIB_LIBS])
 AX_CHECK_EXTFS
 AX_CHECK_PTHREAD
 AX_CHECK_PTYFUNCS
config/Tools.mk.in +2 -1
index 934d899967..6c1a0a676f 100644
@@ -66,7 +66,8 @@ CONFIG_9PFS         := @ninepfs@
 LINUX_BACKEND_MODULES := @LINUX_BACKEND_MODULES@
 
 #System options
-ZLIB                := @zlib@
+ZLIB_CFLAGS         := @ZLIB_CFLAGS@
+ZLIB_LIBS           := @ZLIB_LIBS@
 CONFIG_LIBICONV     := @libiconv@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
tools/configure +14 -8
index 829753b5dd..a052c186a5 100755
@@ -641,7 +641,8 @@ PTHREAD_LIBS
 PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 EXTFS_LIBS
-zlib
+ZLIB_LIBS
+ZLIB_CFLAGS
 libzstd_LIBS
 libzstd_CFLAGS
 FETCHER
@@ -8605,7 +8606,7 @@ fi
 ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
 if test "x$ac_cv_header_bzlib_h" = xyes; then :
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5
 $as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; }
 if ${ac_cv_lib_bz2_BZ2_bzDecompressInit+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8642,7 +8643,8 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5
 $as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; }
 if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then :
-  zlib="$zlib -DHAVE_BZLIB -lbz2"
+  ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_BZLIB"
+         ZLIB_LIBS="$ZLIB_LIBS -lbz2"
 fi
 
 
@@ -8652,7 +8654,7 @@ fi
 ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
 if test "x$ac_cv_header_lzma_h" = xyes; then :
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5
 $as_echo_n "checking for lzma_stream_decoder in -llzma... " >&6; }
 if ${ac_cv_lib_lzma_lzma_stream_decoder+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8689,7 +8691,8 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_stream_decoder" >&5
 $as_echo "$ac_cv_lib_lzma_lzma_stream_decoder" >&6; }
 if test "x$ac_cv_lib_lzma_lzma_stream_decoder" = xyes; then :
-  zlib="$zlib -DHAVE_LZMA -llzma"
+  ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZMA"
+         ZLIB_LIBS="$ZLIB_LIBS -llzma"
 fi
 
 
@@ -8699,7 +8702,7 @@ fi
 ac_fn_c_check_header_mongrel "$LINENO" "lzo/lzo1x.h" "ac_cv_header_lzo_lzo1x_h" "$ac_includes_default"
 if test "x$ac_cv_header_lzo_lzo1x_h" = xyes; then :
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress in -llzo2" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress in -llzo2" >&5
 $as_echo_n "checking for lzo1x_decompress in -llzo2... " >&6; }
 if ${ac_cv_lib_lzo2_lzo1x_decompress+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8736,7 +8739,8 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzo2_lzo1x_decompress" >&5
 $as_echo "$ac_cv_lib_lzo2_lzo1x_decompress" >&6; }
 if test "x$ac_cv_lib_lzo2_lzo1x_decompress" = xyes; then :
-  zlib="$zlib -DHAVE_LZO1X -llzo2"
+  ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZO1X"
+         ZLIB_LIBS="$ZLIB_LIBS -llzo2"
 fi
 
 
@@ -8812,10 +8816,12 @@ else
 	libzstd_LIBS=$pkg_cv_libzstd_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	zlib="$zlib -DHAVE_ZSTD $libzstd_CFLAGS $libzstd_LIBS"
+	ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_ZSTD $libzstd_CFLAGS"
+     ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS"
 fi
 
 
+
 ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
 if test "x$ac_cv_header_ext2fs_ext2fs_h" = xyes; then :
 
tools/libs/guest/Makefile +5 -7
index 8f5f3acd21..1f4b7f7c58 100644
@@ -89,13 +89,12 @@ CFLAGS	+= $(CFLAGS_libxendevicemodel)
 CFLAGS += $(CFLAGS_libxencall) $(CFLAGS_libxenforeignmemory)
 
 ifeq ($(CONFIG_MiniOS),y)
-zlib-options =
-else
-zlib-options = $(ZLIB)
+ZLIB_CFLAGS :=
+ZLIB_LIBS :=
 endif
 
-xg_dom_bzimageloader.o: CFLAGS += $(filter -D%,$(zlib-options))
-xg_dom_bzimageloader.opic: CFLAGS += $(filter -D%,$(zlib-options))
+xg_dom_bzimageloader.o: CFLAGS += $(ZLIB_CFLAGS)
+xg_dom_bzimageloader.opic: CFLAGS += $(ZLIB_CFLAGS)
 
 LIBHEADER := xenguest.h
 
@@ -103,8 +102,7 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
-libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
+libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(ZLIB_LIBS) -lz
 
 -include $(DEPS_INCLUDE)
 
Signature · 1 line
Anthony PERARD
#37 lore raw

Re: [XEN PATCH 19/57] tools/configure.ac: Create ZLIB_LIBS and ZLIB_CFLAGS

In reply to Anthony PERARD

tools/libs/guest/Makefile NO_HEADERS_CHK := y · line 105

Quoted 11 lines · Anthony PERARD
tools/libs/guest/Makefile +1 -2
index 8f5f3acd21..1f4b7f7c58 100644
@@ -103,8 +102,7 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
-libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
+libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(ZLIB_LIBS) -lz

Looking ZLIB vs the other compression libs, shouldn't -lz be inside $(ZLIB_LIBS) ?

Also, shouldn't this be LDLIBS rather than APPEND_LDFLAGS ?

~Andrew

#38 lore raw

Re: [XEN PATCH 19/57] tools/configure.ac: Create ZLIB_LIBS and ZLIB_CFLAGS

Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Anthony PERARD
tools/libs/guest/Makefile +0 -0
index 8f5f3acd21..1f4b7f7c58 100644
@@ -103,8 +102,7 @@ NO_HEADERS_CHK := y
 
Quoted 8 lines

tools/libs/guest/Makefile NO_HEADERS_CHK := y · line 105

Quoted 5 lines
tools/libs/guest/Makefile +1 -2
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options))
-libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(COMPRESSION_LIBS) -lz
+libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(ZLIB_LIBS) -lz

Looking ZLIB vs the other compression libs, shouldn't -lz be inside $(ZLIB_LIBS) ?

I don't think so because -lz is also used by libxenhypfs for example, and maybe go binding for libxl. It seems that the name of the variable is misleading, as it seems that -lz is zlib but $ZLIB doesn't contain it or anything that would be called zlib.

-lz is check explicitly by configure and fail if missing, while $ZLIB can be empty.

Quoted 1 line

Also, shouldn't this be LDLIBS rather than APPEND_LDFLAGS ?

Yes, I think I'm doing that in a different patch.
libs: rename LDUSELIBS to LDLIBS and use it instead of APPEND_LDFLAGS

Thanks,

Signature · 1 line
Anthony PERARD
#39 lore raw

PATCH 20/57 tools/Rules.mk: introduce FORCE target

In reply to Anthony PERARD

And replace the one defined in libs.mk.

---
 tools/Rules.mk     | 3 +++
 tools/libs/libs.mk | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/Rules.mk +3 -0
index 4e9b4ee17f..0d3febfbb6 100644
@@ -210,3 +210,6 @@ $(PKG_CONFIG_DIR)/%.pc: Makefile $(XEN_ROOT)/tools/Rules.mk $(PKG_CONFIG_DIR)
 	echo "Libs.private: $(PKG_CONFIG_LIBSPRIV)"; \
 	echo "Requires.private: $(PKG_CONFIG_REQPRIV)"; \
 	} > $@
+
+.PHONY: FORCE
+FORCE:
tools/libs/libs.mk +0 -3
index 5c2f16dda4..996d467346 100644
@@ -135,6 +135,3 @@ clean:
 
 .PHONY: distclean
 distclean: clean
-
-.PHONY: FORCE
-FORCE:
Signature · 1 line
Anthony PERARD
#41 lore raw

PATCH 21/57 tools/include/xen-foreign: avoid to rely on default .SUFFIXES

In reply to Anthony PERARD

When a rule isn't a pattern rule, and thus don't have a %, the value of the automatic variable stem $* depends on .SUFFIXES. GNU make manual explain that it is better to avoid this "bizarre" behavior which exist for compatibility.

Use $(basename ) instead. So we can one day avoid make's build-in rules and variables.

---
 tools/include/xen-foreign/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/include/xen-foreign/Makefile +4 -4
index e395011fdd..6ce51daf5e 100644
@@ -25,28 +25,28 @@ check-headers: checker
 	rm tmp.size
 
 arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	$(PYTHON) $< $(basename $@) [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
 	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
 	$(call move-if-changed,[email protected],$@)
 
 arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	$(PYTHON) $< $(basename $@) [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
 	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
 	$(call move-if-changed,[email protected],$@)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	$(PYTHON) $< $(basename $@) [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
 	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
 	$(call move-if-changed,[email protected],$@)
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	$(PYTHON) $< $(basename $@) [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
 	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
Signature · 1 line
Anthony PERARD
#42 lore raw

PATCH 22/57 tools/console: have one Makefile per program/directory

In reply to Anthony PERARD

Sources of both xenconsoled and xenconsole are already separated into different directory and don't share anything in common. Having two different Makefile means it's easier to deal with *FLAGS.

Some common changes:
Rename $(BIN) to $(TARGETS), this will be useful later. Stop removing *.so *.rpm *.a as they aren't created here. Use $(OBJS-y) to list objects.
Update $(CFLAGS) for the directory rather than a single object.

daemon:

    Remove the need for $(LDLIBS_xenconsoled), use $(LDLIBS) instead.
    Remove the need for $(CONSOLE_CFLAGS-y) and use $(CFLAGS-y)
	instead.

client:

    Remove the unused $(LDLIBS_xenconsole)
---
 .gitignore                    |  4 +--
 tools/console/Makefile        | 49 +++-------------------------------
 tools/console/client/Makefile | 39 +++++++++++++++++++++++++++
 tools/console/daemon/Makefile | 50 +++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+), 48 deletions(-)
 create mode 100644 tools/console/client/Makefile
 create mode 100644 tools/console/daemon/Makefile
.gitignore +2 -2
index b39b996718..c31fa9b841 100644
@@ -159,8 +159,8 @@ tools/libs/util/libxenutil.map
 tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
 tools/libs/vchan/xenvchan.pc
-tools/console/xenconsole
-tools/console/xenconsoled
+tools/console/client/xenconsole
+tools/console/daemon/xenconsoled
 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
tools/console/Makefile +3 -46

53 lines not on this page · raw message

tools/console/client/Makefile new file +39 -0
new file mode 100644
index 0000000000..44176c6d93
@@ -0,0 +1,39 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS += -Werror
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenstore)
+CFLAGS += -include $(XEN_ROOT)/tools/config.h
+
+LDLIBS += $(LDLIBS_libxenctrl)
+LDLIBS += $(LDLIBS_libxenstore)
+LDLIBS += $(SOCKET_LIBS)
+
+OBJS-y := main.o
+
+TARGETS := xenconsole
+
+.PHONY: all
+all: $(TARGETS)
+
+xenconsole: $(OBJS-y)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) xenconsole $(DESTDIR)$(LIBEXEC_BIN)
+
+.PHONY: uninstall
+uninstall:
+	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xenconsole
+
+.PHONY: clean
+clean:
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
+
+.PHONY: distclean
+distclean: clean
+
+-include $(DEPS_INCLUDE)
tools/console/daemon/Makefile new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#43 lore raw

Re: [XEN PATCH 22/57] tools/console: have one Makefile per program/directory

Quoted 33 lines · Anthony PERARD

Sources of both xenconsoled and xenconsole are already separated into different directory and don't share anything in common. Having two different Makefile means it's easier to deal with *FLAGS.

Some common changes:
Rename $(BIN) to $(TARGETS), this will be useful later. Stop removing *.so *.rpm *.a as they aren't created here. Use $(OBJS-y) to list objects.
Update $(CFLAGS) for the directory rather than a single object.

daemon:

    Remove the need for $(LDLIBS_xenconsoled), use $(LDLIBS) instead.
    Remove the need for $(CONSOLE_CFLAGS-y) and use $(CFLAGS-y)
	instead.

client:

    Remove the unused $(LDLIBS_xenconsole)
---
 .gitignore                    |  4 +--
 tools/console/Makefile        | 49 +++-------------------------------
 tools/console/client/Makefile | 39 +++++++++++++++++++++++++++
 tools/console/daemon/Makefile | 50 +++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+), 48 deletions(-)
 create mode 100644 tools/console/client/Makefile
 create mode 100644 tools/console/daemon/Makefile
.gitignore +0 -0
index b39b996718..c31fa9b841 100644

.gitignore tools/libs/util/libxenutil.map · line 163

Quoted 7 lines
.gitignore +2 -2
@@ -159,8 +159,8 @@ tools/libs/util/libxenutil.map
 tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
 tools/libs/vchan/xenvchan.pc
-tools/console/xenconsole
-tools/console/xenconsoled
+tools/console/client/xenconsole
+tools/console/daemon/xenconsoled
$ git ls-files -- :/ | grep gitignore
../.gitignore
../tools/fuzz/cpu-policy/.gitignore
../tools/libs/.gitignore
../tools/misc/.gitignore
../tools/tests/cpu-policy/.gitignore
../tools/tests/resource/.gitignore
../tools/tests/tsx/.gitignore
../tools/tests/vhpet/.gitignore
../tools/tests/xenstore/.gitignore
tools/kconfig/.gitignore
xsm/flask/.gitignore

We're starting to use per-dir gitignores, because it has far less problematic behaviour for code movement.

I think we ought to take this opportunity to clean things up for the better.

tools/console/client/Makefile line 4

Quoted 10 lines
tools/console/client/Makefile new file +4 -0
new file mode 100644
index 0000000000..44176c6d93
@@ -0,0 +1,39 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS += -Werror

-Werror really ought to come from somewhere common, seeing as we expect it to be unilaterally set.

~Andrew

#44 lore raw

Re: [XEN PATCH 22/57] tools/console: have one Makefile per program/directory

Quoted 56 lines · Andrew Cooper
Quoted 33 lines · Anthony PERARD

Sources of both xenconsoled and xenconsole are already separated into different directory and don't share anything in common. Having two different Makefile means it's easier to deal with *FLAGS.

Some common changes:
Rename $(BIN) to $(TARGETS), this will be useful later. Stop removing *.so *.rpm *.a as they aren't created here. Use $(OBJS-y) to list objects.
Update $(CFLAGS) for the directory rather than a single object.

daemon:

    Remove the need for $(LDLIBS_xenconsoled), use $(LDLIBS) instead.
    Remove the need for $(CONSOLE_CFLAGS-y) and use $(CFLAGS-y)
	instead.

client:

    Remove the unused $(LDLIBS_xenconsole)
---
 .gitignore                    |  4 +--
 tools/console/Makefile        | 49 +++-------------------------------
 tools/console/client/Makefile | 39 +++++++++++++++++++++++++++
 tools/console/daemon/Makefile | 50 +++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+), 48 deletions(-)
 create mode 100644 tools/console/client/Makefile
 create mode 100644 tools/console/daemon/Makefile
.gitignore +0 -0
index b39b996718..c31fa9b841 100644

.gitignore tools/libs/util/libxenutil.map · line 163

Quoted 7 lines
.gitignore +2 -2
@@ -159,8 +159,8 @@ tools/libs/util/libxenutil.map
 tools/libs/vchan/headers.chk
 tools/libs/vchan/libxenvchan.map
 tools/libs/vchan/xenvchan.pc
-tools/console/xenconsole
-tools/console/xenconsoled
+tools/console/client/xenconsole
+tools/console/daemon/xenconsoled
$ git ls-files -- :/ | grep gitignore
../.gitignore
../tools/fuzz/cpu-policy/.gitignore
../tools/libs/.gitignore
../tools/misc/.gitignore
../tools/tests/cpu-policy/.gitignore
../tools/tests/resource/.gitignore
../tools/tests/tsx/.gitignore
../tools/tests/vhpet/.gitignore
../tools/tests/xenstore/.gitignore
tools/kconfig/.gitignore
xsm/flask/.gitignore
Quoted 2 lines

We're starting to use per-dir gitignores, because it has far less problematic behaviour for code movement.

You mean "we", I don't think everyone agree we that yet ;-). They aren't any "xen/.gitignore" yet, despite me trying to add one at some point.

Quoted 1 line

I think we ought to take this opportunity to clean things up for the better.

Sounds good to me, I'll make the change.

Quoted 5 lines
Quoted 5 lines
tools/console/client/Makefile new file +0 -0
new file mode 100644
index 0000000000..44176c6d93
Quoted 8 lines

tools/console/client/Makefile line 4

Quoted 5 lines
tools/console/client/Makefile new file +4 -0
@@ -0,0 +1,39 @@
+XEN_ROOT=$(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS += -Werror

-Werror really ought to come from somewhere common, seeing as we expect it to be unilaterally set.

Yes. I think I'll also look at having "./configure --disable-werror" or similar so -Werror could be easly disable, by for example someone building an ancient release and not wanting to deal with warnings.

Thanks,

Signature · 1 line
Anthony PERARD
#45 lore raw

PATCH 23/57 tools/debugger: Allow make to recurse into debugger/

In reply to Anthony PERARD

Avoid the need for explicite rules to recurse into debugger/* dirs by adding a Makefile in debugger/.

---
 tools/Makefile          | 27 +--------------------------
 tools/debugger/Makefile |  8 ++++++++
 2 files changed, 9 insertions(+), 26 deletions(-)
 create mode 100644 tools/debugger/Makefile
tools/Makefile +1 -26
index 8936b754c8..79b4c7e3de 100644
@@ -32,8 +32,7 @@ SUBDIRS-$(CONFIG_GOLANG) += golang
 SUBDIRS-y += xl
 SUBDIRS-y += helpers
 SUBDIRS-$(CONFIG_X86) += xenpaging
-SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
-SUBDIRS-$(CONFIG_X86) += debugger/kdd
+SUBDIRS-$(CONFIG_X86) += debugger
 SUBDIRS-$(CONFIG_TESTS) += tests
 
 SUBDIRS-y += python
@@ -272,30 +271,6 @@ subdir-clean-qemu-xen-dir:
 
 subdir-uninstall-qemu-xen-dir: ;
 
-subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
-	$(MAKE) -C debugger/gdbsx clean
-
-subdir-install-debugger/gdbsx: .phony
-	$(MAKE) -C debugger/gdbsx install
-
-subdir-all-debugger/gdbsx: .phony
-	$(MAKE) -C debugger/gdbsx all
-
-subdir-uninstall-debugger/gdbsx: .phony
-	$(MAKE) -C debugger/gdbsx uninstall
-
-subdir-clean-debugger/kdd subdir-distclean-debugger/kdd: .phony
-	$(MAKE) -C debugger/kdd clean
-
-subdir-install-debugger/kdd: .phony
-	$(MAKE) -C debugger/kdd install
-
-subdir-uninstall-debugger/kdd: .phony
-	$(MAKE) -C debugger/kdd uninstall
-
-subdir-all-debugger/kdd: .phony
-	$(MAKE) -C debugger/kdd all
-
 subtree-force-update:
 ifeq ($(CONFIG_QEMU_XEN),y)
 	$(MAKE) qemu-xen-dir-force-update
tools/debugger/Makefile new file +8 -0
new file mode 100644
index 0000000000..51efd3680b
@@ -0,0 +1,8 @@
+XEN_ROOT=$(CURDIR)/../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+SUBDIRS-y := gdbsx
+SUBDIRS-y += kdd
+
+.PHONY: all clean install distclean uninstall
+all clean install distclean uninstall: %: subdirs-%
Signature · 1 line
Anthony PERARD
#46 lore raw

PATCH 24/57 tools/debugger/gdbsx: Fix and cleanup makefiles

In reply to Anthony PERARD

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"

---
 tools/debugger/gdbsx/Makefile    | 20 ++++++++++----------
 tools/debugger/gdbsx/gx/Makefile | 15 +++++++--------
 tools/debugger/gdbsx/xg/Makefile | 25 +++++++------------------
 3 files changed, 24 insertions(+), 36 deletions(-)
tools/debugger/gdbsx/Makefile +10 -10
index 8d7cd94a31..4aaf427c45 100644
@@ -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
tools/debugger/gdbsx/gx/Makefile +7 -8
index 3b8467f799..ff5c8e9e6e 100644
@@ -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)
tools/debugger/gdbsx/xg/Makefile +7 -18
index acdcddf0d5..a02c7649cf 100644
@@ -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)
Signature · 1 line
Anthony PERARD
#47 lore raw

Re: [XEN PATCH 24/57] tools/debugger/gdbsx: Fix and cleanup makefiles

Quoted 5 lines · Anthony PERARD
tools/debugger/gdbsx/Makefile +0 -0
index 8d7cd94a31..4aaf427c45 100644

tools/debugger/gdbsx/Makefile uninstall: · line 34

Quoted 9 lines
tools/debugger/gdbsx/Makefile +2 -2
@@ -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

Shouldn't these be in the sub Make's ?

Quoted 10 lines
tools/debugger/gdbsx/gx/Makefile +1 -1
index 3b8467f799..ff5c8e9e6e 100644
@@ -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)
+

tools/debugger/gdbsx/gx/Makefile XEN_ROOT = $(CURDIR)/../../../.. · line 13

Quoted 10 lines
tools/debugger/gdbsx/gx/Makefile +3 -2
+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)

$(RM)

tools/debugger/gdbsx/gx/Makefile XEN_ROOT = $(CURDIR)/../../../.. · line 19

Quoted 11 lines
tools/debugger/gdbsx/gx/Makefile +2 -5
 .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)

There's probably an $(AR) we ought to be using.

~Andrew

#48 lore raw

Re: [XEN PATCH 24/57] tools/debugger/gdbsx: Fix and cleanup makefiles

Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Anthony PERARD
tools/debugger/gdbsx/Makefile +0 -0
index 8d7cd94a31..4aaf427c45 100644
@@ -28,7 +28,7 @@ uninstall:
 gdbsx: gx/gx_all.a xg/xg_all.a 
 	$(CC) $(LDFLAGS) -o $@ $^
 
Quoted 8 lines

tools/debugger/gdbsx/Makefile uninstall: · line 34

Quoted 6 lines
tools/debugger/gdbsx/Makefile +2 -2
-xg/xg_all.a:
+xg/xg_all.a: FORCE
 	$(MAKE) -C xg
-gx/gx_all.a:
+gx/gx_all.a: FORCE
 	$(MAKE) -C gx

Shouldn't these be in the sub Make's ?

No, this is how we tell make how to build some of the prerequisite needed to build "gdbsx", we tell make that they are build in sub-directory.

Quoted 10 lines

tools/debugger/gdbsx/gx/Makefile XEN_ROOT = $(CURDIR)/../../../.. · line 19

Quoted 8 lines
tools/debugger/gdbsx/gx/Makefile +2 -5
-#%.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)

There's probably an $(AR) we ought to be using.

Yes, I'll look at that.

Thanks,

Signature · 1 line
Anthony PERARD
#49 lore raw

PATCH 25/57 tools/examples: cleanup Makefile

In reply to Anthony PERARD

Don't check if a target exist before installing it. For directory, install doesn't complain, and for file it would prevent from updating them.

Remove XEN_CONFIGS-y which isn't used.

Remove "build" target.

Add an empty line after the first comment. The comment isn't about $(XEN_READMES), it is about the makefile as a whole.

---
 tools/examples/Makefile | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
tools/examples/Makefile +6 -15
index 14e24f4cb3..48b520e133 100644
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen configuration dir and configs to go there.
+
 XEN_READMES = README
 
 XEN_CONFIGS += xlexample.hvm
@@ -10,14 +11,9 @@ XEN_CONFIGS += xlexample.pvhlinux
 XEN_CONFIGS += xl.conf
 XEN_CONFIGS += cpupool
 
-XEN_CONFIGS += $(XEN_CONFIGS-y)
-
 .PHONY: all
 all:
 
-.PHONY: build
-build:
-
 .PHONY: install
 install: all install-readmes install-configs
 
@@ -26,10 +22,8 @@ uninstall: uninstall-readmes uninstall-configs
 
 .PHONY: install-readmes
 install-readmes:
-	[ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
-	set -e; for i in $(XEN_READMES); \
-	    do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
+	set -e; for i in $(XEN_READMES); do \
 	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
 	done
 
@@ -39,12 +33,9 @@ uninstall-readmes:
 
 .PHONY: install-configs
 install-configs: $(XEN_CONFIGS)
-	[ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
-	[ -d $(DESTDIR)$(XEN_CONFIG_DIR)/auto ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)/auto
-	set -e; for i in $(XEN_CONFIGS); \
-	    do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)/auto
+	set -e; for i in $(XEN_CONFIGS); do \
 	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
 	done
 
Signature · 1 line
Anthony PERARD
#50 lore raw

Re: [XEN PATCH 25/57] tools/examples: cleanup Makefile

Quoted 5 lines · Anthony PERARD
tools/examples/Makefile +0 -0
index 14e24f4cb3..48b520e133 100644

tools/examples/Makefile uninstall: uninstall-readmes uninstall-configs · line 27

Quoted 10 lines
tools/examples/Makefile +2 -4
@@ -26,10 +22,8 @@ uninstall: uninstall-readmes uninstall-configs
 
 .PHONY: install-readmes
 install-readmes:
-	[ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
-	set -e; for i in $(XEN_READMES); \
-	    do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
+	set -e; for i in $(XEN_READMES); do \
 	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \

Hmm.  Do we need a shell loop here at all?  Can't $(INSTALL_DATA) take multiple $i's at the same time?

~Andrew

#51 lore raw

Re: [XEN PATCH 25/57] tools/examples: cleanup Makefile

Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Anthony PERARD
tools/examples/Makefile +0 -0
index 14e24f4cb3..48b520e133 100644
@@ -26,10 +22,8 @@ uninstall: uninstall-readmes uninstall-configs
 
Quoted 12 lines

tools/examples/Makefile uninstall: uninstall-readmes uninstall-configs · line 27

Quoted 9 lines
tools/examples/Makefile +2 -4
 .PHONY: install-readmes
 install-readmes:
-	[ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
-		$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
-	set -e; for i in $(XEN_READMES); \
-	    do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
+	set -e; for i in $(XEN_READMES); do \
 	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \

Hmm.  Do we need a shell loop here at all?  Can't $(INSTALL_DATA) take multiple $i's at the same time?

Probably, even if the only time they are multiple filed install by INSTALL_DATA in our build system is when shell globing is involve. So, it's probably fine to remove the loop.

Thanks,

Signature · 1 line
Anthony PERARD
#52 lore raw

PATCH 26/57 tools/firmware/hvmloader: rework Makefile

In reply to Anthony PERARD

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", in case the target already exist.

---
 tools/firmware/hvmloader/Makefile | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
tools/firmware/hvmloader/Makefile +9 -7
index b754220839..fc20932110 100644
@@ -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,15 @@ 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
+build.o: $(DSDT_FILES)
+
 hvmloader: $(OBJS) hvmloader.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T hvmloader.lds -o $@ $(OBJS)
 
@@ -87,21 +89,21 @@ roms.inc: $(ROMS)
 
 ifneq ($(ROMBIOS_ROM),)
 	echo "#ifdef ROM_INCLUDE_ROMBIOS" >> [email protected]
-	sh ../../misc/mkhex rombios $(ROMBIOS_ROM) >> [email protected]
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex rombios $(ROMBIOS_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
 
 ifneq ($(STDVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> [email protected]
-	sh ../../misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> [email protected]
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_stdvga $(STDVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
 ifneq ($(CIRRUSVGA_ROM),)
 	echo "#ifdef ROM_INCLUDE_VGABIOS" >> [email protected]
-	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
+	$(SHELL) $(XEN_ROOT)/tools/misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-	mv [email protected] $@
+	mv -f [email protected] $@
 
 .PHONY: clean
 clean:
Signature · 1 line
Anthony PERARD
#53 lore raw

Re: [XEN PATCH 26/57] tools/firmware/hvmloader: rework Makefile

Quoted 6 lines · Anthony PERARD

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".

So I've read up on what this means, but is it really that important in the grand scheme of things?

Can't we actually make our problems go away by turning libacpi into a real static library?  (Also, the "kill hvmloader plans" will turn libacpi back into only having one single user, so that too)

~Andrew

#54 lore raw

Re: [XEN PATCH 26/57] tools/firmware/hvmloader: rework Makefile

Quoted 10 lines · Andrew Cooper
Quoted 6 lines · Anthony PERARD

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".

So I've read up on what this means, but is it really that important in the grand scheme of things?

It something that Jan proposed to do in some cases in the hypervisor build system. I thought it was something good to do so I start using -iquote in the toolstack as well.

Quoted 3 lines

Can't we actually make our problems go away by turning libacpi into a real static library?  (Also, the "kill hvmloader plans" will turn libacpi back into only having one single user, so that too)

Well, libacpi also have some headers that needs to be generated, so I'm not sure which problem are going away when turning it into a static lib. Also, I don't think hvmloader and libxl would want the same library.

Thanks,

Signature · 1 line
Anthony PERARD
#55 lore raw

PATCH 27/57 tools/fuzz/libelf: rework makefile

In reply to Anthony PERARD

Rename ELF_LIB_OBJS to LIBELF_OBJS as to have the same name as in libs/guest/.

Replace "-I" by "-iquote".

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

---
 .gitignore                 |  1 +
 tools/fuzz/libelf/Makefile | 21 ++++++++++-----------
 2 files changed, 11 insertions(+), 11 deletions(-)
.gitignore +1 -0
index c31fa9b841..4267bb4dee 100644
@@ -197,6 +197,7 @@ tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fuzz/libelf/afl-libelf-fuzzer
+tools/fuzz/libelf/libelf-*.c
 tools/fuzz/x86_instruction_emulator/asm
 tools/fuzz/x86_instruction_emulator/afl-harness
 tools/fuzz/x86_instruction_emulator/afl-harness-cov
tools/fuzz/libelf/Makefile +10 -11
index 9eb30ee40c..9211f75951 100644
@@ -1,25 +1,24 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-# libelf fuzz target
-vpath %.c ../../../xen/common/libelf
-CFLAGS += -I../../../xen/common/libelf
-ELF_SRCS-y += libelf-tools.c libelf-loader.c libelf-dominfo.c
-ELF_LIB_OBJS := $(patsubst %.c,%.o,$(ELF_SRCS-y))
+LIBELF_OBJS := libelf-tools.o libelf-loader.o libelf-dominfo.o
 
-$(patsubst %.c,%.o,$(ELF_SRCS-y)): CFLAGS += -Wno-pointer-sign
-
-$(ELF_LIB_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude)
+CFLAGS += -iquote ../../../xen/common/libelf
+$(LIBELF_OBJS): CFLAGS += -Wno-pointer-sign
+$(LIBELF_OBJS): CFLAGS += -DFUZZ_NO_LIBXC $(CFLAGS_xeninclude)
 
 libelf-fuzzer.o: CFLAGS += $(CFLAGS_xeninclude)
 
-libelf.a: libelf-fuzzer.o $(ELF_LIB_OBJS)
+$(LIBELF_OBJS:.o=.c): libelf-%.c: ../../../xen/common/libelf/libelf-%.c FORCE
+	ln -nsf $< $@
+
+libelf.a: libelf-fuzzer.o $(LIBELF_OBJS)
 	$(AR) rc $@ $^
 
 .PHONY: libelf-fuzzer-all
 libelf-fuzzer-all: libelf.a libelf-fuzzer.o
 
-afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(ELF_LIB_OBJS)
+afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(LIBELF_OBJS)
 	$(CC) $(CFLAGS) $^ -o $@
 
 # Common targets
@@ -31,7 +30,7 @@ distclean: clean
 
 .PHONY: clean
 clean:
-	rm -f *.o .*.d *.a *-libelf-fuzzer
+	rm -f *.o .*.d *.a *-libelf-fuzzer $(LIBELF_OBJS:.o=.c)
 
 .PHONY: install
 install: all
Signature · 1 line
Anthony PERARD
#56 lore raw

PATCH 28/57 tools/fuzz/x86_instruction_emulator: rework makefile

In reply to Anthony PERARD

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.

---
 .gitignore                                   |  1 +
 tools/fuzz/x86_instruction_emulator/Makefile | 32 +++++++++-----------
 2 files changed, 15 insertions(+), 18 deletions(-)
.gitignore +1 -0
index 4267bb4dee..8fb74a4c94 100644
@@ -201,6 +201,7 @@ tools/fuzz/libelf/libelf-*.c
 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/cpuid.c
 tools/fuzz/x86_instruction_emulator/wrappers.c
 tools/fuzz/x86_instruction_emulator/x86_emulate
 tools/fuzz/x86_instruction_emulator/x86-emulate.[ch]
tools/fuzz/x86_instruction_emulator/Makefile +14 -18
index 1a6dbf94e1..f11437e6a2 100644
@@ -8,33 +8,27 @@ else
 x86-insn-fuzz-all:
 endif
 
-# Add libx86 to the build
-vpath %.c $(XEN_ROOT)/xen/lib/x86
+cpuid.c: %: $(XEN_ROOT)/xen/lib/x86/% FORCE
+	ln -nsf $< $@
 
-x86_emulate:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@
+x86_emulate: FORCE
+	ln -nsf $(XEN_ROOT)/xen/arch/x86/$@
 
 x86_emulate/%: x86_emulate ;
 
-x86-emulate.c x86-emulate.h wrappers.c: %:
-	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
+x86-emulate.c x86-emulate.h wrappers.c: %: $(XEN_ROOT)/tools/tests/x86_emulator/% FORCE
+	ln -nsf $< $@
 
-CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
+CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote .
+cpuid.o: CFLAGS += -iquote $(XEN_ROOT)/xen/lib/x86
 
 GCOV_FLAGS := --coverage
 %-cov.o: %.c
 	$(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
-x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
-                     x86-vendors.h x86-defns.h msr-index.h) \
-         $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \
-                     cpuid.h cpuid-autogen.h)
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
-
-# x86-emulate.c will be implicit for both
-x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
-
-fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h)
+x86-emulate.h: x86_emulate/x86_emulate.h
+x86-emulate.o x86-emulate-cov.o: x86-emulate.h x86_emulate/x86_emulate.c
+fuzz-emul.o fuzz-emul-cov.o wrappers.o: x86-emulate.h
 
 x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o
 	$(AR) rc $@ $^
@@ -51,7 +45,7 @@ all: x86-insn-fuzz-all
 
 .PHONY: distclean
 distclean: clean
-	rm -f x86_emulate x86-emulate.c x86-emulate.h
+	rm -f x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
 
 .PHONY: clean
 clean:
@@ -67,3 +61,5 @@ afl: afl-harness
 
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
+
+-include $(DEPS_INCLUDE)
Signature · 1 line
Anthony PERARD
#57 lore raw

PATCH 29/57 tools/helper: Cleanup Makefile

In reply to Anthony PERARD

Use $(TARGETS) to collect targets.
Collect library to link against in $(LDLIBS). Remove extra "-f" flags that is already part of $(RM).

---
 tools/helpers/Makefile | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)
tools/helpers/Makefile +17 -8
index 7f6c422440..2fe3be2f89 100644
@@ -5,10 +5,10 @@
 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
 endif
 
@@ -17,6 +17,10 @@ $(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 += $(LDLIBS_libxenctrl)
+xen-init-dom0: LDLIBS += $(LDLIBS_libxentoollog)
+xen-init-dom0: LDLIBS += $(LDLIBS_libxenstore)
+xen-init-dom0: LDLIBS += $(LDLIBS_libxenlight)
 
 INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
 $(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
@@ -25,27 +29,32 @@ $(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 += $(LDLIBS_libxentoollog)
+init-xenstore-domain: LDLIBS += $(LDLIBS_libxenstore)
+init-xenstore-domain: LDLIBS += $(LDLIBS_libxenctrl)
+init-xenstore-domain: LDLIBS += $(LDLIBS_libxenguest)
+init-xenstore-domain: LDLIBS += $(LDLIBS_libxenlight)
 
 .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)
 
 .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
Signature · 1 line
Anthony PERARD
#58 lore raw

PATCH 30/57 tools/hotplug: cleanup Makefiles

In reply to Anthony PERARD

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/.

---
 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(-)
tools/hotplug/FreeBSD/Makefile +3 -8
index de9928cd86..a6552c9884 100644
@@ -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:
tools/hotplug/Linux/Makefile +6 -10
index 0b1d111d7e..9a7b3a3515 100644
@@ -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); \
tools/hotplug/Linux/systemd/Makefile +7 -9
index a5d41d86ef..26df2a43b1 100644
@@ -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 [email protected]
 	for mod in $(LINUX_BACKEND_MODULES) ; do \
 		echo $$mod ; \
-		done > [email protected]
+	done > [email protected]
 	$(call move-if-changed,[email protected],$@)
tools/hotplug/NetBSD/Makefile +3 -6
index f909ffa367..1cd3db2ccb 100644
@@ -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
 
tools/hotplug/common/Makefile +6 -10
index ef48bfacc9..e8a8dbea6c 100644
@@ -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); \
Signature · 1 line
Anthony PERARD
#59 lore raw

PATCH 31/57 tools/libfsimage: Cleanup makefiles

In reply to Anthony PERARD

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.

---
 tools/libfsimage/Rules.mk            | 26 ++++++++------------------
 tools/libfsimage/common.mk           | 11 +++++++++++
 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 ---------
 11 files changed, 22 insertions(+), 100 deletions(-)
 create mode 100644 tools/libfsimage/common.mk
tools/libfsimage/Rules.mk +8 -18
index bb6d42abb4..cf37d6cb0d 100644
@@ -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)
tools/libfsimage/common.mk new file +11 -0
new file mode 100644
index 0000000000..77bc957f27
@@ -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)
tools/libfsimage/common/Makefile +3 -8
index 24bc90e73e..bcda86d754 100644
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 MAJOR = 4.16
 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)
tools/libfsimage/ext2fs-lib/Makefile +0 -9
index 431a79068e..b9b560df75 100644
@@ -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
tools/libfsimage/ext2fs/Makefile +0 -9
index c62ae359ac..fe01f98148 100644
@@ -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
tools/libfsimage/fat/Makefile +0 -9
index 7ee5e7588d..58bcc0751d 100644
@@ -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
tools/libfsimage/iso9660/Makefile +0 -11
index bc86baf2c0..acf3164046 100644
@@ -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
tools/libfsimage/reiserfs/Makefile +0 -9
index 5acfedf25e..42b751e007 100644
@@ -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
tools/libfsimage/ufs/Makefile +0 -9
index f32b9178bd..cca4f0a588 100644
@@ -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
tools/libfsimage/xfs/Makefile +0 -9
index 54eeb6e35e..ebac7baf14 100644
@@ -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
tools/libfsimage/zfs/Makefile +0 -9
index 084e5ec08d..434a9c3580 100644
@@ -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
Signature · 1 line
Anthony PERARD
#60 lore raw

PATCH 32/57 tools/misc: rework Makefile

In reply to Anthony PERARD

Add missing "xen-detect" rule. 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.

Rename $(TARGETS_BUILD) to $(TARGETS).

Remove the unused "build" target.

Also, they are no more "build-only" targets, remove the extra code.

---
 tools/misc/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/misc/Makefile +8 -8
index 8b9558b93f..5e7787e501 100644
@@ -50,16 +50,13 @@ TARGETS_COPY += xencov_split
 TARGETS_COPY += xenpvnetboot
 
 # Everything which needs to be built
-TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
+TARGETS := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
 
-# ... including build-only targets
-TARGETS_BUILD += $(TARGETS_BUILD-y)
-
-.PHONY: all build
-all build: $(TARGETS_BUILD)
+.PHONY: all
+all: $(TARGETS)
 
 .PHONY: install
-install: build
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(bindir)
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
@@ -75,7 +72,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS_BUILD) *~ $(DEPS_RM)
+	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
@@ -86,6 +83,9 @@ xen-access: xen-access.o
 xen-cpuid: xen-cpuid.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
+xen-detect: xen-detect.o
+	$(CC) $(LDFLAGS) -o $@ $< $(APPEND_LDFLAGS)
+
 xen-hvmctx: xen-hvmctx.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
Signature · 1 line
Anthony PERARD
#61 lore raw

PATCH 33/57 tools/vchan: Collect targets in TARGETS

In reply to Anthony PERARD

And use the new TARGETS to clean them. Now "clean" will remove "vchan-socket-proxy".

$(RM) already have the "-f" flags, so remove the second one.

---
 tools/vchan/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/vchan/Makefile +4 -2
index a731e0e073..c886c22e12 100644
@@ -11,8 +11,10 @@ NODE2_OBJS = node-select.o
 $(NODE_OBJS) $(NODE2_OBJS): CFLAGS += $(CFLAGS_libxenvchan) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
 vchan-socket-proxy.o: CFLAGS += $(CFLAGS_libxenvchan) $(CFLAGS_libxenstore) $(CFLAGS_libxenctrl) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn)
 
+TARGETS := vchan-node1 vchan-node2 vchan-socket-proxy
+
 .PHONY: all
-all: vchan-node1 vchan-node2 vchan-socket-proxy
+all: $(TARGETS)
 
 vchan-node1: $(NODE_OBJS)
 	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
@@ -30,7 +32,7 @@ install: all
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o vchan-node1 vchan-node2 $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 distclean: clean
 
Signature · 1 line
Anthony PERARD
#62 lore raw

PATCH 34/57 tools/xcutils: rework Makefile

In reply to Anthony PERARD

Use TARGETS to collect targets to build

Remove "build" target.

---
 tools/xcutils/Makefile | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
tools/xcutils/Makefile +6 -9
index 82d42624c8..198be22a5a 100644
@@ -11,7 +11,7 @@
 XEN_ROOT	= $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGRAMS = readnotes lsevtchn
+TARGETS := readnotes lsevtchn
 
 CFLAGS += -Werror
 
@@ -19,10 +19,7 @@ CFLAGS_readnotes.o  := $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl) $(CFLAGS_libx
 CFLAGS_lsevtchn.o   := $(CFLAGS_libxenevtchn) $(CFLAGS_libxenctrl)
 
 .PHONY: all
-all: build
-
-.PHONY: build
-build: $(PROGRAMS)
+all: $(TARGETS)
 
 readnotes: readnotes.o
 	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
@@ -31,17 +28,17 @@ lsevtchn: lsevtchn.o
 	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 .PHONY: install
-install: build
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
-	rm -f $(addprefix $(DESTDIR)$(LIBEXECDIR)/, $(PROGRAMS))
+	rm -f $(addprefix $(DESTDIR)$(LIBEXECDIR)/, $(TARGETS))
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(PROGRAMS)
+	$(RM) *.o $(TARGETS)
 	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
Signature · 1 line
Anthony PERARD
#63 lore raw

Re: [XEN PATCH 34/57] tools/xcutils: rework Makefile

Quoted 14 lines · Anthony PERARD

Use TARGETS to collect targets to build

Remove "build" target.

---
 tools/xcutils/Makefile | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
tools/xcutils/Makefile +0 -0
index 82d42624c8..198be22a5a 100644

tools/xcutils/Makefile line 14

Quoted 5 lines
tools/xcutils/Makefile +1 -1
@@ -11,7 +11,7 @@
 XEN_ROOT	= $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGRAMS = readnotes lsevtchn
+TARGETS := readnotes lsevtchn

(For the future, because I'll commit this patch nowish)

We have at least

tools/xcutils
tools/misc
tools/helpers

of "misc random crap".  We ought to consolidate, and rethink which binaries get installed where, because there is no coherent logic for which end up on $PATH by default, and which don't.

~Andrew

#64 lore raw

PATCH 35/57 tools/xenpaging: Rework makefile

In reply to Anthony PERARD

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

---
 tools/xenpaging/Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
tools/xenpaging/Makefile +12 -12
index 04743b335c..e2ed9eaa3f 100644
@@ -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)
Signature · 1 line
Anthony PERARD
#65 lore raw

Re: [XEN PATCH 35/57] tools/xenpaging: Rework makefile

tools/xenpaging/Makefile distclean: clean · line 42

Quoted 6 lines · Anthony PERARD
tools/xenpaging/Makefile +1 -1
@@ -39,6 +39,6 @@ distclean: clean
 
 .PHONY: TAGS
 TAGS:
-	etags -t $(SRCS) *.h
+	etags -t *.c *.h

/local/xen.git/xen$ git grep -w TAGS: -- :/
../tools/libs/libs.mk:129:TAGS:
../tools/xenpaging/Makefile:41:TAGS:
../tools/xenstore/Makefile:102:TAGS:
Makefile:487:TAGS:

Facilities like this ought to be organised by tools/Makefile, or perhaps even the root Makefile.

~Andrew

#66 lore raw

PATCH 36/57 tools/xenstore: Cleanup makefile

In reply to Anthony PERARD

Regroup *FLAGS together, use $(LDLIBS).

Remove $(LDLIBS_xenstored) which was the wrong name name as it doesn't decribe how to link to a potential libxenstored.so, instead add the value to $(LDLIBS) of xenstored.

Add SYSTEMD_LIBS into $(LDLIBS) instead of $(LDFLAGS).

Remove the "-I." from $(CFLAGS), it shouldn't be needed.

Removed $(CFLAGS-y) and $(LDFLAGS-y). $(CFLAGS-y) is already included in $(CFLAGS) and both aren't used anyway.

Rename ALL_TARGETS to TARGETS.
Only add programmes we want to build in $(TARGETS), not phony-targets (replace "clients").

Store all xenstored objs into $(XENSTORED_OBJS-y).

Replace one $< by $^ even if there's only one dependency, (xenstore-control).

clean: "init-xenstore-domain" isn't built here, so stop trying to remove it, remove $(TARGETS).

---
 tools/xenstore/Makefile | 81 ++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 37 deletions(-)
tools/xenstore/Makefile +44 -37
index 292b478fa1..7fe1d9c1e2 100644
@@ -5,7 +5,6 @@ MAJOR = 3.0
 MINOR = 3
 
 CFLAGS += -Werror
-CFLAGS += -I.
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += -I./include
@@ -16,36 +15,53 @@ CFLAGS += $(CFLAGS_libxentoolcore)
 CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
-CFLAGS  += $(CFLAGS-y)
-LDFLAGS += $(LDFLAGS-y)
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
 
-CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
-CLIENTS += xenstore-write xenstore-ls xenstore-watch
+XENSTORED_OBJS-y := xenstored_core.o xenstored_watch.o xenstored_domain.o
+XENSTORED_OBJS-y += xenstored_transaction.o xenstored_control.o
+XENSTORED_OBJS-y += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o
-XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
-XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
+XENSTORED_OBJS-$(CONFIG_Linux) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_SunOS) += xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+XENSTORED_OBJS-$(CONFIG_NetBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_FreeBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_MiniOS) += xenstored_minios.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
+$(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
 
-XENSTORED_OBJS += $(XENSTORED_OBJS_y)
-LDLIBS_xenstored += -lrt
+xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
+xenstored: LDLIBS += $(LDLIBS_libxengnttab)
+xenstored: LDLIBS += $(LDLIBS_libxenctrl)
+xenstored: LDLIBS += -lrt
+xenstored: LDLIBS += $(SOCKET_LIBS)
 
-ALL_TARGETS = clients
-ifeq ($(XENSTORE_XENSTORED),y)
-ALL_TARGETS += xs_tdb_dump xenstored
+ifeq ($(CONFIG_SYSTEMD),y)
+$(XENSTORED_OBJS-y): CFLAGS += $(SYSTEMD_CFLAGS)
+xenstored: LDLIBS += $(SYSTEMD_LIBS)
 endif
 
-ifdef CONFIG_STUBDOM
-CFLAGS += -DNO_SOCKETS=1
+xenstore: LDLIBS += $(LDLIBS_libxenstore)
+xenstore: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore: LDLIBS += $(SOCKET_LIBS)
+
+xenstore-control: LDLIBS += $(LDLIBS_libxenstore)
+xenstore-control: LDLIBS += $(LDLIBS_libxenctrl)
+xenstore-control: LDLIBS += $(LDLIBS_libxenguest)
+xenstore-control: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore-control: LDLIBS += $(SOCKET_LIBS)
+
+CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
+CLIENTS += xenstore-write xenstore-ls xenstore-watch
+
+TARGETS := xenstore $(CLIENTS) xenstore-control
+ifeq ($(XENSTORE_XENSTORED),y)
+TARGETS += xs_tdb_dump xenstored
 endif
 
 .PHONY: all
-all: $(ALL_TARGETS)
+all: $(TARGETS)
 
 .PHONY: clients
 clients: xenstore $(CLIENTS) xenstore-control
@@ -62,37 +78,28 @@ xenstored_probes.o: xenstored_solaris.o
 CFLAGS += -DHAVE_DTRACE=1
 endif
 
-ifeq ($(CONFIG_SYSTEMD),y)
-$(XENSTORED_OBJS): CFLAGS += $(SYSTEMD_CFLAGS)
-xenstored: LDFLAGS += $(SYSTEMD_LIBS)
-endif
-
-$(XENSTORED_OBJS): CFLAGS += $(CFLAGS_libxengnttab)
-
-xenstored: $(XENSTORED_OBJS)
-	$(CC) $^ $(LDFLAGS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxenctrl) $(LDLIBS_xenstored) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+xenstored: $(XENSTORED_OBJS-y)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
-xenstored.a: $(XENSTORED_OBJS)
+xenstored.a: $(XENSTORED_OBJS-y)
 	$(AR) cr $@ $^
 
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
 xenstore: xenstore_client.o xs_lib.o
-	$(CC) $^ $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
 xenstore-control: xenstore_control.o
-	$(CC) $< $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
-	$(CC) $^ $(LDFLAGS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ -o $@ $(APPEND_LDFLAGS)
 
 .PHONY: clean
 clean:
 	rm -f *.a *.o xenstored_probes.h
-	rm -f xenstored
-	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
-	rm -f xenstore $(CLIENTS)
+	rm -f $(TARGETS)
 	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 36/57
#67 lore raw

Re: [XEN PATCH 36/57] tools/xenstore: Cleanup makefile

Quoted 19 lines · Anthony PERARD

Regroup *FLAGS together, use $(LDLIBS).

Remove $(LDLIBS_xenstored) which was the wrong name name as it doesn't decribe how to link to a potential libxenstored.so, instead add the value to $(LDLIBS) of xenstored.

Add SYSTEMD_LIBS into $(LDLIBS) instead of $(LDFLAGS).

Remove the "-I." from $(CFLAGS), it shouldn't be needed.

Removed $(CFLAGS-y) and $(LDFLAGS-y). $(CFLAGS-y) is already included in $(CFLAGS) and both aren't used anyway.

Rename ALL_TARGETS to TARGETS.
Only add programmes we want to build in $(TARGETS), not phony-targets (replace "clients").

Store all xenstored objs into $(XENSTORED_OBJS-y).

Quoted 7 lines

Replace one $< by $^ even if there's only one dependency, (xenstore-control).

clean: "init-xenstore-domain" isn't built here, so stop trying to remove it, remove $(TARGETS).

Juergen

#68 lore raw

Re: [XEN PATCH 36/57] tools/xenstore: Cleanup makefile

In reply to Anthony PERARD
Quoted 17 lines · Anthony PERARD

Regroup *FLAGS together, use $(LDLIBS).

Remove $(LDLIBS_xenstored) which was the wrong name name as it doesn't decribe how to link to a potential libxenstored.so, instead add the value to $(LDLIBS) of xenstored.

Add SYSTEMD_LIBS into $(LDLIBS) instead of $(LDFLAGS).

Remove the "-I." from $(CFLAGS), it shouldn't be needed.

Removed $(CFLAGS-y) and $(LDFLAGS-y). $(CFLAGS-y) is already included in $(CFLAGS) and both aren't used anyway.

Rename ALL_TARGETS to TARGETS.
Only add programmes we want to build in $(TARGETS), not phony-targets (replace "clients").

Quoted 7 lines

Store all xenstored objs into $(XENSTORED_OBJS-y).

Replace one $< by $^ even if there's only one dependency, (xenstore-control).

clean: "init-xenstore-domain" isn't built here, so stop trying to remove it, remove $(TARGETS).

"isn't built here any more".  It was, until c/s 89bf86d1eb4a4

I'll tweak on commit.

~Andrew

#69 lore raw

Re: [XEN PATCH 36/57] tools/xenstore: Cleanup makefile

In reply to Anthony PERARD
Quoted 35 lines · Anthony PERARD

Regroup *FLAGS together, use $(LDLIBS).

Remove $(LDLIBS_xenstored) which was the wrong name name as it doesn't decribe how to link to a potential libxenstored.so, instead add the value to $(LDLIBS) of xenstored.

Add SYSTEMD_LIBS into $(LDLIBS) instead of $(LDFLAGS).

Remove the "-I." from $(CFLAGS), it shouldn't be needed.

Removed $(CFLAGS-y) and $(LDFLAGS-y). $(CFLAGS-y) is already included in $(CFLAGS) and both aren't used anyway.

Rename ALL_TARGETS to TARGETS.
Only add programmes we want to build in $(TARGETS), not phony-targets (replace "clients").

Store all xenstored objs into $(XENSTORED_OBJS-y).

Replace one $< by $^ even if there's only one dependency, (xenstore-control).

clean: "init-xenstore-domain" isn't built here, so stop trying to remove it, remove $(TARGETS).

---
 tools/xenstore/Makefile | 81 ++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 37 deletions(-)
tools/xenstore/Makefile +0 -0
index 292b478fa1..7fe1d9c1e2 100644

tools/xenstore/Makefile MAJOR = 3.0 · line 5

Quoted 1 line
tools/xenstore/Makefile +0 -0
@@ -5,7 +5,6 @@ MAJOR = 3.0
 MINOR = 3

Actually, shouldn't this MAJOR/MINOR be dropped now that libxenstore moved to tools/libs ?

It's definitely wrong now, seeing as we bumped to 4.0 for Xen 4.16.

tools/xenstore/Makefile xenstored_probes.o: xenstored_solaris.o

Quoted 81 lines
tools/xenstore/Makefile +37 -21
 CFLAGS += -Werror
-CFLAGS += -I.
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += -I./include
@@ -16,36 +15,53 @@ CFLAGS += $(CFLAGS_libxentoolcore)
 CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
-CFLAGS  += $(CFLAGS-y)
-LDFLAGS += $(LDFLAGS-y)
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
 
-CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
-CLIENTS += xenstore-write xenstore-ls xenstore-watch
+XENSTORED_OBJS-y := xenstored_core.o xenstored_watch.o xenstored_domain.o
+XENSTORED_OBJS-y += xenstored_transaction.o xenstored_control.o
+XENSTORED_OBJS-y += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o
-XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
-XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
+XENSTORED_OBJS-$(CONFIG_Linux) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_SunOS) += xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+XENSTORED_OBJS-$(CONFIG_NetBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_FreeBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_MiniOS) += xenstored_minios.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
+$(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
 
-XENSTORED_OBJS += $(XENSTORED_OBJS_y)
-LDLIBS_xenstored += -lrt
+xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
+xenstored: LDLIBS += $(LDLIBS_libxengnttab)
+xenstored: LDLIBS += $(LDLIBS_libxenctrl)
+xenstored: LDLIBS += -lrt
+xenstored: LDLIBS += $(SOCKET_LIBS)
 
-ALL_TARGETS = clients
-ifeq ($(XENSTORE_XENSTORED),y)
-ALL_TARGETS += xs_tdb_dump xenstored
+ifeq ($(CONFIG_SYSTEMD),y)
+$(XENSTORED_OBJS-y): CFLAGS += $(SYSTEMD_CFLAGS)
+xenstored: LDLIBS += $(SYSTEMD_LIBS)
 endif
 
-ifdef CONFIG_STUBDOM
-CFLAGS += -DNO_SOCKETS=1
+xenstore: LDLIBS += $(LDLIBS_libxenstore)
+xenstore: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore: LDLIBS += $(SOCKET_LIBS)
+
+xenstore-control: LDLIBS += $(LDLIBS_libxenstore)
+xenstore-control: LDLIBS += $(LDLIBS_libxenctrl)
+xenstore-control: LDLIBS += $(LDLIBS_libxenguest)
+xenstore-control: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore-control: LDLIBS += $(SOCKET_LIBS)
+
+CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
+CLIENTS += xenstore-write xenstore-ls xenstore-watch
+
+TARGETS := xenstore $(CLIENTS) xenstore-control
+ifeq ($(XENSTORE_XENSTORED),y)
+TARGETS += xs_tdb_dump xenstored
 endif
 
 .PHONY: all
-all: $(ALL_TARGETS)
+all: $(TARGETS)
 
 .PHONY: clients
 clients: xenstore $(CLIENTS) xenstore-control
@@ -62,37 +78,28 @@ xenstored_probes.o: xenstored_solaris.o

Urgh - there's a mess in here.

the dtrace line has trailing whitespace, but xenstored_probes.d is going to be clobbered by the dependency file logic.

Given this is utterly broken, perhaps better to drop the CONFIG_SunOS chunk entirely?

Quoted 27 lines
tools/xenstore/Makefile +4 -11
 CFLAGS += -DHAVE_DTRACE=1
 endif
 
-ifeq ($(CONFIG_SYSTEMD),y)
-$(XENSTORED_OBJS): CFLAGS += $(SYSTEMD_CFLAGS)
-xenstored: LDFLAGS += $(SYSTEMD_LIBS)
-endif
-
-$(XENSTORED_OBJS): CFLAGS += $(CFLAGS_libxengnttab)
-
-xenstored: $(XENSTORED_OBJS)
-	$(CC) $^ $(LDFLAGS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxenctrl) $(LDLIBS_xenstored) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+xenstored: $(XENSTORED_OBJS-y)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
-xenstored.a: $(XENSTORED_OBJS)
+xenstored.a: $(XENSTORED_OBJS-y)
 	$(AR) cr $@ $^
 
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
 xenstore: xenstore_client.o xs_lib.o
-	$(CC) $^ $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
 xenstore-control: xenstore_control.o

tools/xenstore/Makefile xenstored_probes.o: xenstored_solaris.o · line 101

Quoted 10 lines
tools/xenstore/Makefile +2 -2
-	$(CC) $< $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
-	$(CC) $^ $(LDFLAGS) -o $@ $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $^ -o $@ $(APPEND_LDFLAGS)
 
 .PHONY: clean
 clean:
 	rm -f *.a *.o xenstored_probes.h

This header file looks wonky to be cleaning.

tools/xenstore/Makefile xenstored_probes.o: xenstored_solaris.o · line 105

Quoted 7 lines
tools/xenstore/Makefile +1 -3
-	rm -f xenstored
-	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
-	rm -f xenstore $(CLIENTS)
+	rm -f $(TARGETS)
 	$(RM) $(DEPS_RM)
 
 .PHONY: distclean

There is some abuse lower down too.  Another local TAGS, but also a tarball rule too, and we probably don't want to be using .SECONDARY:
right at the bottom.

~Andrew

#70 lore raw

Re: [XEN PATCH 36/57] tools/xenstore: Cleanup makefile

Quoted 31 lines · Andrew Cooper
Quoted 30 lines · Anthony PERARD

Regroup *FLAGS together, use $(LDLIBS).

Remove $(LDLIBS_xenstored) which was the wrong name name as it doesn't decribe how to link to a potential libxenstored.so, instead add the value to $(LDLIBS) of xenstored.

Add SYSTEMD_LIBS into $(LDLIBS) instead of $(LDFLAGS).

Remove the "-I." from $(CFLAGS), it shouldn't be needed.

Removed $(CFLAGS-y) and $(LDFLAGS-y). $(CFLAGS-y) is already included in $(CFLAGS) and both aren't used anyway.

Rename ALL_TARGETS to TARGETS.
Only add programmes we want to build in $(TARGETS), not phony-targets (replace "clients").

Store all xenstored objs into $(XENSTORED_OBJS-y).

Replace one $< by $^ even if there's only one dependency, (xenstore-control).

clean: "init-xenstore-domain" isn't built here, so stop trying to remove it, remove $(TARGETS).

---
  tools/xenstore/Makefile | 81 ++++++++++++++++++++++-------------------
  1 file changed, 44 insertions(+), 37 deletions(-)
Quoted 9 lines

tools/xenstore/Makefile MAJOR = 3.0 · line 5

Quoted 6 lines
tools/xenstore/Makefile +0 -0
index 292b478fa1..7fe1d9c1e2 100644
@@ -5,7 +5,6 @@ MAJOR = 3.0
  MINOR = 3

Actually, shouldn't this MAJOR/MINOR be dropped now that libxenstore moved to tools/libs ?

Yes, you are right. They should be dropped.

Quoted 87 lines

It's definitely wrong now, seeing as we bumped to 4.0 for Xen 4.16.

tools/xenstore/Makefile xenstored_probes.o: xenstored_solaris.o

Quoted 81 lines
tools/xenstore/Makefile +37 -21
  CFLAGS += -Werror
-CFLAGS += -I.
  # Include configure output (config.h)
  CFLAGS += -include $(XEN_ROOT)/tools/config.h
  CFLAGS += -I./include
@@ -16,36 +15,53 @@ CFLAGS += $(CFLAGS_libxentoolcore)
  CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
  CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
-CFLAGS  += $(CFLAGS-y)
-LDFLAGS += $(LDFLAGS-y)
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
 
-CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
-CLIENTS += xenstore-write xenstore-ls xenstore-watch
+XENSTORED_OBJS-y := xenstored_core.o xenstored_watch.o xenstored_domain.o
+XENSTORED_OBJS-y += xenstored_transaction.o xenstored_control.o
+XENSTORED_OBJS-y += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o
-XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
-XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
+XENSTORED_OBJS-$(CONFIG_Linux) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_SunOS) += xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+XENSTORED_OBJS-$(CONFIG_NetBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_FreeBSD) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_MiniOS) += xenstored_minios.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
+$(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
 
-XENSTORED_OBJS += $(XENSTORED_OBJS_y)
-LDLIBS_xenstored += -lrt
+xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
+xenstored: LDLIBS += $(LDLIBS_libxengnttab)
+xenstored: LDLIBS += $(LDLIBS_libxenctrl)
+xenstored: LDLIBS += -lrt
+xenstored: LDLIBS += $(SOCKET_LIBS)
 
-ALL_TARGETS = clients
-ifeq ($(XENSTORE_XENSTORED),y)
-ALL_TARGETS += xs_tdb_dump xenstored
+ifeq ($(CONFIG_SYSTEMD),y)
+$(XENSTORED_OBJS-y): CFLAGS += $(SYSTEMD_CFLAGS)
+xenstored: LDLIBS += $(SYSTEMD_LIBS)
  endif
 
-ifdef CONFIG_STUBDOM
-CFLAGS += -DNO_SOCKETS=1
+xenstore: LDLIBS += $(LDLIBS_libxenstore)
+xenstore: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore: LDLIBS += $(SOCKET_LIBS)
+
+xenstore-control: LDLIBS += $(LDLIBS_libxenstore)
+xenstore-control: LDLIBS += $(LDLIBS_libxenctrl)
+xenstore-control: LDLIBS += $(LDLIBS_libxenguest)
+xenstore-control: LDLIBS += $(LDLIBS_libxentoolcore)
+xenstore-control: LDLIBS += $(SOCKET_LIBS)
+
+CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
+CLIENTS += xenstore-write xenstore-ls xenstore-watch
+
+TARGETS := xenstore $(CLIENTS) xenstore-control
+ifeq ($(XENSTORE_XENSTORED),y)
+TARGETS += xs_tdb_dump xenstored
  endif
 
  .PHONY: all
-all: $(ALL_TARGETS)
+all: $(TARGETS)
 
  .PHONY: clients
  clients: xenstore $(CLIENTS) xenstore-control
@@ -62,37 +78,28 @@ xenstored_probes.o: xenstored_solaris.o

Urgh - there's a mess in here.

Quoted 5 lines

the dtrace line has trailing whitespace, but xenstored_probes.d is going to be clobbered by the dependency file logic.

Given this is utterly broken, perhaps better to drop the CONFIG_SunOS chunk entirely?

I've basically asking to do so since 5 years now. Last try wast last year and the DilOS reply was:

we have plans for XEN on 2021 year, but all depends on business needs and investments."

So the same as in 2016 (not there yet, but planning to do so):

i have plans try to return back and look at latest Xen.

At least running xenstored in SunOS has been broken since years now, and I'd like to suggest removing the CONFIG_SunOS parts from it (again).

Juergen

#71 lore raw

PATCH 37/57 tools/xentop: rework makefile

In reply to Anthony PERARD

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.

---
 tools/Makefile        |  2 +-
 tools/xentop/Makefile | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 12 deletions(-)
tools/Makefile +1 -1
index 79b4c7e3de..0c1d8b64a4 100644
@@ -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
 
tools/xentop/Makefile +8 -11
index 0034114684..1e52b29b37 100644
@@ -13,24 +13,23 @@
 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
 
@@ -38,11 +37,9 @@ install: xentop
 uninstall:
 	rm -f $(DESTDIR)$(sbindir)/xentop
 
-endif
-
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS_RM)
+	rm -f $(TARGETS) xentop.o $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
Signature · 1 line
Anthony PERARD
#72 lore raw

Re: [XEN PATCH 37/57] tools/xentop: rework makefile

Quoted 25 lines · Anthony PERARD
tools/xentop/Makefile +2 -7
index 0034114684..1e52b29b37 100644
@@ -13,24 +13,23 @@
 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

tools/xentop/Makefile line 34

Quoted 10 lines
tools/xentop/Makefile +5 -1
+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

$(TARGETS) ?

tools/xentop/Makefile install: xentop · line 42

Quoted 11 lines
tools/xentop/Makefile +1 -3
@@ -38,11 +37,9 @@ install: xentop
 uninstall:
 	rm -f $(DESTDIR)$(sbindir)/xentop
 
-endif
-
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS_RM)
+	rm -f $(TARGETS) xentop.o $(DEPS_RM)

$(RM) *.o ?

~Andrew

Quoted 3 lines
tools/xentop/Makefile +0 -0
 .PHONY: distclean
 distclean: clean
#73 lore raw

PATCH 38/57 tools/xenstrace: rework Makefile

In reply to Anthony PERARD

Remove "build" targets.

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

Cleanup "clean" rule.

---
 tools/xentrace/Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
tools/xentrace/Makefile +5 -6
index 9fb7fc96e7..2b166335dc 100644
@@ -14,14 +14,13 @@ 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)
@@ -43,7 +42,7 @@ endif
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS_RM)
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
Signature · 1 line
Anthony PERARD
#74 lore raw

Re: [XEN PATCH 38/57] tools/xenstrace: rework Makefile

tools/xentrace/Makefile SBIN = xentrace xentrace_setsize · line 26

Quoted 6 lines · Anthony PERARD

.PHONY: install

tools/xentrace/Makefile +1 -1
-install: build
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(bindir)
 	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
 	[ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)

Doesn't this conditional mkdir want to be dropped?

~Andrew

#75 lore raw

PATCH 39/57 libs: Remove both "libs" and "build" target

In reply to Anthony PERARD

"libs" is odd and has been introduced without a reason by c7d3afbb44. Instead, only use "all".

Also remove "build" target as "all" is more appropriate and nothing is using "build" in libs/ in the xen.git repo.

---
 tools/libs/libs.mk        | 12 +++---------
 tools/libs/light/Makefile |  2 +-
 2 files changed, 4 insertions(+), 10 deletions(-)
tools/libs/libs.mk +3 -9
index 996d467346..7c5ae26bbd 100644
@@ -53,13 +53,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: build
-
-.PHONY: build
-build: libs libxen$(LIBNAME).map $(LIBHEADERS)
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
+all: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 headers.chk:
@@ -96,14 +90,14 @@ lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
 ifneq ($(nosharedlibs),y)
-libs: $(PKG_ABI)
+all: $(PKG_ABI)
 $(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst
 	$(ABI_DUMPER) $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR)
 endif
 endif
 
 .PHONY: install
-install: build
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
 	$(INSTALL_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
tools/libs/light/Makefile +1 -1
index fb5a9ca87e..be32d95d39 100644
@@ -187,7 +187,7 @@ 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
 
-build: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
+all: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
 
 $(LIB_OBJS) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok
 
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 39/57
#76 lore raw

Re: [XEN PATCH 39/57] libs: Remove both "libs" and "build" target

Quoted 7 lines · Anthony PERARD

"libs" is odd and has been introduced without a reason by c7d3afbb44. Instead, only use "all".

Also remove "build" target as "all" is more appropriate and nothing is using "build" in libs/ in the xen.git repo.

Juergen

#77 lore raw

PATCH 40/57 libs: rename LDUSELIBS to LDLIBS and use it instead of APPEND_LDFLAGS

In reply to Anthony PERARD

LDLIBS is more appropriate and intended to be used to add library dependencies. APPEND_LDFLAGS wasn't intended to be changed by the build system.

---
 tools/libs/libs.mk        |  4 ++--
 tools/libs/guest/Makefile |  2 +-
 tools/libs/hypfs/Makefile |  2 +-
 tools/libs/light/Makefile | 18 +++++++++---------
 tools/libs/stat/Makefile  |  2 +-
 tools/libs/store/Makefile |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)
tools/libs/libs.mk +2 -2
index 7c5ae26bbd..91d4efeaed 100644
@@ -15,7 +15,7 @@ CFLAGS   += -Werror -Wmissing-prototypes
 CFLAGS   += $(CFLAGS_xeninclude)
 CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
-LDUSELIBS = $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
+LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 
 LIB_OBJS := $(SRCS-y:.c=.o)
 PIC_OBJS := $(SRCS-y:.c=.opic)
@@ -85,7 +85,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) $(LDUSELIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
tools/libs/guest/Makefile +1 -1
index 1f4b7f7c58..636b4ea5cb 100644
@@ -102,7 +102,7 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-libxenguest.so.$(MAJOR).$(MINOR): APPEND_LDFLAGS += $(ZLIB_LIBS) -lz
+libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
 
 -include $(DEPS_INCLUDE)
 
tools/libs/hypfs/Makefile +1 -1
index 39feca87e8..efa955bd50 100644
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 0
 
-APPEND_LDFLAGS += -lz
+LDLIBS += -lz
 
 SRCS-y                 += core.c
 
tools/libs/light/Makefile +9 -9
index be32d95d39..622fa04470 100644
@@ -166,14 +166,14 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-LDUSELIBS-y += $(PTYFUNCS_LIBS)
-LDUSELIBS-$(CONFIG_LIBNL) += $(LIBNL3_LIBS)
-LDUSELIBS-$(CONFIG_Linux) += -luuid
-LDUSELIBS-$(CONFIG_Linux) += -lrt
-LDUSELIBS-$(CONFIG_ARM) += -lfdt
-LDUSELIBS-y += $(PTHREAD_LIBS)
-LDUSELIBS-y += -lyajl
-LDUSELIBS += $(LDUSELIBS-y)
+LDLIBS-y += $(PTYFUNCS_LIBS)
+LDLIBS-$(CONFIG_LIBNL) += $(LIBNL3_LIBS)
+LDLIBS-$(CONFIG_Linux) += -luuid
+LDLIBS-$(CONFIG_Linux) += -lrt
+LDLIBS-$(CONFIG_ARM) += -lfdt
+LDLIBS-y += $(PTHREAD_LIBS)
+LDLIBS-y += -lyajl
+LDLIBS += $(LDLIBS-y)
 
 $(LIB_OBJS) $(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\"
@@ -232,7 +232,7 @@ $(XEN_INCLUDE)/_%.h: _%.h
 	$(call move-if-changed,_$*.h,$(XEN_INCLUDE)/_$*.h)
 
 libxenlight_test.so: $(PIC_OBJS) $(LIBXL_TEST_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDUSELIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 test_%: test_%.o test_common.o libxenlight_test.so
 	$(CC) $(LDFLAGS) -o $@ $^ $(filter-out %libxenlight.so, $(LDLIBS_libxenlight)) $(LDLIBS_libxentoollog) $(LDLIBS_libxentoolcore) -lyajl $(APPEND_LDFLAGS)
tools/libs/stat/Makefile +1 -1
index 01417b5334..c8c81048c0 100644
@@ -26,7 +26,7 @@ SRCS-$(CONFIG_FreeBSD) += xenstat_freebsd.c
 
 LDLIBS-y += -lyajl
 LDLIBS-$(CONFIG_SunOS) += -lkstat
-APPEND_LDFLAGS += $(LDLIBS-y)
+LDLIBS += $(LDLIBS-y)
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
tools/libs/store/Makefile +1 -1
index c208dbb48a..457122a041 100644
@@ -5,7 +5,7 @@ MAJOR = 4
 MINOR = 0
 
 ifeq ($(CONFIG_Linux),y)
-APPEND_LDFLAGS += -ldl
+LDLIBS += -ldl
 endif
 
 SRCS-y   += xs_lib.c
Signature · 1 line
Anthony PERARD
#79 lore raw

PATCH 41/57 libs: Remove need for *installlocal targets

In reply to Anthony PERARD

There is no need for an extra "installlocal" target, we can use double-colon rules instead.

"install-headers" in "libs/store" was introduced for the same reason that "installlocal" exist, so it is replaced as well.

---
 tools/libs/libs.mk        |  4 ++--
 tools/libs/light/Makefile | 10 ++--------
 tools/libs/store/Makefile | 10 ++--------
 3 files changed, 6 insertions(+), 18 deletions(-)
tools/libs/libs.mk +2 -2
index 91d4efeaed..7f2c676be4 100644
@@ -97,7 +97,7 @@ endif
 endif
 
 .PHONY: install
-install: all
+install:: all
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
 	$(INSTALL_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
@@ -108,7 +108,7 @@ install: all
 	$(INSTALL_DATA) $(PKG_CONFIG) $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
-uninstall:
+uninstall::
 	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pc
 	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; done
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
tools/libs/light/Makefile +2 -8
index 622fa04470..5e52db9b30 100644
@@ -243,17 +243,11 @@ libxl-save-helper: $(SAVE_HELPER_OBJS) libxenlight.so
 testidl: testidl.o libxenlight.so
 	$(CC) $(LDFLAGS) -o $@ testidl.o $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) $(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
 
-install: installlocal $(LIBHEADERS)
-
-.PHONY: installlocal
-installlocal: libxl-save-helper
+install:: $(LIBHEADERS) libxl-save-helper
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(LIBEXEC_BIN)
 
-uninstall: uninstalllocal
-
-.PHONY: uninstalllocal
-uninstalllocal:
+uninstall::
 	rm -f $(DESTDIR)$(LIBEXEC_BIN)/libxl-save-helper
 
 clean: cleanlocal
tools/libs/store/Makefile +2 -8
index 457122a041..1bacee6cf1 100644
@@ -32,10 +32,7 @@ endif
 -include $(DEPS_INCLUDE)
 
 .PHONY: install
-install: install-headers
-
-.PHONY: install-headers
-install-headers:
+install::
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xenstore-compat
 	$(INSTALL_DATA) $(XEN_INCLUDE)/xenstore-compat/xs.h $(DESTDIR)$(includedir)/xenstore-compat/xs.h
@@ -44,10 +41,7 @@ install-headers:
 	ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(includedir)/xs_lib.h
 
 .PHONY: uninstall
-uninstall: uninstall-headers
-
-.PHONY: uninstall-headers
-uninstall-headers:
+uninstall::
 	rm -f $(DESTDIR)$(includedir)/xs_lib.h
 	rm -f $(DESTDIR)$(includedir)/xs.h
 	rm -f $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
Signature · 1 line
Anthony PERARD
#80 lore raw

Re: [XEN PATCH 41/57] libs: Remove need for *installlocal targets

Quoted 2 lines · Anthony PERARD

There is no need for an extra "installlocal" target, we can use double-colon rules instead.

Doesn't that mean that with the ultimate goal of including all Makefiles of the tree that all "install" and "uninstall" rules in the tree will have to be double-colon rules? Citing from the make manual:

When a target appears in multiple rules, all the rules must be the same type: all ordinary, or all double-colon.

Quoted 5 lines

"install-headers" in "libs/store" was introduced for the same reason that "installlocal" exist, so it is replaced as well.

With above remark I don't see how tools/libs/stat/Makefile can be left unmodified, as it includes libs.mk and it contains an "intall:" rule.

Juergen

#81 lore raw

Re: [XEN PATCH 41/57] libs: Remove need for *installlocal targets

Quoted 7 lines · Juergen Gross
Quoted 2 lines · Anthony PERARD

There is no need for an extra "installlocal" target, we can use double-colon rules instead.

Doesn't that mean that with the ultimate goal of including all Makefiles of the tree that all "install" and "uninstall" rules in the tree will have to be double-colon rules?

So, the install targets will be double-colon but for a different reason (because of the framework been used). All the "install" target will actually have different name, they will be prefixed by the name of the directory where the Makefile is.

For example, "install" in "xl" will be named "xl/install", but there will be something that will allow to run "make -C xl install" which will call the rule "xl/install".

Quoted 2 lines

With above remark I don't see how tools/libs/stat/Makefile can be left unmodified, as it includes libs.mk and it contains an "intall:" rule.

I've missed that one, just because ./configure doesn't allow to enable the binding...

Thanks,

Signature · 1 line
Anthony PERARD
#82 lore raw

PATCH 42/57 libs,tools/include: Clean "clean" targets

In reply to Anthony PERARD

There is no need for an extra "cleanlocal" target, we can use double-colon rules instead.

Generated headers are now in tools/include/, so remove those file there.

Remove -f flag as it's already in $(RM).

libs.mk:
- don't try to remove "*.rpm" anymore.

libs/light:
- "_paths.*.tmp" isn't created anymore.
- clean "libxenlight_test.so" and "libxl_test_*.opic".

libs/util:
- fix clean of version-script file.

include/xen-foreign:
- remove __pycache__

---
 tools/libs/libs.mk                 |  4 ++--
 tools/include/Makefile             |  1 +
 tools/include/xen-foreign/Makefile |  1 +
 tools/libs/ctrl/Makefile           |  5 +----
 tools/libs/guest/Makefile          |  3 +--
 tools/libs/light/Makefile          | 19 ++++++++-----------
 tools/libs/stat/Makefile           |  5 +----
 tools/libs/util/Makefile           |  7 ++-----
 tools/libs/vchan/Makefile          |  5 +----
 9 files changed, 18 insertions(+), 32 deletions(-)
tools/libs/libs.mk +2 -2
index 7f2c676be4..3078e45cf4 100644
@@ -121,8 +121,8 @@ TAGS:
 	etags -t *.c *.h
 
 .PHONY: clean
-clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
+clean::
+	rm -rf $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(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)
tools/include/Makefile +1 -0
index 42605d46b9..a9c11d06c8 100644
@@ -80,6 +80,7 @@ uninstall:
 clean:
 	rm -rf xen xen-xsm acpi
 	$(MAKE) -C xen-foreign clean
+	rm -f _*.h
 
 .PHONY: dist
 dist: install
tools/include/xen-foreign/Makefile +1 -0
index 6ce51daf5e..b538d0ea94 100644
@@ -13,6 +13,7 @@ clean:
 	rm -f $(headers)
 	rm -f checker checker.c
 	rm -f *.pyc *.o *~
+	rm -rf __pycache__
 
 distclean: clean
 
tools/libs/ctrl/Makefile +1 -4
index 5d866b8d04..a46e30a168 100644
@@ -56,8 +56,5 @@ include $(XEN_ROOT)/tools/libs/libs.mk
 
 -include $(DEPS_INCLUDE)
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenctrl.map
tools/libs/guest/Makefile +1 -2
index 636b4ea5cb..67837c4e73 100644
@@ -106,6 +106,5 @@ libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
 
 -include $(DEPS_INCLUDE)
 
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenguest.map
tools/libs/light/Makefile +8 -11
index 5e52db9b30..719630eda2 100644
@@ -250,17 +250,14 @@ install:: $(LIBHEADERS) libxl-save-helper
 uninstall::
 	rm -f $(DESTDIR)$(LIBEXEC_BIN)/libxl-save-helper
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
-	$(RM) -f _*.h *.o $(CLIENTS)
-	$(RM) -f _*.c *.pyc _paths.*.tmp _*.api-for-check
-	$(RM) -f testidl.c.new testidl.c *.api-ok
-	$(RM) -f $(TEST_PROGS)
-	$(RM) -rf __pycache__
-	$(RM) -f libxenlight.map
-	$(RM) -f $(AUTOSRCS) $(AUTOINCS)
+clean::
+	$(RM) _*.h *.o $(CLIENTS)
+	$(RM) _*.c *.pyc _*.api-for-check
+	$(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
 
 -include $(DEPS_INCLUDE)
tools/libs/stat/Makefile +1 -4
index c8c81048c0..24b5949b3e 100644
@@ -115,10 +115,7 @@ install: install-perl-bindings
 uninstall: uninstall-perl-bindings
 endif
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM)
 	rm -f libxenstat.map
 
tools/libs/util/Makefile +2 -5
index 87425d862a..4e41bc9ff0 100644
@@ -51,8 +51,5 @@ $(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS)
 
 -include $(DEPS_INCLUDE)
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
-	$(RM) -f libxlutil.map
+clean::
+	$(RM) libxenutil.map
tools/libs/vchan/Makefile +1 -4
index df112f1b88..f6f1002800 100644
@@ -13,8 +13,5 @@ NO_HEADERS_CHK := y
 include $(XEN_ROOT)/tools/libs/libs.mk
 -include $(DEPS_INCLUDE)
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenvchan.map
Signature · 1 line
Anthony PERARD
#83 lore raw

Re: [XEN PATCH 42/57] libs,tools/include: Clean "clean" targets

Quoted 15 lines · Anthony PERARD

There is no need for an extra "cleanlocal" target, we can use double-colon rules instead.

Generated headers are now in tools/include/, so remove those file there.

Remove -f flag as it's already in $(RM).

libs.mk:
- don't try to remove "*.rpm" anymore.

libs/light:
- "_paths.*.tmp" isn't created anymore.
- clean "libxenlight_test.so" and "libxl_test_*.opic".

Quoted 7 lines

libs/util:
- fix clean of version-script file.

include/xen-foreign:
- remove __pycache__

Same remark regarding double-colon rules as for last patch.

Juergen

#84 lore raw

PATCH 43/57 libs: Rename $(SRCS-y) to $(OBJS-y)

In reply to Anthony PERARD

The only thing done thing done with $(SRCS-y) is to replace ".c" by ".o". It is more useful to collect which object we want to build as make will figure out how to build it and from which source file.

---
 tools/libs/libs.mk                |   7 +-
 tools/libs/call/Makefile          |  12 +--
 tools/libs/ctrl/Makefile          |  74 +++++++-------
 tools/libs/devicemodel/Makefile   |  12 +--
 tools/libs/evtchn/Makefile        |  12 +--
 tools/libs/foreignmemory/Makefile |  12 +--
 tools/libs/gnttab/Makefile        |  14 +--
 tools/libs/guest/Makefile         |  86 ++++++++--------
 tools/libs/hypfs/Makefile         |   2 +-
 tools/libs/light/Makefile         | 162 +++++++++++++++---------------
 tools/libs/stat/Makefile          |  12 +--
 tools/libs/store/Makefile         |   4 +-
 tools/libs/toolcore/Makefile      |   4 +-
 tools/libs/toollog/Makefile       |   4 +-
 tools/libs/util/Makefile          |  16 +--
 tools/libs/vchan/Makefile         |   4 +-
 16 files changed, 218 insertions(+), 219 deletions(-)
tools/libs/libs.mk +3 -4
index 3078e45cf4..d3b056e799 100644
@@ -17,8 +17,7 @@ CFLAGS   += $(foreach lib, $(USELIBS_$(LIBNAME)), $(CFLAGS_libxen$(lib)))
 
 LDLIBS += $(foreach lib, $(USELIBS_$(LIBNAME)), $(LDLIBS_libxen$(lib)))
 
-LIB_OBJS := $(SRCS-y:.c=.o)
-PIC_OBJS := $(SRCS-y:.c=.opic)
+PIC_OBJS := $(OBJS-y:.o=.opic)
 
 LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
 LIB := lib$(LIB_FILE_NAME).a
@@ -76,7 +75,7 @@ headers.lst: FORCE
 libxen$(LIBNAME).map:
 	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
 
-lib$(LIB_FILE_NAME).a: $(LIB_OBJS)
+lib$(LIB_FILE_NAME).a: $(OBJS-y)
 	$(AR) rc $@ $^
 
 lib$(LIB_FILE_NAME).so: lib$(LIB_FILE_NAME).so.$(MAJOR)
@@ -122,7 +121,7 @@ TAGS:
 
 .PHONY: clean
 clean::
-	rm -rf $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf $(LIB) *~ $(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)
tools/libs/call/Makefile +6 -6
index 93d404b79e..e5cb7c937c 100644
@@ -4,11 +4,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 3
 
-SRCS-y                 += core.c buffer.c
-SRCS-$(CONFIG_Linux)   += linux.c
-SRCS-$(CONFIG_FreeBSD) += freebsd.c
-SRCS-$(CONFIG_SunOS)   += solaris.c
-SRCS-$(CONFIG_NetBSD)  += netbsd.c
-SRCS-$(CONFIG_MiniOS)  += minios.c
+OBJS-y                 += core.o buffer.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/ctrl/Makefile +37 -37

80 lines not on this page · raw message

tools/libs/devicemodel/Makefile +6 -6
index 3e50ff6d90..a0a2d24f99 100644
@@ -4,11 +4,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 4
 
-SRCS-y                 += core.c
-SRCS-$(CONFIG_Linux)   += common.c
-SRCS-$(CONFIG_FreeBSD) += common.c
-SRCS-$(CONFIG_SunOS)   += compat.c
-SRCS-$(CONFIG_NetBSD)  += compat.c
-SRCS-$(CONFIG_MiniOS)  += compat.c
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += common.o
+OBJS-$(CONFIG_FreeBSD) += common.o
+OBJS-$(CONFIG_SunOS)   += compat.o
+OBJS-$(CONFIG_NetBSD)  += compat.o
+OBJS-$(CONFIG_MiniOS)  += compat.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/evtchn/Makefile +6 -6
index b8c37b5b97..8208ecf650 100644
@@ -4,11 +4,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 
-SRCS-y                 += core.c
-SRCS-$(CONFIG_Linux)   += linux.c
-SRCS-$(CONFIG_FreeBSD) += freebsd.c
-SRCS-$(CONFIG_SunOS)   += solaris.c
-SRCS-$(CONFIG_NetBSD)  += netbsd.c
-SRCS-$(CONFIG_MiniOS)  += minios.c
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/foreignmemory/Makefile +6 -6
index 0eb9a3a712..4427435932 100644
@@ -4,11 +4,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 4
 
-SRCS-y                 += core.c
-SRCS-$(CONFIG_Linux)   += linux.c
-SRCS-$(CONFIG_FreeBSD) += freebsd.c
-SRCS-$(CONFIG_SunOS)   += compat.c solaris.c
-SRCS-$(CONFIG_NetBSD)  += netbsd.c
-SRCS-$(CONFIG_MiniOS)  += minios.c
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += compat.o solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/gnttab/Makefile +7 -7
index ae390ce60f..7d7aeeadff 100644
@@ -4,13 +4,13 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 
-SRCS-GNTTAB            += gnttab_core.c
-SRCS-GNTSHR            += gntshr_core.c
+OBJS-GNTTAB            += gnttab_core.o
+OBJS-GNTSHR            += gntshr_core.o
 
-SRCS-$(CONFIG_Linux)   += $(SRCS-GNTTAB) $(SRCS-GNTSHR) linux.c
-SRCS-$(CONFIG_MiniOS)  += $(SRCS-GNTTAB) gntshr_unimp.c minios.c
-SRCS-$(CONFIG_FreeBSD) += $(SRCS-GNTTAB) $(SRCS-GNTSHR) freebsd.c
-SRCS-$(CONFIG_NetBSD)  += $(SRCS-GNTTAB) $(SRCS-GNTSHR) netbsd.c
-SRCS-$(CONFIG_SunOS)   += gnttab_unimp.c gntshr_unimp.c
+OBJS-$(CONFIG_Linux)   += $(OBJS-GNTTAB) $(OBJS-GNTSHR) linux.o
+OBJS-$(CONFIG_MiniOS)  += $(OBJS-GNTTAB) gntshr_unimp.o minios.o
+OBJS-$(CONFIG_FreeBSD) += $(OBJS-GNTTAB) $(OBJS-GNTSHR) freebsd.o
+OBJS-$(CONFIG_NetBSD)  += $(OBJS-GNTTAB) $(OBJS-GNTSHR) netbsd.o
+OBJS-$(CONFIG_SunOS)   += gnttab_unimp.o gntshr_unimp.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/guest/Makefile +43 -43

112 lines not on this page · raw message

tools/libs/hypfs/Makefile +1 -1
index efa955bd50..630e1e6f3e 100644
@@ -6,6 +6,6 @@ MINOR    = 0
 
 LDLIBS += -lz
 
-SRCS-y                 += core.c
+OBJS-y += core.o
 
 include ../libs.mk
tools/libs/light/Makefile +81 -81

216 lines not on this page · raw message

tools/libs/stat/Makefile +6 -6
index 24b5949b3e..e39fe29bd1 100644
@@ -17,12 +17,12 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-SRCS-y += xenstat.c
-SRCS-y += xenstat_qmp.c
-SRCS-$(CONFIG_Linux) += xenstat_linux.c
-SRCS-$(CONFIG_SunOS) += xenstat_solaris.c
-SRCS-$(CONFIG_NetBSD) += xenstat_netbsd.c
-SRCS-$(CONFIG_FreeBSD) += xenstat_freebsd.c
+OBJS-y += xenstat.o
+OBJS-y += xenstat_qmp.o
+OBJS-$(CONFIG_Linux) += xenstat_linux.o
+OBJS-$(CONFIG_SunOS) += xenstat_solaris.o
+OBJS-$(CONFIG_NetBSD) += xenstat_netbsd.o
+OBJS-$(CONFIG_FreeBSD) += xenstat_freebsd.o
 
 LDLIBS-y += -lyajl
 LDLIBS-$(CONFIG_SunOS) += -lkstat
tools/libs/store/Makefile +2 -2
index 1bacee6cf1..6cc9baaabe 100644
@@ -8,8 +8,8 @@ ifeq ($(CONFIG_Linux),y)
 LDLIBS += -ldl
 endif
 
-SRCS-y   += xs_lib.c
-SRCS-y   += xs.c
+OBJS-y   += xs_lib.o
+OBJS-y   += xs.o
 
 LIBHEADER = xenstore.h xenstore_lib.h
 
tools/libs/toolcore/Makefile +2 -2
index 3550786491..632048c899 100644
@@ -7,13 +7,13 @@ AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
 LIBHEADER := xentoolcore.h xentoolcore_internal.h
 
-SRCS-y	+= handlereg.c
+OBJS-y	+= handlereg.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 PKG_CONFIG_DESC := Central support for Xen Hypervisor userland libraries
 
-$(LIB_OBJS): $(AUTOINCS)
+$(OBJS-y): $(AUTOINCS)
 $(PIC_OBJS): $(AUTOINCS)
 
 $(XEN_INCLUDE)/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
tools/libs/toollog/Makefile +2 -2
index dce1b2de85..c09aa02ba5 100644
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR	= 1
 MINOR	= 0
 
-SRCS-y	+= xtl_core.c
-SRCS-y	+= xtl_logger_stdio.c
+OBJS-y	+= xtl_core.o
+OBJS-y	+= xtl_logger_stdio.o
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/util/Makefile +8 -8
index 4e41bc9ff0..17b95f7c71 100644
@@ -1,13 +1,13 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-SRCS-y += libxlu_cfg_y.c
-SRCS-y += libxlu_cfg_l.c
-SRCS-y += libxlu_cfg.c
-SRCS-y += libxlu_disk_l.c
-SRCS-y += libxlu_disk.c
-SRCS-y += libxlu_vif.c
-SRCS-y += libxlu_pci.c
+OBJS-y += libxlu_cfg_y.o
+OBJS-y += libxlu_cfg_l.o
+OBJS-y += libxlu_cfg.o
+OBJS-y += libxlu_disk_l.o
+OBJS-y += libxlu_disk.o
+OBJS-y += libxlu_vif.o
+OBJS-y += libxlu_pci.o
 
 CFLAGS += -Wno-format-zero-length -Wmissing-declarations \
 	-Wno-declaration-after-statement -Wformat-nonliteral
@@ -39,7 +39,7 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS)
+$(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
tools/libs/vchan/Makefile +2 -2
index f6f1002800..a41f3623c8 100644
@@ -5,8 +5,8 @@ CFLAGS += $(CFLAGS_libxenctrl)
 
 LIBHEADER := libxenvchan.h
 
-SRCS-y += init.c
-SRCS-y += io.c
+OBJS-y += init.o
+OBJS-y += io.o
 
 NO_HEADERS_CHK := y
 
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 43/57
#85 lore raw

Re: [XEN PATCH 43/57] libs: Rename $(SRCS-y) to $(OBJS-y)

Quoted 5 lines · Anthony PERARD

The only thing done thing done with $(SRCS-y) is to replace ".c" by ".o". It is more useful to collect which object we want to build as make will figure out how to build it and from which source file.

Juergen

#86 lore raw

PATCH 44/57 libs/guest: rename ELF_OBJS to LIBELF_OBJS

In reply to Anthony PERARD

It seems a better name. Latter, we will introduce LIBX86_OBJS to collect lib/x86/* objects.

---
 tools/libs/guest/Makefile | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
tools/libs/guest/Makefile +4 -5
index 455e23c432..770b9a7ef1 100644
@@ -33,13 +33,12 @@ CFLAGS += -I$(XEN_libxenctrl)
 vpath %.c ../../../xen/common/libelf
 CFLAGS += -I../../../xen/common/libelf
 
-ELF_OBJS-y += libelf-tools.o libelf-loader.o
-ELF_OBJS-y += libelf-dominfo.o
+LIBELF_OBJS += libelf-tools.o libelf-loader.o
+LIBELF_OBJS += libelf-dominfo.o
 
-OBJS-y += $(ELF_OBJS-y)
+OBJS-y += $(LIBELF_OBJS)
 
-$(ELF_OBJS-y): CFLAGS += -Wno-pointer-sign
-$(ELF_OBJS-y:.o=.opic): CFLAGS += -Wno-pointer-sign
+$(LIBELF_OBJS) $(LIBELF_OBJS:.o=.opic): CFLAGS += -Wno-pointer-sign
 
 ifeq ($(CONFIG_X86),y) # Add libx86 to the build
 vpath %.c ../../../xen/lib/x86
Signature · 1 line
Anthony PERARD
#88 lore raw

PATCH 45/57 libs/guest: rework CFLAGS

In reply to Anthony PERARD

Remove '-Werror -Wmissing-progress -I./include $(CFLAGS_xeninclude)', those flags are already added via "libs.mk".

Flag "-I." isn't needed, we just need to fix the #include of "xg_core.h" as this header isn't expected to be installed.

Make use of "-iquote" instead of '-I' for double-quote included headers.

Also, regroup the CFLAGS into the same place in the makefile.

---
 tools/libs/guest/Makefile          | 20 +++++++++-----------
 tools/libs/guest/xg_offline_page.c |  2 +-
 2 files changed, 10 insertions(+), 12 deletions(-)
tools/libs/guest/Makefile +9 -11
index 770b9a7ef1..62b8fead86 100644
@@ -28,18 +28,13 @@ OBJS-y       += xg_core.o
 OBJS-$(CONFIG_X86) += xg_core_x86.o
 OBJS-$(CONFIG_ARM) += xg_core_arm.o
 
-CFLAGS += -I$(XEN_libxenctrl)
-
 vpath %.c ../../../xen/common/libelf
-CFLAGS += -I../../../xen/common/libelf
 
 LIBELF_OBJS += libelf-tools.o libelf-loader.o
 LIBELF_OBJS += libelf-dominfo.o
 
 OBJS-y += $(LIBELF_OBJS)
 
-$(LIBELF_OBJS) $(LIBELF_OBJS:.o=.opic): CFLAGS += -Wno-pointer-sign
-
 ifeq ($(CONFIG_X86),y) # Add libx86 to the build
 vpath %.c ../../../xen/lib/x86
 
@@ -70,10 +65,12 @@ OBJS-y                 += xg_dom_decompress_unsafe_xz.o
 OBJS-y                 += xg_dom_decompress_unsafe_zstd.o
 endif
 
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I. -I./include $(CFLAGS_xeninclude)
-CFLAGS   += -D__XEN_TOOLS__
-CFLAGS   += -include $(XEN_ROOT)/tools/config.h
+CFLAGS += -D__XEN_TOOLS__
+CFLAGS += -include $(XEN_ROOT)/tools/config.h
+CFLAGS += -iquote ../../../xen/common/libelf
+
+# To be able to include xc_private.h
+CFLAGS += -iquote $(XEN_libxenctrl)
 
 # Needed for posix_fadvise64() in xc_linux.c
 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
@@ -92,8 +89,9 @@ ZLIB_CFLAGS :=
 ZLIB_LIBS :=
 endif
 
-xg_dom_bzimageloader.o: CFLAGS += $(ZLIB_CFLAGS)
-xg_dom_bzimageloader.opic: CFLAGS += $(ZLIB_CFLAGS)
+xg_dom_bzimageloader.o xg_dom_bzimageloader.opic: CFLAGS += $(ZLIB_CFLAGS)
+
+$(LIBELF_OBJS) $(LIBELF_OBJS:.o=.opic): CFLAGS += -Wno-pointer-sign
 
 LIBHEADER := xenguest.h
 
tools/libs/guest/xg_offline_page.c +1 -1
index cfe0e2d537..c594fdba41 100644
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/time.h>
-#include <xg_core.h>
+#include "xg_core.h"
 
 #include "xc_private.h"
 #include "xg_private.h"
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 45/57
#89 lore raw

Re: [XEN PATCH 45/57] libs/guest: rework CFLAGS

Quoted 6 lines · Anthony PERARD

Remove '-Werror -Wmissing-progress -I./include $(CFLAGS_xeninclude)', those flags are already added via "libs.mk".

Flag "-I." isn't needed, we just need to fix the #include of "xg_core.h" as this header isn't expected to be installed.

Quoted 6 lines

Make use of "-iquote" instead of '-I' for double-quote included headers.

Also, regroup the CFLAGS into the same place in the makefile.

Juergen

#90 lore raw

PATCH 46/57 libs/store: use of -iquote instead of -I

In reply to Anthony PERARD
---
 tools/libs/store/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/store/Makefile +1 -1
index 6cc9baaabe..65092d8432 100644
@@ -22,7 +22,7 @@ CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
 vpath xs_lib.c $(XEN_ROOT)/tools/xenstore
-CFLAGS += -I $(XEN_ROOT)/tools/xenstore
+CFLAGS += -iquote $(XEN_ROOT)/tools/xenstore
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
Signature · 1 line
Anthony PERARD
#92 lore raw

PATCH 47/57 libs/stat: Fix and rework python-bindings build

In reply to Anthony PERARD

Fix the dependency on the library, $(SHLIB) variable doesn't exist anymore.

Rework dependency on the include file, we can let swig generate the dependency for us with the use of "-M*" flags.

The xenstat.h file has moved so we need to fix the include location.

Rather than relaying on the VCS to create an empty directory for us, we can create one before generating the *.c file for the bindings.

Make use of generic variable names to build a shared library from a source file: CFLAGS, LDFLAGS, and LDLIBS.

Fix python's specific *flags by using python-config, and add them to generic flags variables: CFLAGS, LDLIBS.

To build a shared library, we need to build the source file with "-fPIC", which was drop by 6d0ec05390 (tools: split libxenstat into new tools/libs/stat directory).

The source file generated by swig seems to be missing a prototype for the "init" function, so we need "-Wno-missing-prototypes" in order to build it.

Add some targets to .PHONY.

---
 tools/libs/stat/Makefile                    | 27 +++++++++++++++------
 tools/libs/stat/bindings/swig/python/.empty |  1 -
 2 files changed, 19 insertions(+), 9 deletions(-)
 delete mode 100644 tools/libs/stat/bindings/swig/python/.empty
tools/libs/stat/Makefile +19 -8
index e39fe29bd1..d5d9cb3659 100644
@@ -49,23 +49,34 @@ install-bindings: install-perl-bindings install-python-bindings
 .PHONY: uninstall-bindings
 uninstall-bindings: uninstall-perl-bindings uninstall-python-bindings
 
-$(BINDINGS): $(SHLIB) $(SHLIB_LINKS) include/xenstat.h
+$(BINDINGS): libxenstat.so
 
-SWIG_FLAGS=-module xenstat -Iinclude -I.
+SWIG_FLAGS = -module xenstat -I$(XEN_INCLUDE)
+SWIG_FLAGS += -MMD -MP -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d
 
 # Python bindings
-PYTHON_VERSION=$(PYTHON:python%=%)
-PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
 $(PYMOD): $(PYSRC)
 $(PYSRC): bindings/swig/xenstat.i
-	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
-
+	mkdir -p $(@D)
+	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $@ $<
+
+$(PYLIB): CFLAGS += $(shell $(PYTHON)-config --includes)
+$(PYLIB): CFLAGS += -fPIC
+$(PYLIB): CFLAGS += -Wno-missing-prototypes
+$(PYLIB): LDFLAGS += $(SHLIB_LDFLAGS)
+$(PYLIB): LDLIBS := $(shell $(PYTHON)-config --libs)
+$(PYLIB): LDLIBS += $(LDLIBS_libxenstat)
 $(PYLIB): $(PYSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(APPEND_LDFLAGS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
+.PHONY: python-bindings
 python-bindings: $(PYLIB) $(PYMOD)
 
-pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
+pythonlibdir = $(shell $(PYTHON) -c \
+	       'import distutils.sysconfig as cfg; \
+	        print(cfg.get_python_lib(False, False, prefix="$(prefix)"))')
+
+.PHONY: install-python-bindings
 install-python-bindings: $(PYLIB) $(PYMOD)
 	$(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
 	$(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
tools/libs/stat/bindings/swig/python/.empty deleted +0 -1
deleted file mode 100644
index 2a8dd4274d..0000000000
@@ -1 +0,0 @@
-This directory is empty; this file is included to prevent version control systems from removing the directory.
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 47/57
#93 lore raw

Re: [XEN PATCH 47/57] libs/stat: Fix and rework python-bindings build

Quoted 21 lines · Anthony PERARD

Fix the dependency on the library, $(SHLIB) variable doesn't exist anymore.

Rework dependency on the include file, we can let swig generate the dependency for us with the use of "-M*" flags.

The xenstat.h file has moved so we need to fix the include location.

Rather than relaying on the VCS to create an empty directory for us, we can create one before generating the *.c file for the bindings.

Make use of generic variable names to build a shared library from a source file: CFLAGS, LDFLAGS, and LDLIBS.

Fix python's specific *flags by using python-config, and add them to generic flags variables: CFLAGS, LDLIBS.

To build a shared library, we need to build the source file with "-fPIC", which was drop by 6d0ec05390 (tools: split libxenstat into new tools/libs/stat directory).

Quoted 7 lines

The source file generated by swig seems to be missing a prototype for the "init" function, so we need "-Wno-missing-prototypes" in order to build it.

Add some targets to .PHONY.

Juergen

#94 lore raw

Re: [XEN PATCH 47/57] libs/stat: Fix and rework python-bindings build

In reply to Anthony PERARD
Quoted 5 lines · Anthony PERARD

Fix the dependency on the library, $(SHLIB) variable doesn't exist anymore.

Rework dependency on the include file, we can let swig generate the dependency for us with the use of "-M*" flags.

Hmm.  At no point is swig mentioned in README/etc, and it's not in any of the CI logic.  I wasn't even aware that we had python bindings here.

Unless someone tries and confirms them not to be broken, I'd be tempted to drop it all.  I bet this has been dead since we dropped Xend.

~Andrew

#95 lore raw

Re: [XEN PATCH 47/57] libs/stat: Fix and rework python-bindings build

Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Anthony PERARD

Fix the dependency on the library, $(SHLIB) variable doesn't exist anymore.

Quoted 8 lines
Quoted 2 lines

Rework dependency on the include file, we can let swig generate the dependency for us with the use of "-M*" flags.

Hmm.  At no point is swig mentioned in README/etc, and it's not in any of the CI logic.  I wasn't even aware that we had python bindings here.

Unless someone tries and confirms them not to be broken, I'd be tempted to drop it all.  I bet this has been dead since we dropped Xend.

How about the perl binding? Nothing to do with xend for them.

The only way to build the binding is to set a variable. It's not possible to enable the binding via ./configure at the moment. So, yes, maybe no one uses them.

Cheers,

Signature · 1 line
Anthony PERARD
#96 lore raw

PATCH 48/57 libs/stat: Fix and rework perl-binding build

In reply to Anthony PERARD

For PERL_FLAGS, use make's shell rather than a backquote.

Rather than relying on the VCS to create an empty directory for us, we can create one before generating the *.c file for the bindings.

Make use of generic variable names to build a shared library from a source file: CFLAGS, LDFLAGS, and LDLIBS.

To build a shared library, we need to build the source file with "-fPIC", which was drop by 6d0ec05390 (tools: split libxenstat into new tools/libs/stat directory).

The source file generated by swig seems to be missing many prototype for many functions, so we need "-Wno-missing-prototypes" in order to build it. Also, one of the prototype is deemed malformed, so we also need "-Wno-strict-prototypes".

---
 tools/libs/stat/Makefile                  | 15 +++++++++++----
 tools/libs/stat/bindings/swig/perl/.empty |  1 -
 2 files changed, 11 insertions(+), 5 deletions(-)
 delete mode 100644 tools/libs/stat/bindings/swig/perl/.empty
tools/libs/stat/Makefile +11 -4
index d5d9cb3659..962f02090b 100644
@@ -94,13 +94,20 @@ uninstall: uninstall-python-bindings
 endif
 
 # Perl bindings
-PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
+PERL_FLAGS = $(shell $(PERL) -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";')
 $(PERLMOD): $(PERLSRC)
 $(PERLSRC): bindings/swig/xenstat.i
-	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
-
+	mkdir -p $(@D)
+	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $@ $<
+
+$(PERLLIB): CFLAGS += -fPIC
+$(PERLLIB): CFLAGS += -Wno-strict-prototypes
+$(PERLLIB): CFLAGS += -Wno-missing-prototypes
+$(PERLLIB): LDFLAGS += $(PERL_FLAGS)
+$(PERLLIB): LDFLAGS += $(SHLIB_LDFLAGS)
+$(PERLLIB): LDLIBS := $(LDLIBS_libxenstat)
 $(PERLLIB): $(PERLSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(APPEND_LDFLAGS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 .PHONY: perl-bindings
 perl-bindings: $(PERLLIB) $(PERLMOD)
tools/libs/stat/bindings/swig/perl/.empty deleted +0 -1
deleted file mode 100644
index 2a8dd4274d..0000000000
@@ -1 +0,0 @@
-This directory is empty; this file is included to prevent version control systems from removing the directory.
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 48/57
#97 lore raw

Re: [XEN PATCH 48/57] libs/stat: Fix and rework perl-binding build

Quoted 12 lines · Anthony PERARD

For PERL_FLAGS, use make's shell rather than a backquote.

Rather than relying on the VCS to create an empty directory for us, we can create one before generating the *.c file for the bindings.

Make use of generic variable names to build a shared library from a source file: CFLAGS, LDFLAGS, and LDLIBS.

To build a shared library, we need to build the source file with "-fPIC", which was drop by 6d0ec05390 (tools: split libxenstat into new tools/libs/stat directory).

Quoted 6 lines

The source file generated by swig seems to be missing many prototype for many functions, so we need "-Wno-missing-prototypes" in order to build it. Also, one of the prototype is deemed malformed, so we also need "-Wno-strict-prototypes".

Juergen

#98 lore raw

PATCH 49/57 libs/toolcore: don't install xentoolcore_internal.h anymore

In reply to Anthony PERARD

With "xentoolcore_internal.h" been in LIBHEADER, it was installed. But its dependency "_xentoolcore_list.h" wasn't installed so the header couldn't be used anyway.

This patch also mean that the rule "headers.chk" doesn't check it anymore as well.

---
 tools/libs/toolcore/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/toolcore/Makefile +1 -1
index 632048c899..360a10e5da 100644
@@ -5,7 +5,7 @@ MAJOR	= 1
 MINOR	= 0
 AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
-LIBHEADER := xentoolcore.h xentoolcore_internal.h
+LIBHEADER := xentoolcore.h
 
 OBJS-y	+= handlereg.o
 
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 49/57
#99 lore raw

Re: [XEN PATCH 49/57] libs/toolcore: don't install xentoolcore_internal.h anymore

Quoted 8 lines · Anthony PERARD

With "xentoolcore_internal.h" been in LIBHEADER, it was installed. But its dependency "_xentoolcore_list.h" wasn't installed so the header couldn't be used anyway.

This patch also mean that the rule "headers.chk" doesn't check it anymore as well.

Juergen

#100 lore raw

PATCH 50/57 tools/Rules.mk: Cleanup %.pc rules

In reply to Anthony PERARD

PKG_CONFIG_VARS isn't used anymore.
For "local" pkg-config file, we only have one headers directory now, "tools/include", so there is no need to specify it twice. So remove $(CFLAGS_xeninclude) from "Cflags:".

---
 tools/Rules.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/Rules.mk +1 -3
index 0d3febfbb6..47424935ba 100644
@@ -184,12 +184,11 @@ $(PKG_CONFIG_DIR)/%.pc: Makefile $(XEN_ROOT)/tools/Rules.mk $(PKG_CONFIG_DIR)
 	echo "prefix=$(PKG_CONFIG_PREFIX)"; \
 	echo "includedir=$(PKG_CONFIG_INCDIR)"; \
 	echo "libdir=$(PKG_CONFIG_LIBDIR)"; \
-	$(foreach var,$(PKG_CONFIG_VARS),echo $(var);) \
 	echo ""; \
 	echo "Name: $(PKG_CONFIG_NAME)"; \
 	echo "Description: $(PKG_CONFIG_DESC)"; \
 	echo "Version: $(PKG_CONFIG_VERSION)"; \
-	echo "Cflags: -I\$${includedir} $(CFLAGS_xeninclude)"; \
+	echo "Cflags: -I\$${includedir}"; \
 	echo "Libs: -L\$${libdir} $(PKG_CONFIG_USELIBS) -l$(PKG_CONFIG_LIB)"; \
 	echo "Libs.private: $(PKG_CONFIG_LIBSPRIV)"; \
 	echo "Requires.private: $(PKG_CONFIG_REQPRIV)"; \
@@ -200,7 +199,6 @@ $(PKG_CONFIG_DIR)/%.pc: Makefile $(XEN_ROOT)/tools/Rules.mk $(PKG_CONFIG_DIR)
 	echo "prefix=$(PKG_CONFIG_PREFIX)"; \
 	echo "includedir=$(PKG_CONFIG_INCDIR)"; \
 	echo "libdir=$(PKG_CONFIG_LIBDIR)"; \
-	$(foreach var,$(PKG_CONFIG_VARS),echo $(var);) \
 	echo ""; \
 	echo "Name: $(PKG_CONFIG_NAME)"; \
 	echo "Description: $(PKG_CONFIG_DESC)"; \
Signature · 1 line
Anthony PERARD
#101 lore raw

Re: [XEN PATCH 50/57] tools/Rules.mk: Cleanup %.pc rules

Quoted 1 line · Anthony PERARD

PKG_CONFIG_VARS isn't used anymore.

isn't set any more, so is dead logic.

Will tweak on commit.

~Andrew

#102 lore raw

PATCH 51/57 .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc}

In reply to Anthony PERARD
---
 .gitignore | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
.gitignore +2 -26
index 8fb74a4c94..d494d1125a 100644
@@ -105,26 +105,10 @@ 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/*/headers.chk
+tools/libs/*/*.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
@@ -144,21 +128,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/console/client/xenconsole
 tools/console/daemon/xenconsoled
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
Signature · 1 line
Anthony PERARD
#103 lore raw

PATCH 52/57 stubdom: only build libxen*.a from tools/libs/

In reply to Anthony PERARD

Avoid generating *.map files or running headers.chk when all we need is the libxen*.a.

Also, allow force make to check again if libxen*.a needs rebuilt by adding a '.PHONY' prerequisite.

Also, remove DESTDIR= as we don't do installation in this target, so the value of DESTDIR doesn't matter.

---
 stubdom/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
stubdom/Makefile +2 -2
index ccfcf5b75f..5fb5dbc341 100644
@@ -354,8 +354,8 @@ define BUILD_lib
  .PHONY: libxen$(1) clean-libxen$(1)
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
- libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE)
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) DESTDIR= CONFIG_LIBXC_MINIOS=y -C libs-$$(XEN_TARGET_ARCH)/$(1)
+ libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -C $$(@D) $$(@F)
 
  clean-libxen$(1):
 	[ ! -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ] || $$(MAKE) DESTDIR= -C libs-$$(XEN_TARGET_ARCH)/$(1) clean
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 52/57
#104 lore raw

Re: [XEN PATCH 52/57] stubdom: only build libxen*.a from tools/libs/

Anthony PERARD, le lun. 06 déc. 2021 17:02:35 +0000, a ecrit:

Quoted 10 lines

Avoid generating *.map files or running headers.chk when all we need is the libxen*.a.

Also, allow force make to check again if libxen*.a needs rebuilt by adding a '.PHONY' prerequisite.

Also, remove DESTDIR= as we don't do installation in this target, so the value of DESTDIR doesn't matter.

Quoted 22 lines
---
 stubdom/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
stubdom/Makefile +2 -2
index ccfcf5b75f..5fb5dbc341 100644
@@ -354,8 +354,8 @@ define BUILD_lib
  .PHONY: libxen$(1) clean-libxen$(1)
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
- libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE)
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) DESTDIR= CONFIG_LIBXC_MINIOS=y -C libs-$$(XEN_TARGET_ARCH)/$(1)
+ libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -C $$(@D) $$(@F)
 
  clean-libxen$(1):
 	[ ! -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ] || $$(MAKE) DESTDIR= -C libs-$$(XEN_TARGET_ARCH)/$(1) clean
Signature · 1 line
Anthony PERARD
#105 lore raw

PATCH 53/57 stubdom: introduce xenlibs.mk

In reply to Anthony PERARD

This new makefile will be used to build libraries that provides "Makefile.common".

At some point, we will be converting Makefile in tools/ to "subdirmk" and stubdom build will not be able to use those new makefiles, so we will put the necessary information for stubdom to build the xen libraries into a new Makefile.common and xenlibs.mk will use it. We only need to build static libraries and don't need anything else.

The check for the presence of "Makefile.common" will go aways once there is one for all libraries used by stubdom build.

Also remove DESTDIR= from "clean" targets, we don't do installation in this recipe so the value of DESTDIR doesn't matter.

---
 stubdom/xenlibs.mk | 13 +++++++++++++
 stubdom/Makefile   |  9 +++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 stubdom/xenlibs.mk
stubdom/xenlibs.mk new file +13 -0
new file mode 100644
index 0000000000..5c8742ccf9
@@ -0,0 +1,13 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+include Makefile.common
+
+LIBNAME := $(notdir $(CURDIR))
+FILENAME_$(LIBNAME) ?= xen$(LIBNAME)
+LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
+
+lib$(LIB_FILE_NAME).a: $(OBJS-y)
+	$(AR) rc $@ $^
+
+clean::
+	rm -f $(OBJS-y) lib$(LIB_FILE_NAME).a
stubdom/Makefile +7 -2
index 5fb5dbc341..fba4c977ef 100644
@@ -346,6 +346,7 @@ define do_links
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
   ln -sf $(dir $<)*.[ch] .; \
+  [ -e $(dir $<)Makefile.common ] && ln -sf $(dir $<)Makefile.common . ||:; \
   ln -sf $(dir $<)Makefile .
   touch $@
 endef
@@ -355,10 +356,14 @@ define BUILD_lib
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -C $$(@D) $$(@F)
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y $$(if $$(wildcard $$(@D)/Makefile.common),-f $(CURDIR)/xenlibs.mk) -C $$(@D) $$(@F)
 
  clean-libxen$(1):
-	[ ! -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ] || $$(MAKE) DESTDIR= -C libs-$$(XEN_TARGET_ARCH)/$(1) clean
+	if [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile.common ]; then \
+	    $$(MAKE) -f $(CURDIR)/xenlibs.mk -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+	elif [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ]; then \
+	    $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+	fi
 
  libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile
 	$$(do_links)
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 53/57
#106 lore raw

Re: [XEN PATCH 53/57] stubdom: introduce xenlibs.mk

Anthony PERARD, le lun. 06 déc. 2021 17:02:36 +0000, a ecrit:

Quoted 9 lines

This new makefile will be used to build libraries that provides "Makefile.common".

At some point, we will be converting Makefile in tools/ to "subdirmk" and stubdom build will not be able to use those new makefiles, so we will put the necessary information for stubdom to build the xen libraries into a new Makefile.common and xenlibs.mk will use it. We only need to build static libraries and don't need anything else.

Quoted 7 lines

The check for the presence of "Makefile.common" will go aways once there is one for all libraries used by stubdom build.

Also remove DESTDIR= from "clean" targets, we don't do installation in this recipe so the value of DESTDIR doesn't matter.

Quoted 57 lines
---
 stubdom/xenlibs.mk | 13 +++++++++++++
 stubdom/Makefile   |  9 +++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 stubdom/xenlibs.mk
stubdom/xenlibs.mk new file +13 -0
new file mode 100644
index 0000000000..5c8742ccf9
@@ -0,0 +1,13 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+include Makefile.common
+
+LIBNAME := $(notdir $(CURDIR))
+FILENAME_$(LIBNAME) ?= xen$(LIBNAME)
+LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
+
+lib$(LIB_FILE_NAME).a: $(OBJS-y)
+	$(AR) rc $@ $^
+
+clean::
+	rm -f $(OBJS-y) lib$(LIB_FILE_NAME).a
stubdom/Makefile +7 -2
index 5fb5dbc341..fba4c977ef 100644
@@ -346,6 +346,7 @@ define do_links
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
   ln -sf $(dir $<)*.[ch] .; \
+  [ -e $(dir $<)Makefile.common ] && ln -sf $(dir $<)Makefile.common . ||:; \
   ln -sf $(dir $<)Makefile .
   touch $@
 endef
@@ -355,10 +356,14 @@ define BUILD_lib
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -C $$(@D) $$(@F)
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y $$(if $$(wildcard $$(@D)/Makefile.common),-f $(CURDIR)/xenlibs.mk) -C $$(@D) $$(@F)
 
  clean-libxen$(1):
-	[ ! -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ] || $$(MAKE) DESTDIR= -C libs-$$(XEN_TARGET_ARCH)/$(1) clean
+	if [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile.common ]; then \
+	    $$(MAKE) -f $(CURDIR)/xenlibs.mk -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+	elif [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ]; then \
+	    $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+	fi
 
  libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile
 	$$(do_links)
Signature · 1 line
Anthony PERARD
Signature · 6 lines
Samuel
<y> update-menus: relocation error: update-menus: symbol _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E, version GLIBCPP_3.2 not defined in file libstdc++.so.5 with link time reference
<y> quoi que ça peut bien vouloir dire ?
<D> N a eu la meme merde
<y> c ça que ça veut dire ? wow, c'est bien crypté :)
 -+- #ens-mim s'entraide -+-
#107 lore raw

PATCH 54/57 tools/libs: create Makefile.common to be used by stubdom build system

In reply to Anthony PERARD

This new "Makefile.common" is intended to be used by both tools/ and stubdom/ build system without stubdom needed to use tools/ build system.

It should contain the necessary list of objects and CFLAGS needed to build a static library.

Change stubdom/ to check Makefile.common, for the linkfarm.

---
 stubdom/Makefile                         |  2 +-
 tools/libs/call/Makefile                 |  7 +-
 tools/libs/call/Makefile.common          |  6 ++
 tools/libs/ctrl/Makefile                 | 45 +-----------
 tools/libs/ctrl/Makefile.common          | 44 ++++++++++++
 tools/libs/devicemodel/Makefile          |  7 +-
 tools/libs/devicemodel/Makefile.common   |  6 ++
 tools/libs/evtchn/Makefile               |  7 +-
 tools/libs/evtchn/Makefile.common        |  6 ++
 tools/libs/foreignmemory/Makefile        |  7 +-
 tools/libs/foreignmemory/Makefile.common |  6 ++
 tools/libs/gnttab/Makefile               |  9 +--
 tools/libs/gnttab/Makefile.common        |  8 +++
 tools/libs/guest/Makefile                | 90 +-----------------------
 tools/libs/guest/Makefile.common         | 84 ++++++++++++++++++++++
 tools/libs/toolcore/Makefile             |  8 +--
 tools/libs/toolcore/Makefile.common      |  9 +++
 tools/libs/toollog/Makefile              |  3 +-
 tools/libs/toollog/Makefile.common       |  2 +
 19 files changed, 182 insertions(+), 174 deletions(-)
 create mode 100644 tools/libs/call/Makefile.common
 create mode 100644 tools/libs/ctrl/Makefile.common
 create mode 100644 tools/libs/devicemodel/Makefile.common
 create mode 100644 tools/libs/evtchn/Makefile.common
 create mode 100644 tools/libs/foreignmemory/Makefile.common
 create mode 100644 tools/libs/gnttab/Makefile.common
 create mode 100644 tools/libs/guest/Makefile.common
 create mode 100644 tools/libs/toolcore/Makefile.common
 create mode 100644 tools/libs/toollog/Makefile.common
stubdom/Makefile +1 -1
index fba4c977ef..fbc63a5063 100644
@@ -365,7 +365,7 @@ define BUILD_lib
 	    $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
 	fi
 
- libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile
+ libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile.common
 	$$(do_links)
 endef
 
tools/libs/call/Makefile +1 -6
index e5cb7c937c..103f5ad360 100644
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 3
 
-OBJS-y                 += core.o buffer.o
-OBJS-$(CONFIG_Linux)   += linux.o
-OBJS-$(CONFIG_FreeBSD) += freebsd.o
-OBJS-$(CONFIG_SunOS)   += solaris.o
-OBJS-$(CONFIG_NetBSD)  += netbsd.o
-OBJS-$(CONFIG_MiniOS)  += minios.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/call/Makefile.common new file +6 -0
new file mode 100644
index 0000000000..85e608f8ad
@@ -0,0 +1,6 @@
+OBJS-y                 += core.o buffer.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
tools/libs/ctrl/Makefile +1 -44

51 lines not on this page · raw message

tools/libs/ctrl/Makefile.common new file +44 -0

44 lines not on this page · raw message

tools/libs/devicemodel/Makefile +1 -6
index a0a2d24f99..b70dd774e4 100644
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 4
 
-OBJS-y                 += core.o
-OBJS-$(CONFIG_Linux)   += common.o
-OBJS-$(CONFIG_FreeBSD) += common.o
-OBJS-$(CONFIG_SunOS)   += compat.o
-OBJS-$(CONFIG_NetBSD)  += compat.o
-OBJS-$(CONFIG_MiniOS)  += compat.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/devicemodel/Makefile.common new file +6 -0
new file mode 100644
index 0000000000..a7bf7c35bb
@@ -0,0 +1,6 @@
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += common.o
+OBJS-$(CONFIG_FreeBSD) += common.o
+OBJS-$(CONFIG_SunOS)   += compat.o
+OBJS-$(CONFIG_NetBSD)  += compat.o
+OBJS-$(CONFIG_MiniOS)  += compat.o
tools/libs/evtchn/Makefile +1 -6
index 8208ecf650..3dad3840c6 100644
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 
-OBJS-y                 += core.o
-OBJS-$(CONFIG_Linux)   += linux.o
-OBJS-$(CONFIG_FreeBSD) += freebsd.o
-OBJS-$(CONFIG_SunOS)   += solaris.o
-OBJS-$(CONFIG_NetBSD)  += netbsd.o
-OBJS-$(CONFIG_MiniOS)  += minios.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/evtchn/Makefile.common new file +6 -0
new file mode 100644
index 0000000000..20629f521a
@@ -0,0 +1,6 @@
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
tools/libs/foreignmemory/Makefile +1 -6
index 4427435932..b70dd774e4 100644
@@ -4,11 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 4
 
-OBJS-y                 += core.o
-OBJS-$(CONFIG_Linux)   += linux.o
-OBJS-$(CONFIG_FreeBSD) += freebsd.o
-OBJS-$(CONFIG_SunOS)   += compat.o solaris.o
-OBJS-$(CONFIG_NetBSD)  += netbsd.o
-OBJS-$(CONFIG_MiniOS)  += minios.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/foreignmemory/Makefile.common new file +6 -0
new file mode 100644
index 0000000000..ff3b1d4f3e
@@ -0,0 +1,6 @@
+OBJS-y                 += core.o
+OBJS-$(CONFIG_Linux)   += linux.o
+OBJS-$(CONFIG_FreeBSD) += freebsd.o
+OBJS-$(CONFIG_SunOS)   += compat.o solaris.o
+OBJS-$(CONFIG_NetBSD)  += netbsd.o
+OBJS-$(CONFIG_MiniOS)  += minios.o
tools/libs/gnttab/Makefile +1 -8
index 7d7aeeadff..3dad3840c6 100644
@@ -4,13 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR    = 1
 MINOR    = 2
 
-OBJS-GNTTAB            += gnttab_core.o
-OBJS-GNTSHR            += gntshr_core.o
-
-OBJS-$(CONFIG_Linux)   += $(OBJS-GNTTAB) $(OBJS-GNTSHR) linux.o
-OBJS-$(CONFIG_MiniOS)  += $(OBJS-GNTTAB) gntshr_unimp.o minios.o
-OBJS-$(CONFIG_FreeBSD) += $(OBJS-GNTTAB) $(OBJS-GNTSHR) freebsd.o
-OBJS-$(CONFIG_NetBSD)  += $(OBJS-GNTTAB) $(OBJS-GNTSHR) netbsd.o
-OBJS-$(CONFIG_SunOS)   += gnttab_unimp.o gntshr_unimp.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/gnttab/Makefile.common new file +8 -0
new file mode 100644
index 0000000000..759e36e1cb
@@ -0,0 +1,8 @@
+OBJS-GNTTAB            += gnttab_core.o
+OBJS-GNTSHR            += gntshr_core.o
+
+OBJS-$(CONFIG_Linux)   += $(OBJS-GNTTAB) $(OBJS-GNTSHR) linux.o
+OBJS-$(CONFIG_MiniOS)  += $(OBJS-GNTTAB) gntshr_unimp.o minios.o
+OBJS-$(CONFIG_FreeBSD) += $(OBJS-GNTTAB) $(OBJS-GNTSHR) freebsd.o
+OBJS-$(CONFIG_NetBSD)  += $(OBJS-GNTTAB) $(OBJS-GNTSHR) netbsd.o
+OBJS-$(CONFIG_SunOS)   += gnttab_unimp.o gntshr_unimp.o
tools/libs/guest/Makefile +2 -88

99 lines not on this page · raw message

tools/libs/guest/Makefile.common new file +84 -0

84 lines not on this page · raw message

tools/libs/toolcore/Makefile +1 -7
index 360a10e5da..5b81814e52 100644
@@ -3,19 +3,13 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
-AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
 LIBHEADER := xentoolcore.h
 
-OBJS-y	+= handlereg.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 PKG_CONFIG_DESC := Central support for Xen Hypervisor userland libraries
 
-$(OBJS-y): $(AUTOINCS)
 $(PIC_OBJS): $(AUTOINCS)
-
-$(XEN_INCLUDE)/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-	$(PERL) $^ --prefix=xentoolcore >$(notdir $@).new
-	$(call move-if-changed,$(notdir $@).new,$@)
tools/libs/toolcore/Makefile.common new file +9 -0
new file mode 100644
index 0000000000..4d6c7687f8
@@ -0,0 +1,9 @@
+OBJS-y	+= handlereg.o
+
+AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
+
+$(OBJS-y): $(AUTOINCS)
+
+$(XEN_INCLUDE)/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
+	$(PERL) $^ --prefix=xentoolcore >$(notdir $@).new
+	$(call move-if-changed,$(notdir $@).new,$@)
tools/libs/toollog/Makefile +1 -2
index c09aa02ba5..2361b8cbf1 100644
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR	= 1
 MINOR	= 0
 
-OBJS-y	+= xtl_core.o
-OBJS-y	+= xtl_logger_stdio.o
+include Makefile.common
 
 include $(XEN_ROOT)/tools/libs/libs.mk
tools/libs/toollog/Makefile.common new file +2 -0
new file mode 100644
index 0000000000..c053ac6a73
@@ -0,0 +1,2 @@
+OBJS-y	+= xtl_core.o
+OBJS-y	+= xtl_logger_stdio.o
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 54/57
#108 lore raw

Re: [XEN PATCH 54/57] tools/libs: create Makefile.common to be used by stubdom build system

Quoted 10 lines · Anthony PERARD

This new "Makefile.common" is intended to be used by both tools/ and stubdom/ build system without stubdom needed to use tools/ build system.

It should contain the necessary list of objects and CFLAGS needed to build a static library.

Change stubdom/ to check Makefile.common, for the linkfarm.

Juergen

#109 lore raw

PATCH 55/57 tools/xenstore: introduce Makefile.common to be used by stubdom

In reply to Anthony PERARD

Also change stubdom to depends on Makefile.common.

---
 stubdom/Makefile               |  4 ++--
 tools/xenstore/Makefile        | 34 +++-------------------------------
 tools/xenstore/Makefile.common | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 33 deletions(-)
 create mode 100644 tools/xenstore/Makefile.common
stubdom/Makefile +2 -2
index fbc63a5063..6b804824ba 100644
@@ -371,10 +371,10 @@ endef
 
 $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib))))
 
-xenstore/stamp: $(XEN_ROOT)/tools/xenstore/Makefile
+xenstore/stamp: $(XEN_ROOT)/tools/xenstore/Makefile.common
 	$(do_links)
 
-xenstorepvh/stamp: $(XEN_ROOT)/tools/xenstore/Makefile
+xenstorepvh/stamp: $(XEN_ROOT)/tools/xenstore/Makefile.common
 	$(do_links)
 
 LINK_DIRS := xenstore xenstorepvh $(foreach dir,$(STUB_LIBS),libs-$(XEN_TARGET_ARCH)/$(dir))
tools/xenstore/Makefile +3 -31
index 7fe1d9c1e2..a6fc917b81 100644
@@ -1,36 +1,11 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+include Makefile.common
+
 MAJOR = 3.0
 MINOR = 3
 
-CFLAGS += -Werror
-# Include configure output (config.h)
-CFLAGS += -include $(XEN_ROOT)/tools/config.h
-CFLAGS += -I./include
-CFLAGS += $(CFLAGS_libxenevtchn)
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenguest)
-CFLAGS += $(CFLAGS_libxentoolcore)
-CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
-CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
-
-ifdef CONFIG_STUBDOM
-CFLAGS += -DNO_SOCKETS=1
-endif
-
-XENSTORED_OBJS-y := xenstored_core.o xenstored_watch.o xenstored_domain.o
-XENSTORED_OBJS-y += xenstored_transaction.o xenstored_control.o
-XENSTORED_OBJS-y += xs_lib.o talloc.o utils.o tdb.o hashtable.o
-
-XENSTORED_OBJS-$(CONFIG_Linux) += xenstored_posix.o
-XENSTORED_OBJS-$(CONFIG_SunOS) += xenstored_solaris.o xenstored_posix.o xenstored_probes.o
-XENSTORED_OBJS-$(CONFIG_NetBSD) += xenstored_posix.o
-XENSTORED_OBJS-$(CONFIG_FreeBSD) += xenstored_posix.o
-XENSTORED_OBJS-$(CONFIG_MiniOS) += xenstored_minios.o
-
-$(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
-
 xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
 xenstored: LDLIBS += $(LDLIBS_libxengnttab)
 xenstored: LDLIBS += $(LDLIBS_libxenctrl)
@@ -81,9 +56,6 @@ endif
 xenstored: $(XENSTORED_OBJS-y)
 	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
-xenstored.a: $(XENSTORED_OBJS-y)
-	$(AR) cr $@ $^
-
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
@@ -97,7 +69,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 	$(CC) $(LDFLAGS) $^ -o $@ $(APPEND_LDFLAGS)
 
 .PHONY: clean
-clean:
+clean::
 	rm -f *.a *.o xenstored_probes.h
 	rm -f $(TARGETS)
 	$(RM) $(DEPS_RM)
tools/xenstore/Makefile.common new file +34 -0
new file mode 100644
index 0000000000..49002651a1
@@ -0,0 +1,34 @@
+# Makefile shared with stubdom
+
+XENSTORED_OBJS-y := xenstored_core.o xenstored_watch.o xenstored_domain.o
+XENSTORED_OBJS-y += xenstored_transaction.o xenstored_control.o
+XENSTORED_OBJS-y += xs_lib.o talloc.o utils.o tdb.o hashtable.o
+
+XENSTORED_OBJS-$(CONFIG_Linux) += xenstored_posix.o
+XENSTORED_OBJS-$(CONFIG_SunOS) += xenstored_solaris.o xenstored_posix.o xenstored_probes.o
+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
+CFLAGS += $(CFLAGS_libxenevtchn)
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenguest)
+CFLAGS += $(CFLAGS_libxentoolcore)
+CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
+CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
+
+ifdef CONFIG_STUBDOM
+CFLAGS += -DNO_SOCKETS=1
+endif
+
+$(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
+
+xenstored.a: $(XENSTORED_OBJS-y)
+	$(AR) cr $@ $^
+
+clean::
+	rm -f *.a *.o
Signature · 1 line
Anthony PERARD
#111 lore raw

PATCH 56/57 stubdom: build xenstore*-stubdom using new Makefile.common

In reply to Anthony PERARD

Makefile.common have everything needed by stubdom, when used with xenlibs.mk, so we don't need "Makefile" anymore.

Also, remove DESTDIR for "xenstore" related targets, "xenlibs.mk" doesn't use DESTDIR so its value doesn't matter.

---
 stubdom/Makefile | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
stubdom/Makefile +6 -9
index 6b804824ba..1fa075b9ad 100644
@@ -346,8 +346,7 @@ define do_links
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
   ln -sf $(dir $<)*.[ch] .; \
-  [ -e $(dir $<)Makefile.common ] && ln -sf $(dir $<)Makefile.common . ||:; \
-  ln -sf $(dir $<)Makefile .
+  ln -sf $(dir $<)Makefile.common .
   touch $@
 endef
 
@@ -356,13 +355,11 @@ define BUILD_lib
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y $$(if $$(wildcard $$(@D)/Makefile.common),-f $(CURDIR)/xenlibs.mk) -C $$(@D) $$(@F)
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -f $(CURDIR)/xenlibs.mk -C $$(@D) $$(@F)
 
  clean-libxen$(1):
 	if [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile.common ]; then \
 	    $$(MAKE) -f $(CURDIR)/xenlibs.mk -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
-	elif [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ]; then \
-	    $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
 	fi
 
  libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile.common
@@ -494,7 +491,7 @@ xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
-	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -f $(CURDIR)/xenlibs.mk -C $@ xenstored.a CONFIG_STUBDOM=y
 
 #############
 # xenstorepvh
@@ -505,7 +502,7 @@ xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg
 
 .PHONY: xenstorepvh
 xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
-	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -f $(CURDIR)/xenlibs.mk -C $@ xenstored.a CONFIG_STUBDOM=y
 
 ########
 # minios
@@ -657,8 +654,8 @@ clean:
 	rm -f *-minios-config.mk
 	rm -fr pkg-config
 	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
-	-[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
-	-[ ! -d xenstorepvh ] || $(MAKE) DESTDIR= -C xenstorepvh clean
+	-[ ! -d xenstore ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstore clean
+	-[ ! -d xenstorepvh ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstorepvh clean
 
 # clean the cross-compilation result
 .PHONY: crossclean
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 56/57
#112 lore raw

Re: [XEN PATCH 56/57] stubdom: build xenstore*-stubdom using new Makefile.common

Anthony PERARD, le lun. 06 déc. 2021 17:02:39 +0000, a ecrit:

Quoted 7 lines

Makefile.common have everything needed by stubdom, when used with xenlibs.mk, so we don't need "Makefile" anymore.

Also, remove DESTDIR for "xenstore" related targets, "xenlibs.mk" doesn't use DESTDIR so its value doesn't matter.

Quoted 65 lines
---
 stubdom/Makefile | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
stubdom/Makefile +6 -9
index 6b804824ba..1fa075b9ad 100644
@@ -346,8 +346,7 @@ define do_links
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
   ln -sf $(dir $<)*.[ch] .; \
-  [ -e $(dir $<)Makefile.common ] && ln -sf $(dir $<)Makefile.common . ||:; \
-  ln -sf $(dir $<)Makefile .
+  ln -sf $(dir $<)Makefile.common .
   touch $@
 endef
 
@@ -356,13 +355,11 @@ define BUILD_lib
  libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
  libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
-	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y $$(if $$(wildcard $$(@D)/Makefile.common),-f $(CURDIR)/xenlibs.mk) -C $$(@D) $$(@F)
+	CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -f $(CURDIR)/xenlibs.mk -C $$(@D) $$(@F)
 
  clean-libxen$(1):
 	if [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile.common ]; then \
 	    $$(MAKE) -f $(CURDIR)/xenlibs.mk -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
-	elif [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ]; then \
-	    $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
 	fi
 
  libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile.common
@@ -494,7 +491,7 @@ xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
-	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -f $(CURDIR)/xenlibs.mk -C $@ xenstored.a CONFIG_STUBDOM=y
 
 #############
 # xenstorepvh
@@ -505,7 +502,7 @@ xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg
 
 .PHONY: xenstorepvh
 xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
-	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
+	CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) -f $(CURDIR)/xenlibs.mk -C $@ xenstored.a CONFIG_STUBDOM=y
 
 ########
 # minios
@@ -657,8 +654,8 @@ clean:
 	rm -f *-minios-config.mk
 	rm -fr pkg-config
 	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
-	-[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
-	-[ ! -d xenstorepvh ] || $(MAKE) DESTDIR= -C xenstorepvh clean
+	-[ ! -d xenstore ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstore clean
+	-[ ! -d xenstorepvh ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstorepvh clean
 
 # clean the cross-compilation result
 .PHONY: crossclean
Signature · 1 line
Anthony PERARD
Signature · 6 lines
Samuel
Now I know someone out there is going to claim, "Well then, UNIX is intuitive,
because you only need to learn 5000 commands, and then everything else follows
from that! Har har har!"
(Andy Bates in comp.os.linux.misc, on "intuitive interfaces", slightly
defending Macs.)
#113 lore raw

PATCH 57/57 stubdom: xenlibs linkfarm, ignore non-regular files

In reply to Anthony PERARD

When we will convert tools/ build system, their will be a need to replace some use of "vpath". This will done making symbolic links. Those symlinks are not wanted by stubdom build system when making a linkfarm for the Xen libraries. To avoid them, we will use find instead of plain shell globbing.

For example, there will be a link to "xen/lib/x86/cpuid.o" in "tools/libs/guest/".

---
 stubdom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stubdom/Makefile +1 -1
index 1fa075b9ad..b312f710cd 100644
@@ -345,7 +345,7 @@ define do_links
   mkdir -p $(dir $@)include
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
-  ln -sf $(dir $<)*.[ch] .; \
+  find $(dir $<) -maxdepth 1 -type f -name '*.[ch]' -exec ln -sf {} . \; ; \
   ln -sf $(dir $<)Makefile.common .
   touch $@
 endef
Signature · 1 line
Anthony PERARD
Reviewed-by on v1 57/57
#114 lore raw

Re: [XEN PATCH 57/57] stubdom: xenlibs linkfarm, ignore non-regular files

Anthony PERARD, le lun. 06 déc. 2021 17:02:40 +0000, a ecrit:

Quoted 10 lines

When we will convert tools/ build system, their will be a need to replace some use of "vpath". This will done making symbolic links. Those symlinks are not wanted by stubdom build system when making a linkfarm for the Xen libraries. To avoid them, we will use find instead of plain shell globbing.

For example, there will be a link to "xen/lib/x86/cpuid.o" in "tools/libs/guest/".

Quoted 20 lines
---
 stubdom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stubdom/Makefile +1 -1
index 1fa075b9ad..b312f710cd 100644
@@ -345,7 +345,7 @@ define do_links
   mkdir -p $(dir $@)include
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
-  ln -sf $(dir $<)*.[ch] .; \
+  find $(dir $<) -maxdepth 1 -type f -name '*.[ch]' -exec ln -sf {} . \; ; \
   ln -sf $(dir $<)Makefile.common .
   touch $@
 endef
Signature · 1 line
Anthony PERARD
Signature · 6 lines
Samuel
$ du temp.iso 
2,0T    temp.iso
$ ls temp.iso -l
-r-xr-xr-x    1 samy     thibault      16E 2003-03-22 14:44 temp.iso*
 -+- je vous dirai pas la marque de mon disque dur, na :p -+-