Skip to contentSkip to conversation

tools: avoid creating symbolic links during make

PATCH In review Juergen Gross 3 participants 6 messages Oct 23, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover tools: avoid creating symbolic links during make

The rework of the Xen library build introduced creating some additional symbolic links during the build process.

This series is undoing that by moving all official Xen library headers to tools/include and by using include paths and the vpath directive when access to some private headers of another directory is needed.

Changes in V2:
- added comment to tools/include/Makefile (Ian Jackson)

Juergen Gross (3):
tools/libs: move official headers to common directory tools/libs/guest: don't use symbolic links for xenctrl headers tools/libs/store: don't use symbolic links for external files

 .gitignore                                    |  5 ++--
 stubdom/mini-os.mk                            |  2 +-
 tools/Rules.mk                                |  5 ++--
 tools/include/Makefile                        |  6 ++++
 tools/{libs/vchan => }/include/libxenvchan.h  |  0
 tools/{libs/light => }/include/libxl.h        |  0
 tools/{libs/light => }/include/libxl_event.h  |  0
 tools/{libs/light => }/include/libxl_json.h   |  0
 tools/{libs/light => }/include/libxl_utils.h  |  0
 tools/{libs/light => }/include/libxl_uuid.h   |  0
 tools/{libs/util => }/include/libxlutil.h     |  0
 tools/{libs/call => }/include/xencall.h       |  0
 tools/{libs/ctrl => }/include/xenctrl.h       |  0
 .../{libs/ctrl => }/include/xenctrl_compat.h  |  0
 .../devicemodel => }/include/xendevicemodel.h |  0
 tools/{libs/evtchn => }/include/xenevtchn.h   |  0
 .../include/xenforeignmemory.h                |  0
 tools/{libs/gnttab => }/include/xengnttab.h   |  0
 tools/{libs/guest => }/include/xenguest.h     |  0
 tools/{libs/hypfs => }/include/xenhypfs.h     |  0
 tools/{libs/stat => }/include/xenstat.h       |  0
 .../compat => include/xenstore-compat}/xs.h   |  0
 .../xenstore-compat}/xs_lib.h                 |  0
 tools/{libs/store => }/include/xenstore.h     |  0
 tools/{xenstore => include}/xenstore_lib.h    |  0
 .../{libs/toolcore => }/include/xentoolcore.h |  0
 .../include/xentoolcore_internal.h            |  0
 tools/{libs/toollog => }/include/xentoollog.h |  0
 tools/libs/call/Makefile                      |  3 --
 tools/libs/ctrl/Makefile                      |  3 --
 tools/libs/devicemodel/Makefile               |  3 --
 tools/libs/evtchn/Makefile                    |  2 --
 tools/libs/foreignmemory/Makefile             |  3 --
 tools/libs/gnttab/Makefile                    |  3 --
 tools/libs/guest/Makefile                     | 12 ++------
 tools/libs/hypfs/Makefile                     |  3 --
 tools/libs/libs.mk                            | 10 ++-----
 tools/libs/light/Makefile                     | 28 ++++++++-----------
 tools/libs/stat/Makefile                      |  2 --
 tools/libs/store/Makefile                     | 15 +++-------
 tools/libs/toolcore/Makefile                  |  9 +++---
 tools/libs/toollog/Makefile                   |  2 --
 tools/libs/util/Makefile                      |  3 --
 tools/libs/vchan/Makefile                     |  3 --
 tools/ocaml/libs/xentoollog/Makefile          |  2 +-
 tools/ocaml/libs/xentoollog/genlevels.py      |  2 +-
 46 files changed, 38 insertions(+), 88 deletions(-)
 rename tools/{libs/vchan => }/include/libxenvchan.h (100%)
 rename tools/{libs/light => }/include/libxl.h (100%)
 rename tools/{libs/light => }/include/libxl_event.h (100%)
 rename tools/{libs/light => }/include/libxl_json.h (100%)
 rename tools/{libs/light => }/include/libxl_utils.h (100%)
 rename tools/{libs/light => }/include/libxl_uuid.h (100%)
 rename tools/{libs/util => }/include/libxlutil.h (100%)
 rename tools/{libs/call => }/include/xencall.h (100%)
 rename tools/{libs/ctrl => }/include/xenctrl.h (100%)
 rename tools/{libs/ctrl => }/include/xenctrl_compat.h (100%)
 rename tools/{libs/devicemodel => }/include/xendevicemodel.h (100%)
 rename tools/{libs/evtchn => }/include/xenevtchn.h (100%)
 rename tools/{libs/foreignmemory => }/include/xenforeignmemory.h (100%)
 rename tools/{libs/gnttab => }/include/xengnttab.h (100%)
 rename tools/{libs/guest => }/include/xenguest.h (100%)
 rename tools/{libs/hypfs => }/include/xenhypfs.h (100%)
 rename tools/{libs/stat => }/include/xenstat.h (100%)
 rename tools/{libs/store/include/compat => include/xenstore-compat}/xs.h (100%)
 rename tools/{libs/store/include/compat => include/xenstore-compat}/xs_lib.h (100%)
 rename tools/{libs/store => }/include/xenstore.h (100%)
 rename tools/{xenstore => include}/xenstore_lib.h (100%)
 rename tools/{libs/toolcore => }/include/xentoolcore.h (100%)
 rename tools/{libs/toolcore => }/include/xentoolcore_internal.h (100%)
 rename tools/{libs/toollog => }/include/xentoollog.h (100%)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/3 tools/libs: move official headers to common directory

