[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tools: add a copy of library headers in tools/include

commit bc44e2fb3199ecd8461bbdd093806f76ee61776a
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Sun Aug 23 10:00:11 2020 +0200
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Thu Aug 27 12:59:46 2020 +0000

    tools: add a copy of library headers in tools/include
    The headers.chk target in tools/Rules.mk tries to compile all headers
    stand alone for testing them not to include any internal header.
    Unfortunately the headers tested against are not complete, as any
    header for a Xen library is not included in the include path of the
    test compile run, resulting in a failure in case any of the tested
    headers in including an official Xen library header.
    Fix that by copying the official headers located in
    tools/libs/*/include to tools/include.
    In order to support libraries with header name other than xen<lib>.h
    or with multiple headers add a LIBHEADER make variable a lib specific
    Makefile can set in that case.
    Move the headers.chk target from Rules.mk to libs.mk as it is used
    for libraries in tools/libs only.
    Add NO_HEADERS_CHK variable to skip checking headers as this will be
    needed e.g. for libxenctrl.
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
 .gitignore         |  1 +
 tools/Rules.mk     |  8 --------
 tools/libs/libs.mk | 26 +++++++++++++++++++++++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0f03518f91..823f4743dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -188,6 +188,7 @@ tools/hotplug/Linux/xendomains
diff --git a/tools/Rules.mk b/tools/Rules.mk
index b42e50ebf6..5d699cfd39 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -225,14 +225,6 @@ INSTALL_PYTHON_PROG = \
 %.opic: %.S
        $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< 
-       for i in $(filter %.h,$^); do \
-           $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
-                 -S -o /dev/null $$i || exit 1; \
-           echo $$i; \
-       done >$@.new
-       mv $@.new $@
 subdirs-all subdirs-clean subdirs-install subdirs-distclean subdirs-uninstall: 
        @set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
                $(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 8027ae7400..8045c00e9a 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -34,6 +34,10 @@ endif
 PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+LIBHEADERS = $(foreach h, $(LIBHEADER), include/$(h))
+LIBHEADERSGLOB = $(foreach h, $(LIBHEADER), $(XEN_ROOT)/tools/include/$(h))
@@ -47,7 +51,22 @@ build:
 .PHONY: libs
 libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-headers.chk: $(wildcard include/*.h) $(AUTOINCS)
+ifneq ($(NO_HEADERS_CHK),y)
+       for i in $(filter %.h,$^); do \
+           $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
+                 -S -o /dev/null $$i || exit 1; \
+           echo $$i; \
+       done >$@.new
+       mv $@.new $@
+.PHONY: headers.chk
+       for i in $(realpath $(LIBHEADERS)); do ln -sf $$i 
$(XEN_ROOT)/tools/include; done
 libxen$(LIBNAME).a: $(LIB_OBJS)
        $(AR) rc $@ $^
@@ -68,13 +87,13 @@ install: build
        $(INSTALL_DATA) libxen$(LIBNAME).a $(DESTDIR)$(libdir)
        $(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR).$(MINOR) 
        $(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR) 
-       $(INSTALL_DATA) include/xen$(LIBNAME).h $(DESTDIR)$(includedir)
+       for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); 
 .PHONY: uninstall
        rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xen$(LIBNAME).pc
-       rm -f $(DESTDIR)$(includedir)/xen$(LIBNAME).h
+       for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); 
        rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so
        rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR)
        rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR).$(MINOR)
@@ -90,6 +109,7 @@ clean:
        rm -f libxen$(LIBNAME).so.$(MAJOR).$(MINOR) libxen$(LIBNAME).so.$(MAJOR)
        rm -f headers.chk
        rm -f xen$(LIBNAME).pc
+       rm -f $(LIBHEADERSGLOB)
 .PHONY: distclean
 distclean: clean
generated by git-patchbot for /home/xen/git/xen.git#staging



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.