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@suse.com>
Acked-by: Wei Liu <wl@xen.org>
This commit is contained in:
Juergen Gross authored and Wei Liu committed 2020-08-27 12:59:46 +00:00
1 parent 725ef89164
commit bc44e2fb31
3 files changed
+24 -11

No files matched your search

+1
View File
@@ -188,6 +188,7 @@ tools/hotplug/Linux/xendomains
tools/hotplug/NetBSD/rc.d/xencommons
tools/hotplug/NetBSD/rc.d/xendriverdomain
tools/include/acpi
tools/include/*.h
tools/include/xen/*
tools/include/xen-xsm/*
tools/include/xen-foreign/*.(c|h|size)
-8
View File
@@ -225,14 +225,6 @@ INSTALL_PYTHON_PROG = \
%.opic: %.S
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
headers.chk:
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: .phony
@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
$(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
+23 -3
View File
@@ -34,6 +34,10 @@ endif
PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
LIBHEADER ?= xen$(LIBNAME).h
LIBHEADERS = $(foreach h, $(LIBHEADER), include/$(h))
LIBHEADERSGLOB = $(foreach h, $(LIBHEADER), $(XEN_ROOT)/tools/include/$(h))
$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
@@ -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)
headers.chk:
for i in $(filter %.h,$^); do \
$(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
-S -o /dev/null $$i || exit 1; \
echo $$i; \
done >$@.new
mv $@.new $@
else
.PHONY: headers.chk
endif
headers.chk: $(LIBHEADERSGLOB) $(AUTOINCS)
$(LIBHEADERSGLOB): $(LIBHEADERS)
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) $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR)
$(SYMLINK_SHLIB) libxen$(LIBNAME).so.$(MAJOR) $(DESTDIR)$(libdir)/libxen$(LIBNAME).so
$(INSTALL_DATA) include/xen$(LIBNAME).h $(DESTDIR)$(includedir)
for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
$(INSTALL_DATA) xen$(LIBNAME).pc $(DESTDIR)$(PKG_INSTALLDIR)
.PHONY: uninstall
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); done
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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.