Instead of each library having an own include directory move the official headers to tools/include instead. This will drop the need to link those headers to tools/include and there is no need any longer to have library-specific include paths when building Xen.

While at it remove setting of the unused variable
PKG_CONFIG_CFLAGS_LOCAL in libs/*/Makefile.

---
 .gitignore                                    |  5 ++--
 stubdom/mini-os.mk                            |  2 +-
 tools/Rules.mk                                |  5 ++--
 tools/include/Makefile                        |  6 ++++
 tools/{libs/vchan => }/include/libxenvchan.h  |  0
 tools/{libs/light => }/include/libxl.h        |  0
 tools/{libs/light => }/include/libxl_event.h  |  0
 tools/{libs/light => }/include/libxl_json.h   |  0
 tools/{libs/light => }/include/libxl_utils.h  |  0
 tools/{libs/light => }/include/libxl_uuid.h   |  0
 tools/{libs/util => }/include/libxlutil.h     |  0
 tools/{libs/call => }/include/xencall.h       |  0
 tools/{libs/ctrl => }/include/xenctrl.h       |  0
 .../{libs/ctrl => }/include/xenctrl_compat.h  |  0
 .../devicemodel => }/include/xendevicemodel.h |  0
 tools/{libs/evtchn => }/include/xenevtchn.h   |  0
 .../include/xenforeignmemory.h                |  0
 tools/{libs/gnttab => }/include/xengnttab.h   |  0
 tools/{libs/guest => }/include/xenguest.h     |  0
 tools/{libs/hypfs => }/include/xenhypfs.h     |  0
 tools/{libs/stat => }/include/xenstat.h       |  0
 .../compat => include/xenstore-compat}/xs.h   |  0
 .../xenstore-compat}/xs_lib.h                 |  0
 tools/{libs/store => }/include/xenstore.h     |  0
 tools/{xenstore => include}/xenstore_lib.h    |  0
 .../{libs/toolcore => }/include/xentoolcore.h |  0
 .../include/xentoolcore_internal.h            |  0
 tools/{libs/toollog => }/include/xentoollog.h |  0
 tools/libs/call/Makefile                      |  3 --
 tools/libs/ctrl/Makefile                      |  3 --
 tools/libs/devicemodel/Makefile               |  3 --
 tools/libs/evtchn/Makefile                    |  2 --
 tools/libs/foreignmemory/Makefile             |  3 --
 tools/libs/gnttab/Makefile                    |  3 --
 tools/libs/guest/Makefile                     |  3 --
 tools/libs/hypfs/Makefile                     |  3 --
 tools/libs/libs.mk                            | 10 ++-----
 tools/libs/light/Makefile                     | 28 ++++++++-----------
 tools/libs/stat/Makefile                      |  2 --
 tools/libs/store/Makefile                     | 11 +++-----
 tools/libs/toolcore/Makefile                  |  9 +++---
 tools/libs/toollog/Makefile                   |  2 --
 tools/libs/util/Makefile                      |  3 --
 tools/libs/vchan/Makefile                     |  3 --
 tools/ocaml/libs/xentoollog/Makefile          |  2 +-
 tools/ocaml/libs/xentoollog/genlevels.py      |  2 +-
 46 files changed, 36 insertions(+), 77 deletions(-)
 rename tools/{libs/vchan => }/include/libxenvchan.h (100%)
 rename tools/{libs/light => }/include/libxl.h (100%)
 rename tools/{libs/light => }/include/libxl_event.h (100%)
 rename tools/{libs/light => }/include/libxl_json.h (100%)
 rename tools/{libs/light => }/include/libxl_utils.h (100%)
 rename tools/{libs/light => }/include/libxl_uuid.h (100%)
 rename tools/{libs/util => }/include/libxlutil.h (100%)
 rename tools/{libs/call => }/include/xencall.h (100%)
 rename tools/{libs/ctrl => }/include/xenctrl.h (100%)
 rename tools/{libs/ctrl => }/include/xenctrl_compat.h (100%)
 rename tools/{libs/devicemodel => }/include/xendevicemodel.h (100%)
 rename tools/{libs/evtchn => }/include/xenevtchn.h (100%)
 rename tools/{libs/foreignmemory => }/include/xenforeignmemory.h (100%)
 rename tools/{libs/gnttab => }/include/xengnttab.h (100%)
 rename tools/{libs/guest => }/include/xenguest.h (100%)
 rename tools/{libs/hypfs => }/include/xenhypfs.h (100%)
 rename tools/{libs/stat => }/include/xenstat.h (100%)
 rename tools/{libs/store/include/compat => include/xenstore-compat}/xs.h (100%)
 rename tools/{libs/store/include/compat => include/xenstore-compat}/xs_lib.h (100%)
 rename tools/{libs/store => }/include/xenstore.h (100%)
 rename tools/{xenstore => include}/xenstore_lib.h (100%)
 rename tools/{libs/toolcore => }/include/xentoolcore.h (100%)
 rename tools/{libs/toolcore => }/include/xentoolcore_internal.h (100%)
 rename tools/{libs/toollog => }/include/xentoollog.h (100%)
.gitignore +2 -3
index f6865c9cd8..b346a2abf6 100644
@@ -143,7 +143,6 @@ tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
 tools/libs/light/xenlight.pc
-tools/libs/light/include/_*.h
 tools/libs/stat/_paths.h
 tools/libs/stat/headers.chk
 tools/libs/stat/libxenstat.map
@@ -153,7 +152,6 @@ tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xenstore.pc
 tools/libs/store/xs_lib.c
-tools/libs/store/include/xenstore_lib.h
 tools/libs/util/*.pc
 tools/libs/util/_paths.h
 tools/libs/util/libxlu_cfg_y.output
@@ -231,7 +229,8 @@ tools/hotplug/Linux/xendomains
 tools/hotplug/NetBSD/rc.d/xencommons
 tools/hotplug/NetBSD/rc.d/xendriverdomain
 tools/include/acpi
-tools/include/*.h
+tools/include/_libxl*.h
+tools/include/_xentoolcore_list.h
 tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
stubdom/mini-os.mk +1 -1
index 420e9a8771..7e4968e026 100644
@@ -5,7 +5,7 @@
 # XEN_ROOT
 # MINIOS_TARGET_ARCH
 
-XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/libs/store/include
+XENSTORE_CPPFLAGS = -isystem $(XEN_ROOT)/tools/include
 TOOLCORE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore
 TOOLLOG_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog
 EVTCHN_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn
tools/Rules.mk +2 -3
index f3e0078927..f61da81f4a 100644
@@ -87,7 +87,7 @@ endif
 define LIB_defs
  FILENAME_$(1) ?= xen$(1)
  XEN_libxen$(1) = $$(XEN_ROOT)/tools/libs/$(1)
- CFLAGS_libxen$(1) = -I$$(XEN_libxen$(1))/include $$(CFLAGS_xeninclude)
+ CFLAGS_libxen$(1) = $$(CFLAGS_xeninclude)
  SHDEPS_libxen$(1) = $$(foreach use,$$(USELIBS_$(1)),$$(SHLIB_libxen$$(use)))
  LDLIBS_libxen$(1) = $$(SHDEPS_libxen$(1)) $$(XEN_libxen$(1))/lib$$(FILENAME_$(1))$$(libextension)
  SHLIB_libxen$(1) = $$(SHDEPS_libxen$(1)) -Wl,-rpath-link=$$(XEN_libxen$(1))
@@ -97,8 +97,7 @@ $(foreach lib,$(LIBS_LIBS),$(eval $(call LIB_defs,$(lib))))
 
 # code which compiles against libxenctrl get __XEN_TOOLS__ and
 # therefore sees the unstable hypercall interfaces.
-CFLAGS_libxenctrl += $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) -D__XEN_TOOLS__
-CFLAGS_libxenguest += $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory)
+CFLAGS_libxenctrl += -D__XEN_TOOLS__
 
 ifeq ($(CONFIG_Linux),y)
 LDLIBS_libxenstore += -ldl
tools/include/Makefile +6 -0
index 4d4313b60d..4d4ec5f974 100644
@@ -1,6 +1,12 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+# Caution: some tools/libs/*/Makefile generate header files directly in
+# tools/include, and they do the [un]install actions for those, too.
+# In case other headers need to be built cwin tools/include this should be
+# taken into account, i.e. there should be no rules added here for generating
+# any tools/include/*.h files.
+
 # Relative to $(XEN_ROOT)/xen/xsm/flask
 FLASK_H_DEPEND := policy/initial_sids
 
