Skip to contentSkip to conversation

tools/libs: put common Makefile parts into new libs.mk

PATCH Superseded Juergen Gross 2 participants 2 messages Sep 3, 2019 – Sep 16, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

---
 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(-)
 create mode 100644 tools/libs/libs.mk
tools/libs/call/Makefile +3 -83
index 6291e6dfe7..d30476add6 100644
@@ -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 ../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
tools/libs/devicemodel/Makefile +3 -85

100 lines not on this page · raw message

tools/libs/evtchn/Makefile +3 -83

97 lines not on this page · raw message

tools/libs/foreignmemory/Makefile +3 -83

98 lines not on this page · raw message

tools/libs/gnttab/Makefile +3 -83

98 lines not on this page · raw message

tools/libs/libs.mk new file +95 -0

95 lines not on this page · raw message

tools/libs/toolcore/Makefile +2 -83

102 lines not on this page · raw message

tools/libs/toollog/Makefile +2 -82

93 lines not on this page · raw message

Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel