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

[Xen-changelog] [xen staging] tools/libs: put common Makefile parts into new libs.mk



commit 56dccee3f441763ec672fe4140e28d9e63674112
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Fri Sep 6 14:41:03 2019 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Sep 17 17:21:25 2019 +0100

    tools/libs: put common Makefile parts into new libs.mk
    
    The Makefile below tools/libs have a lot in common. Put those common
    parts into a new libs.mk and include that from the specific Makefiles.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/libs/call/Makefile          | 86 ++---------------------------------
 tools/libs/devicemodel/Makefile   | 88 ++----------------------------------
 tools/libs/evtchn/Makefile        | 86 ++---------------------------------
 tools/libs/foreignmemory/Makefile | 86 ++---------------------------------
 tools/libs/gnttab/Makefile        | 86 ++---------------------------------
 tools/libs/libs.mk                | 95 +++++++++++++++++++++++++++++++++++++++
 tools/libs/toolcore/Makefile      | 85 +----------------------------------
 tools/libs/toollog/Makefile       | 84 +---------------------------------
 8 files changed, 114 insertions(+), 582 deletions(-)

diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile
index 6291e6dfe7..7f6dc3fcbd 100644
--- a/tools/libs/call/Makefile
+++ b/tools/libs/call/Makefile
@@ -3,11 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
-SHLIB_LDFLAGS += -Wl,--version-script=libxencall.map
-
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
+LIBNAME  := call
+USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c buffer.c
 SRCS-$(CONFIG_Linux)   += linux.c
@@ -16,84 +13,7 @@ SRCS-$(CONFIG_SunOS)   += solaris.c
 SRCS-$(CONFIG_NetBSD)  += netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxencall.a