tools/include/libxenvchan.h renamed from tools/libs/vchan/include/libxenvchan.h +0 -0
similarity index 100%
rename from tools/libs/vchan/include/libxenvchan.h
rename to tools/include/libxenvchan.h
tools/include/libxl.h renamed from tools/libs/light/include/libxl.h +0 -0
similarity index 100%
rename from tools/libs/light/include/libxl.h
rename to tools/include/libxl.h
tools/include/libxl_event.h renamed from tools/libs/light/include/libxl_event.h +0 -0
similarity index 100%
rename from tools/libs/light/include/libxl_event.h
rename to tools/include/libxl_event.h
tools/include/libxl_json.h renamed from tools/libs/light/include/libxl_json.h +0 -0
similarity index 100%
rename from tools/libs/light/include/libxl_json.h
rename to tools/include/libxl_json.h
tools/include/libxl_utils.h renamed from tools/libs/light/include/libxl_utils.h +0 -0
similarity index 100%
rename from tools/libs/light/include/libxl_utils.h
rename to tools/include/libxl_utils.h
tools/include/libxl_uuid.h renamed from tools/libs/light/include/libxl_uuid.h +0 -0
similarity index 100%
rename from tools/libs/light/include/libxl_uuid.h
rename to tools/include/libxl_uuid.h
tools/include/libxlutil.h renamed from tools/libs/util/include/libxlutil.h +0 -0
similarity index 100%
rename from tools/libs/util/include/libxlutil.h
rename to tools/include/libxlutil.h
tools/include/xencall.h renamed from tools/libs/call/include/xencall.h +0 -0
similarity index 100%
rename from tools/libs/call/include/xencall.h
rename to tools/include/xencall.h
tools/include/xenctrl.h renamed from tools/libs/ctrl/include/xenctrl.h +0 -0
similarity index 100%
rename from tools/libs/ctrl/include/xenctrl.h
rename to tools/include/xenctrl.h
tools/include/xenctrl_compat.h renamed from tools/libs/ctrl/include/xenctrl_compat.h +0 -0
similarity index 100%
rename from tools/libs/ctrl/include/xenctrl_compat.h
rename to tools/include/xenctrl_compat.h
tools/include/xendevicemodel.h renamed from tools/libs/devicemodel/include/xendevicemodel.h +0 -0
similarity index 100%
rename from tools/libs/devicemodel/include/xendevicemodel.h
rename to tools/include/xendevicemodel.h
tools/include/xenevtchn.h renamed from tools/libs/evtchn/include/xenevtchn.h +0 -0
similarity index 100%
rename from tools/libs/evtchn/include/xenevtchn.h
rename to tools/include/xenevtchn.h
tools/include/xenforeignmemory.h renamed from tools/libs/foreignmemory/include/xenforeignmemory.h +0 -0
similarity index 100%
rename from tools/libs/foreignmemory/include/xenforeignmemory.h
rename to tools/include/xenforeignmemory.h
tools/include/xengnttab.h renamed from tools/libs/gnttab/include/xengnttab.h +0 -0
similarity index 100%
rename from tools/libs/gnttab/include/xengnttab.h
rename to tools/include/xengnttab.h
tools/include/xenguest.h renamed from tools/libs/guest/include/xenguest.h +0 -0
similarity index 100%
rename from tools/libs/guest/include/xenguest.h
rename to tools/include/xenguest.h
tools/include/xenhypfs.h renamed from tools/libs/hypfs/include/xenhypfs.h +0 -0
similarity index 100%
rename from tools/libs/hypfs/include/xenhypfs.h
rename to tools/include/xenhypfs.h
tools/include/xenstat.h renamed from tools/libs/stat/include/xenstat.h +0 -0
similarity index 100%
rename from tools/libs/stat/include/xenstat.h
rename to tools/include/xenstat.h
tools/include/xenstore-compat/xs.h renamed from tools/libs/store/include/compat/xs.h +0 -0
similarity index 100%
rename from tools/libs/store/include/compat/xs.h
rename to tools/include/xenstore-compat/xs.h
tools/include/xenstore-compat/xs_lib.h renamed from tools/libs/store/include/compat/xs_lib.h +0 -0
similarity index 100%
rename from tools/libs/store/include/compat/xs_lib.h
rename to tools/include/xenstore-compat/xs_lib.h
tools/include/xenstore.h renamed from tools/libs/store/include/xenstore.h +0 -0
similarity index 100%
rename from tools/libs/store/include/xenstore.h
rename to tools/include/xenstore.h
tools/include/xenstore_lib.h renamed from tools/xenstore/xenstore_lib.h +0 -0
similarity index 100%
rename from tools/xenstore/xenstore_lib.h
rename to tools/include/xenstore_lib.h
tools/include/xentoolcore.h renamed from tools/libs/toolcore/include/xentoolcore.h +0 -0
similarity index 100%
rename from tools/libs/toolcore/include/xentoolcore.h
rename to tools/include/xentoolcore.h
tools/include/xentoolcore_internal.h renamed from tools/libs/toolcore/include/xentoolcore_internal.h +0 -0
similarity index 100%
rename from tools/libs/toolcore/include/xentoolcore_internal.h
rename to tools/include/xentoolcore_internal.h
tools/include/xentoollog.h renamed from tools/libs/toollog/include/xentoollog.h +0 -0
similarity index 100%
rename from tools/libs/toollog/include/xentoollog.h
rename to tools/include/xentoollog.h
tools/libs/call/Makefile +0 -3
index 81c7478efd..4ed201b3b3 100644
@@ -12,6 +12,3 @@ SRCS-$(CONFIG_NetBSD)  += netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxencall)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/ctrl/Makefile +0 -3
index 0071226d2a..4185dc3f22 100644
@@ -62,9 +62,6 @@ $(eval $(genpath-target))
 
 $(LIB_OBJS) $(PIC_OBJS): _paths.h
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenctrl)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 clean: cleanlocal
 
 .PHONY: cleanlocal
tools/libs/devicemodel/Makefile +0 -3
index 42417958f2..b67fc0fac1 100644
@@ -12,6 +12,3 @@ SRCS-$(CONFIG_NetBSD)  += compat.c
 SRCS-$(CONFIG_MiniOS)  += compat.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxendevicemodel)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/evtchn/Makefile +0 -2
index aec76641e8..ad01a17b3d 100644
@@ -12,5 +12,3 @@ SRCS-$(CONFIG_NetBSD)  += netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenevtchn)/include
tools/libs/foreignmemory/Makefile +0 -3
index cf444d3c1a..13850f7988 100644
@@ -12,6 +12,3 @@ SRCS-$(CONFIG_NetBSD)  += compat.c netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenforeignmemory)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/gnttab/Makefile +0 -3
index d8d4d55e27..d86c49d243 100644
@@ -14,6 +14,3 @@ SRCS-$(CONFIG_SunOS)   += gnttab_unimp.c gntshr_unimp.c
 SRCS-$(CONFIG_NetBSD)  += gnttab_unimp.c gntshr_unimp.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxengnttab)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/guest/Makefile +0 -3
index f24732fbcd..5b4ad313cc 100644
@@ -113,9 +113,6 @@ xc_private.h: _paths.h
 
 $(LIB_OBJS) $(PIC_OBJS): $(LINK_FILES)
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenctrl)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 .PHONY: cleanlocal
 cleanlocal:
 	rm -f libxenguest.map