-ifneq ($(nosharedlibs),y)
-LIB += libxencall.so
-endif
-
-PKG_CONFIG := xencall.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENCALL)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxencall.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxencall.so: libxencall.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxencall.so.$(MAJOR): libxencall.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxencall.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxencall.map
-       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxencall.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) 
$(LDLIBS_libxentoollog) $(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxencall.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxencall.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxencall.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxencall.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxencall.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxencall.so
-       $(INSTALL_DATA) include/xencall.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xencall.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xencall.pc
-       rm -f $(DESTDIR)$(includedir)/xencall.h
-       rm -f $(DESTDIR)$(libdir)/libxencall.so
-       rm -f $(DESTDIR)$(libdir)/libxencall.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxencall.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxencall.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxencall.so.$(MAJOR).$(MINOR) libxencall.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xencall.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 73cff6dbc4..61bfa35273 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -3,13 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 3
-SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
-
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(CFLAGS_libxentoollog)
-CFLAGS   += $(CFLAGS_libxentoolcore)
-CFLAGS   += $(CFLAGS_libxencall)
+LIBNAME  := devicemodel
+USELIBS  := toollog toolcore call
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
@@ -18,84 +13,7 @@ SRCS-$(CONFIG_SunOS)   += compat.c
 SRCS-$(CONFIG_NetBSD)  += compat.c
 SRCS-$(CONFIG_MiniOS)  += compat.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxendevicemodel.a
-ifneq ($(nosharedlibs),y)
-LIB += libxendevicemodel.so
-endif
-
-PKG_CONFIG := xendevicemodel.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENDEVICEMODEL)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxendevicemodel.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxendevicemodel.so: libxendevicemodel.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxendevicemodel.so.$(MAJOR): libxendevicemodel.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxendevicemodel.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxendevicemodel.map
-       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxendevicemodel.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) 
$(LDLIBS_libxentoollog) $(LDLIBS_libxencall) $(LDLIBS_libxentoolcore) 
$(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxendevicemodel.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxendevicemodel.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxendevicemodel.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxendevicemodel.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxendevicemodel.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxendevicemodel.so
-       $(INSTALL_DATA) include/xendevicemodel.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xendevicemodel.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xendevicemodel.pc
-       rm -f $(DESTDIR)$(includedir)/xendevicemodel.h
-       rm -f $(DESTDIR)$(libdir)/libxendevicemodel.so
-       rm -f $(DESTDIR)$(libdir)/libxendevicemodel.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxendevicemodel.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxendevicemodel.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxendevicemodel.so.$(MAJOR).$(MINOR) 
libxendevicemodel.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xendevicemodel.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index 9952b30225..9206f622ef 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -3,11 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 1
-SHLIB_LDFLAGS += -Wl,--version-script=libxenevtchn.map
-
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
+LIBNAME  := evtchn
+USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
@@ -16,83 +13,6 @@ SRCS-$(CONFIG_SunOS)   += solaris.c
 SRCS-$(CONFIG_NetBSD)  += netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxenevtchn.a
-ifneq ($(nosharedlibs),y)
-LIB += libxenevtchn.so
-endif
-
-PKG_CONFIG := xenevtchn.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENEVTCHN)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxenevtchn.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxenevtchn.so: libxenevtchn.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxenevtchn.so.$(MAJOR): libxenevtchn.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxenevtchn.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxenevtchn.map
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenevtchn.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) 
$(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxenevtchn.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxenevtchn.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxenevtchn.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxenevtchn.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxenevtchn.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxenevtchn.so
-       $(INSTALL_DATA) include/xenevtchn.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xenevtchn.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xenevtchn.pc
-       rm -f $(DESTDIR)$(includedir)/xenevtchn.h
-       rm -f $(DESTDIR)$(libdir)/libxenevtchn.so
-       rm -f $(DESTDIR)$(libdir)/libxenevtchn.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxenevtchn.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxenevtchn.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxenevtchn.so.$(MAJOR).$(MINOR) libxenevtchn.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xenevtchn.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/foreignmemory/Makefile 
b/tools/libs/foreignmemory/Makefile
index ee5c3fd67e..28f1bddc96 100644
--- a/tools/libs/foreignmemory/Makefile
+++ b/tools/libs/foreignmemory/Makefile
@@ -3,11 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 3
-SHLIB_LDFLAGS += -Wl,--version-script=libxenforeignmemory.map
-
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
+LIBNAME  := foreignmemory
+USELIBS  := toollog toolcore
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += linux.c
@@ -16,84 +13,7 @@ SRCS-$(CONFIG_SunOS)   += compat.c solaris.c
 SRCS-$(CONFIG_NetBSD)  += compat.c netbsd.c
 SRCS-$(CONFIG_MiniOS)  += minios.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxenforeignmemory.a
-ifneq ($(nosharedlibs),y)
-LIB += libxenforeignmemory.so
-endif
-
-PKG_CONFIG := xenforeignmemory.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENFOREIGNMEMORY)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxenforeignmemory.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxenforeignmemory.so: libxenforeignmemory.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxenforeignmemory.so.$(MAJOR): libxenforeignmemory.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxenforeignmemory.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxenforeignmemory.map
-       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxenforeignmemory.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) 
$(LDLIBS_libxentoollog) $(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxenforeignmemory.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxenforeignmemory.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxenforeignmemory.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxenforeignmemory.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxenforeignmemory.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxenforeignmemory.so
-       $(INSTALL_DATA) include/xenforeignmemory.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xenforeignmemory.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xenforeignmemory.pc
-       rm -f $(DESTDIR)$(includedir)/xenforeignmemory.h
-       rm -f $(DESTDIR)$(libdir)/libxenforeignmemory.so
-       rm -f $(DESTDIR)$(libdir)/libxenforeignmemory.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxenforeignmemory.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxenforeignmemory.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxenforeignmemory.so.$(MAJOR).$(MINOR) 
libxenforeignmemory.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xenforeignmemory.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile
index 6c2e7e36a2..2da8fbbb7f 100644
--- a/tools/libs/gnttab/Makefile
+++ b/tools/libs/gnttab/Makefile
@@ -3,11 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
-SHLIB_LDFLAGS += -Wl,--version-script=libxengnttab.map
-
-CFLAGS   += -Werror -Wmissing-prototypes
-CFLAGS   += -I./include $(CFLAGS_xeninclude)
-CFLAGS   += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
+LIBNAME  := gnttab
+USELIBS  := toollog toolcore
 
 SRCS-GNTTAB            += gnttab_core.c
 SRCS-GNTSHR            += gntshr_core.c
@@ -18,84 +15,7 @@ SRCS-$(CONFIG_FreeBSD) += $(SRCS-GNTTAB) $(SRCS-GNTSHR) 
freebsd.c
 SRCS-$(CONFIG_SunOS)   += gnttab_unimp.c gntshr_unimp.c
 SRCS-$(CONFIG_NetBSD)  += gnttab_unimp.c gntshr_unimp.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxengnttab.a
-ifneq ($(nosharedlibs),y)
-LIB += libxengnttab.so
-endif
-
-PKG_CONFIG := xengnttab.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENGNTTAB)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL = $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxengnttab.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxengnttab.so: libxengnttab.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxengnttab.so.$(MAJOR): libxengnttab.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxengnttab.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxengnttab.map
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxengnttab.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS_libxentoollog) 
$(LDLIBS_libxentoolcore) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxengnttab.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxengnttab.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxengnttab.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxengnttab.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxengnttab.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxengnttab.so
-       $(INSTALL_DATA) include/xengnttab.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xengnttab.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uninstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xengnttab.pc
-       rm -f $(DESTDIR)$(includedir)/xengnttab.h
-       rm -f $(DESTDIR)$(libdir)/libxengnttab.so
-       rm -f $(DESTDIR)$(libdir)/libxengnttab.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxengnttab.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxengnttab.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxengnttab.so.$(MAJOR).$(MINOR) libxengnttab.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xengnttab.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
new file mode 100644
index 0000000000..b680087653
--- /dev/null
+++ b/tools/libs/libs.mk
@@ -0,0 +1,95 @@
+# Common Makefile for building a lib.
+#
+# Variables taken as input:
+#   LIBNAME: name of lib to build, will be prepended with "libxen"
+#   MAJOR:   major version of lib
+#   MINOR:   minor version of lib
+#   USELIBS: xen libs to use (e.g. "toolcore toollog")
+
+SHLIB_LDFLAGS += -Wl,--version-script=libxen$(LIBNAME).map
+
+CFLAGS   += -Werror -Wmissing-prototypes
+CFLAGS   += -I./include $(CFLAGS_xeninclude)
+CFLAGS   += $(foreach lib, $(USELIBS), $(CFLAGS_libxen$(lib)))
+
+LDUSELIBS = $(foreach lib, $(USELIBS), $(LDLIBS_libxen$(lib)))
+
+LIB_OBJS := $(SRCS-y:.c=.o)
+PIC_OBJS := $(SRCS-y:.c=.opic)
+
+LIB := libxen$(LIBNAME).a
+ifneq ($(nosharedlibs),y)
+LIB += libxen$(LIBNAME).so
+endif
+
+PKG_CONFIG := xen$(LIBNAME).pc
+PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
+
+ifneq ($(CONFIG_LIBXC_MINIOS),y)
+PKG_CONFIG_INST := $(PKG_CONFIG)
+$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
+endif
+
+PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
+
+.PHONY: all
+all: build
+
+.PHONY: build
+build:
+       $(MAKE) libs
+
+.PHONY: libs
+libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
+
+headers.chk: $(wildcard include/*.h)
+
+libxen$(LIBNAME).a: $(LIB_OBJS)
+       $(AR) rc $@ $^
+
+libxen$(LIBNAME).so: libxen$(LIBNAME).so.$(MAJOR)
+       $(SYMLINK_SHLIB) $< $@
+libxen$(LIBNAME).so.$(MAJOR): libxen$(LIBNAME).so.$(MAJOR).$(MINOR)
+       $(SYMLINK_SHLIB) $< $@
+
+libxen$(LIBNAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
+       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxen$(LIBNAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) 
$(LDUSELIBS) $(APPEND_LDFLAGS)
+
+.PHONY: install
+install: build
+       $(INSTALL_DIR) $(DESTDIR)$(libdir)
+       $(INSTALL_DIR) $(DESTDIR)$(includedir)
+       $(INSTALL_SHLIB) libxen$(LIBNAME).so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)
+       $(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)
+       $(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
+       rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so
+       rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR)
+       rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).so.$(MAJOR).$(MINOR)
+       rm -f $(DESTDIR)$(libdir)/libxen$(LIBNAME).a
+
+.PHONY: TAGS
+TAGS:
+       etags -t *.c *.h
+
+.PHONY: clean
+clean:
+       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
+       rm -f libxen$(LIBNAME).so.$(MAJOR).$(MINOR) libxen$(LIBNAME).so.$(MAJOR)
+       rm -f headers.chk
+       rm -f xen$(LIBNAME).pc
+
+.PHONY: distclean
+distclean: clean
diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile
index 8b1d48b7c2..edce61dca4 100644
--- a/tools/libs/toolcore/Makefile
+++ b/tools/libs/toolcore/Makefile
@@ -3,100 +3,19 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR  = 1
 MINOR  = 0
-SHLIB_LDFLAGS += -Wl,--version-script=libxentoolcore.map
-
-CFLAGS += -Werror -Wmissing-prototypes
-CFLAGS += -I./include
-CFLAGS += $(CFLAGS_xeninclude)
+LIBNAME  := toolcore
 
 SRCS-y += handlereg.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxentoolcore.a
-ifneq ($(nosharedlibs),y)
-LIB += libxentoolcore.so
-endif
-
-PKG_CONFIG := xentoolcore.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENTOOLCORE)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 AUTOINCS=include/_xentoolcore_list.h
 
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
 $(LIB_OBJS): $(AUTOINCS)
 $(PIC_OBJS): $(AUTOINCS)
 
-headers.chk: $(wildcard include/*.h) $(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 >$@.new
        $(call move-if-changed,$@.new,$@)
-
-libxentoolcore.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxentoolcore.so: libxentoolcore.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxentoolcore.so.$(MAJOR): libxentoolcore.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxentoolcore.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxentoolcore.map
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxentoolcore.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxentoolcore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxentoolcore.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxentoolcore.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxentoolcore.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxentoolcore.so
-       $(INSTALL_DATA) include/xentoolcore.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xentoolcore.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uinstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xentoolcore.pc
-       rm -f $(DESTDIR)$(includedir)/xentoolcore.h
-       rm -f $(DESTDIR)$(libdir)/libxentoolcore.so
-       rm -f $(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxentoolcore.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxentoolcore.so.$(MAJOR).$(MINOR) libxentoolcore.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xentoolcore.pc
-
-.PHONY: distclean
-distclean: clean
diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile
index 8aae2c8f53..9156e5d08e 100644
--- a/tools/libs/toollog/Makefile
+++ b/tools/libs/toollog/Makefile
@@ -3,91 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR  = 1
 MINOR  = 0
-SHLIB_LDFLAGS += -Wl,--version-script=libxentoollog.map
-
-CFLAGS += -Werror -Wmissing-prototypes
-CFLAGS += -I./include
+LIBNAME  := toollog
 
 SRCS-y += xtl_core.c
 SRCS-y += xtl_logger_stdio.c
 
-LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
-PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
-
-LIB := libxentoollog.a
-ifneq ($(nosharedlibs),y)
-LIB += libxentoollog.so
-endif
-
-PKG_CONFIG := xentoollog.pc
-PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-
-ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
-$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
-endif
-
-PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+include $(XEN_ROOT)/tools/libs/libs.mk
 
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENTOOLLOG)/include
-$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
-       $(MAKE) libs
-
-.PHONY: libs
-libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
-
-headers.chk: $(wildcard include/*.h)
-
-libxentoollog.a: $(LIB_OBJS)
-       $(AR) rc $@ $^
-
-libxentoollog.so: libxentoollog.so.$(MAJOR)
-       $(SYMLINK_SHLIB) $< $@
-libxentoollog.so.$(MAJOR): libxentoollog.so.$(MAJOR).$(MINOR)
-       $(SYMLINK_SHLIB) $< $@
-
-libxentoollog.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxentoollog.map
-       $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxentoollog.so.$(MAJOR) 
$(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(APPEND_LDFLAGS)
-
-.PHONY: install
-install: build
-       $(INSTALL_DIR) $(DESTDIR)$(libdir)
-       $(INSTALL_DIR) $(DESTDIR)$(includedir)
-       $(INSTALL_SHLIB) libxentoollog.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
-       $(INSTALL_DATA) libxentoollog.a $(DESTDIR)$(libdir)
-       $(SYMLINK_SHLIB) libxentoollog.so.$(MAJOR).$(MINOR) 
$(DESTDIR)$(libdir)/libxentoollog.so.$(MAJOR)
-       $(SYMLINK_SHLIB) libxentoollog.so.$(MAJOR) 
$(DESTDIR)$(libdir)/libxentoollog.so
-       $(INSTALL_DATA) include/xentoollog.h $(DESTDIR)$(includedir)
-       $(INSTALL_DATA) xentoollog.pc $(DESTDIR)$(PKG_INSTALLDIR)
-
-.PHONY: uinstall
-uninstall:
-       rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xentoollog.pc
-       rm -f $(DESTDIR)$(includedir)/xentoollog.h
-       rm -f $(DESTDIR)$(libdir)/libxentoollog.so
-       rm -f $(DESTDIR)$(libdir)/libxentoollog.so.$(MAJOR)
-       rm -f $(DESTDIR)$(libdir)/libxentoollog.so.$(MAJOR).$(MINOR)
-       rm -f $(DESTDIR)$(libdir)/libxentoollog.a
-
-.PHONY: TAGS
-TAGS:
-       etags -t *.c *.h
-
-.PHONY: clean
-clean:
-       rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
-       rm -f libxentoollog.so.$(MAJOR).$(MINOR) libxentoollog.so.$(MAJOR)
-       rm -f headers.chk
-       rm -f xentoollog.pc
-
-.PHONY: distclean
-distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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