tools/libs/hypfs/Makefile +0 -3
index 668d68853f..39feca87e8 100644
@@ -9,6 +9,3 @@ APPEND_LDFLAGS += -lz
 SRCS-y                 += core.c
 
 include ../libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenhypfs)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
tools/libs/libs.mk +3 -7
index 325b7b7cea..959ff91a56 100644
@@ -47,10 +47,10 @@ endif
 PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
 
 LIBHEADER ?= $(LIB_FILE_NAME).h
-LIBHEADERS = $(foreach h, $(LIBHEADER), include/$(h))
-LIBHEADERSGLOB = $(foreach h, $(LIBHEADER), $(XEN_ROOT)/tools/include/$(h))
+LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
 
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
@@ -74,14 +74,11 @@ else
 .PHONY: headers.chk
 endif
 
-headers.chk: $(LIBHEADERSGLOB) $(AUTOINCS)
+headers.chk: $(AUTOINCS)
 
 libxen$(LIBNAME).map:
 	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
 
-$(LIBHEADERSGLOB): $(LIBHEADERS)
-	for i in $(realpath $(LIBHEADERS)); do ln -sf $$i $(XEN_ROOT)/tools/include; done
-
 lib$(LIB_FILE_NAME).a: $(LIB_OBJS)
 	$(AR) rc $@ $^
 
@@ -123,7 +120,6 @@ clean:
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk
 	rm -f $(PKG_CONFIG)
-	rm -f $(LIBHEADERSGLOB)
 	rm -f _paths.h
 
 .PHONY: distclean
tools/libs/light/Makefile +12 -16
index f58a3214e5..3424fdb61b 100644
@@ -152,7 +152,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 = _libxl_list.h _paths.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
+AUTOINCS = $(XEN_INCLUDE)/_libxl_list.h _paths.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
@@ -165,9 +165,6 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(CURDIR)
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 LDUSELIBS-y += $(PTYFUNCS_LIBS)
 LDUSELIBS-$(CONFIG_LIBNL) += $(LIBNL3_LIBS)
 LDUSELIBS-$(CONFIG_Linux) += -luuid
@@ -185,7 +182,7 @@ libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
-testidl.c: libxl_types.idl gentest.py include/libxl.h $(AUTOINCS)
+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
 
@@ -200,15 +197,15 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: include/%.h $(AUTOINCS)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
+_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_libxl.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]
 	mv -f [email protected] $@
 
-_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-	$(PERL) $^ --prefix=libxl >[email protected]
-	$(call move-if-changed,[email protected],$@)
+$(XEN_INCLUDE)/_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
+	$(PERL) $^ --prefix=libxl >$(notdir $@).new
+	$(call move-if-changed,$(notdir $@).new,$@)
 
 _libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \
 _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
@@ -216,13 +213,13 @@ _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 	$(PERL) -w $< $@ >[email protected]
 	$(call move-if-changed,[email protected],$@)
 
-include/libxl.h: _libxl_types.h _libxl_list.h
-include/libxl_json.h: _libxl_types_json.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_json.h: _libxl_types_internal_json.h
 xl.h: _paths.h
 
-$(LIB_OBJS) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): include/libxl.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
 
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
@@ -234,8 +231,8 @@ _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_
 	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
 	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
 
-include/_%.h: _%.h
-	cp $< $@
+$(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)
@@ -271,7 +268,6 @@ cleanlocal:
 	$(RM) -f testidl.c.new testidl.c *.api-ok
 	$(RM) -f $(TEST_PROGS)
 	$(RM) -rf __pycache__
-	$(RM) -f include/_*.h
 	$(RM) -f libxenlight.map
 	$(RM) -f $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
tools/libs/stat/Makefile +0 -2
index 5463f5f7ca..8353e96946 100644
@@ -30,8 +30,6 @@ APPEND_LDFLAGS += $(LDLIBS-y)
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstat)/include
-
 $(LIB_OBJS): _paths.h
 
 PYLIB=bindings/swig/python/_xenstat.so
tools/libs/store/Makefile +4 -7
index 4da502646e..930e763de9 100644
@@ -21,12 +21,12 @@ CFLAGS += $(CFLAGS_libxentoolcore)
 CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
-LINK_FILES = xs_lib.c include/xenstore_lib.h list.h utils.h
+LINK_FILES = xs_lib.c list.h utils.h
 
 $(LIB_OBJS): $(LINK_FILES)
 
 $(LINK_FILES):
-	ln -sf $(XEN_ROOT)/tools/xenstore/$(notdir $@) $@
+	ln -sf $(XEN_ROOT)/tools/xenstore/$@ $@
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
@@ -35,9 +35,6 @@ else
 PKG_CONFIG_REMOVE += -ldl
 endif
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenstore)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 .PHONY: install
 install: install-headers
 
@@ -45,8 +42,8 @@ install: install-headers
 install-headers:
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)/xenstore-compat
-	$(INSTALL_DATA) include/compat/xs.h $(DESTDIR)$(includedir)/xenstore-compat/xs.h
-	$(INSTALL_DATA) include/compat/xs_lib.h $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
+	$(INSTALL_DATA) $(XEN_INCLUDE)/xenstore-compat/xs.h $(DESTDIR)$(includedir)/xenstore-compat/xs.h
+	$(INSTALL_DATA) $(XEN_INCLUDE)/xenstore-compat/xs_lib.h $(DESTDIR)$(includedir)/xenstore-compat/xs_lib.h
 	ln -sf xenstore-compat/xs.h  $(DESTDIR)$(includedir)/xs.h
 	ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(includedir)/xs_lib.h
 
tools/libs/toolcore/Makefile +4 -5
index 5819bbc8ee..1cf30733c9 100644
@@ -3,18 +3,17 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
-AUTOINCS := include/_xentoolcore_list.h
+AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
 SRCS-y	+= handlereg.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 PKG_CONFIG_DESC := Central support for Xen Hypervisor userland libraries
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxentoolcore)/include
 
 $(LIB_OBJS): $(AUTOINCS)
 $(PIC_OBJS): $(AUTOINCS)
 
-include/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-	$(PERL) $^ --prefix=xentoolcore >[email protected]
-	$(call move-if-changed,[email protected],$@)
+$(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 +0 -2
index 3f986835d6..dce1b2de85 100644
@@ -8,5 +8,3 @@ SRCS-y	+= xtl_core.c
 SRCS-y	+= xtl_logger_stdio.c
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxentoollog)/include
tools/libs/util/Makefile +0 -3
index 0c9db8027d..b739360be7 100644
@@ -39,9 +39,6 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenutil)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 $(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS) _paths.h
 
 %.c %.h:: %.y
tools/libs/vchan/Makefile +0 -3
index 5e18d5b196..83a45d2817 100644
@@ -12,9 +12,6 @@ NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_libxenvchan)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
 clean: cleanlocal
 
 .PHONY: cleanlocal
tools/ocaml/libs/xentoollog/Makefile +1 -1
index 8ae0a784fd..593f9e9e9d 100644
@@ -49,7 +49,7 @@ xentoollog.mli: xentoollog.mli.in _xtl_levels.mli.in
 
 libs: $(LIBS)
 
-_xtl_levels.ml.in _xtl_levels.mli.in _xtl_levels.inc: genlevels.py $(XEN_ROOT)/tools/libs/toollog/include/xentoollog.h
+_xtl_levels.ml.in _xtl_levels.mli.in _xtl_levels.inc: genlevels.py $(XEN_INCLUDE)/xentoollog.h
 	$(PYTHON) genlevels.py _xtl_levels.mli.in _xtl_levels.ml.in _xtl_levels.inc
 
 .PHONY: install
tools/ocaml/libs/xentoollog/genlevels.py +1 -1
index f9cf853e26..11a623e459 100755
@@ -6,7 +6,7 @@ import sys
 from functools import reduce
 
 def read_levels():
-	f = open('../../../libs/toollog/include/xentoollog.h', 'r')
+	f = open('../../../include/xentoollog.h', 'r')
 
 	levels = []
 	record = False
Signature · 1 line
2.26.2
Acked-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] tools/libs: move official headers to common directory

Juergen Gross writes ("[PATCH v2 1/3] tools/libs: move official headers to common directory"):

Quoted 11 lines

Instead of each library having an own include directory move the official headers to tools/include instead. This will drop the need to link those headers to tools/include and there is no need any longer to have library-specific include paths when building Xen.

While at it remove setting of the unused variable
PKG_CONFIG_CFLAGS_LOCAL in libs/*/Makefile.

Thanks, all three

and pushed.

Ian.

#3 lore raw

Re: [PATCH v2 1/3] tools/libs: move official headers to common directory

Quoted 13 lines · Ian Jackson

Juergen Gross writes ("[PATCH v2 1/3] tools/libs: move official headers to common directory"):

Quoted 11 lines

Instead of each library having an own include directory move the official headers to tools/include instead. This will drop the need to link those headers to tools/include and there is no need any longer to have library-specific include paths when building Xen.

While at it remove setting of the unused variable
PKG_CONFIG_CFLAGS_LOCAL in libs/*/Makefile.

Quoted 5 lines

Thanks, all three

and pushed.

While you're at it, Ian, could you also take a look at "[PATCH 2/2] tools/libs: fix uninstall rule for header files" (patch 1 there now obviously is obsolete)?

Thanks, Jan

#4 lore raw

PATCH v2 2/3 tools/libs/guest: don't use symbolic links for xenctrl headers

In reply to Juergen Gross

Instead of using symbolic links for accessing the xenctrl private headers use an include path instead.

---
 tools/libs/guest/Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
tools/libs/guest/Makefile +2 -7
index 5b4ad313cc..1c729040b3 100644
@@ -6,11 +6,6 @@ ifeq ($(CONFIG_LIBXC_MINIOS),y)
 override CONFIG_MIGRATE := n
 endif
 
-LINK_FILES := xc_private.h xc_core.h xc_core_x86.h xc_core_arm.h xc_bitops.h
-
-$(LINK_FILES):
-	ln -sf $(XEN_ROOT)/tools/libs/ctrl/$(notdir $@) $@
-
 SRCS-y += xg_private.c
 SRCS-y += xg_domain.c
 SRCS-y += xg_suspend.c
@@ -29,6 +24,8 @@ else
 SRCS-y += xg_nomigrate.c
 endif
 
+CFLAGS += -I$(XEN_libxenctrl)
+
 vpath %.c ../../../xen/common/libelf
 CFLAGS += -I../../../xen/common/libelf
 
@@ -111,8 +108,6 @@ $(eval $(genpath-target))
 
 xc_private.h: _paths.h
 
-$(LIB_OBJS) $(PIC_OBJS): $(LINK_FILES)
-
 .PHONY: cleanlocal
 cleanlocal:
 	rm -f libxenguest.map
Signature · 1 line
2.26.2
#5 lore raw

PATCH v2 3/3 tools/libs/store: don't use symbolic links for external files

In reply to Juergen Gross

Instead of using symbolic links to include files from xenstored use the vpath directive and an include path.

---
 tools/libs/store/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tools/libs/store/Makefile +2 -6
index 930e763de9..bc89b9cd70 100644
@@ -21,12 +21,8 @@ CFLAGS += $(CFLAGS_libxentoolcore)
 CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 CFLAGS += -DXEN_RUN_STORED="\"$(XEN_RUN_STORED)\""
 
-LINK_FILES = xs_lib.c list.h utils.h
-
-$(LIB_OBJS): $(LINK_FILES)
-
-$(LINK_FILES):
-	ln -sf $(XEN_ROOT)/tools/xenstore/$@ $@
+vpath xs_lib.c $(XEN_ROOT)/tools/xenstore
+CFLAGS += -I $(XEN_ROOT)/tools/xenstore
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
Signature · 1 line
2.26.2