1XEN_ROOT = $(CURDIR)/../../.. 2include $(XEN_ROOT)/tools/Rules.mk 3 4MAJOR = 1 5MINOR = 0 6SHLIB_LDFLAGS += -Wl,--version-script=libxentoolcore.map 7 8CFLAGS += -Werror -Wmissing-prototypes 9CFLAGS += -I./include 10CFLAGS += $(CFLAGS_xeninclude) 11 12SRCS-y += handlereg.c 13 14LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y)) 15PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y)) 16 17LIB := libxentoolcore.a 18ifneq ($(nosharedlibs),y) 19LIB += libxentoolcore.so 20endif 21 22PKG_CONFIG := xentoolcore.pc 23PKG_CONFIG_VERSION := $(MAJOR).$(MINOR) 24 25ifneq ($(CONFIG_LIBXC_MINIOS),y) 26PKG_CONFIG_INST := $(PKG_CONFIG) 27$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix) 28$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir) 29$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir) 30endif 31 32PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc)) 33 34$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT) 35$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXENTOOLCORE)/include 36$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR) 37 38AUTOINCS=include/_xentoolcore_list.h 39 40.PHONY: all 41all: build 42 43.PHONY: build 44build: 45 $(MAKE) libs 46 47.PHONY: libs 48libs: headers.chk $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) 49 50$(LIB_OBJS): $(AUTOINCS) 51$(PIC_OBJS): $(AUTOINCS) 52 53headers.chk: $(wildcard include/*.h) $(AUTOINCS) 54 55include/_xentoolcore_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h 56 $(PERL) $^ --prefix=xentoolcore >$@.new 57 $(call move-if-changed,$@.new,$@) 58 59libxentoolcore.a: $(LIB_OBJS) 60 $(AR) rc $@ $^ 61 62libxentoolcore.so: libxentoolcore.so.$(MAJOR) 63 $(SYMLINK_SHLIB) $< $@ 64libxentoolcore.so.$(MAJOR): libxentoolcore.so.$(MAJOR).$(MINOR) 65 $(SYMLINK_SHLIB) $< $@ 66 67libxentoolcore.so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxentoolcore.map 68 $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxentoolcore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(APPEND_LDFLAGS) 69 70.PHONY: install 71install: build 72 $(INSTALL_DIR) $(DESTDIR)$(libdir) 73 $(INSTALL_DIR) $(DESTDIR)$(includedir) 74 $(INSTALL_SHLIB) libxentoolcore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) 75 $(INSTALL_DATA) libxentoolcore.a $(DESTDIR)$(libdir) 76 $(SYMLINK_SHLIB) libxentoolcore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR) 77 $(SYMLINK_SHLIB) libxentoolcore.so.$(MAJOR) $(DESTDIR)$(libdir)/libxentoolcore.so 78 $(INSTALL_DATA) include/xentoolcore.h $(DESTDIR)$(includedir) 79 $(INSTALL_DATA) xentoolcore.pc $(DESTDIR)$(PKG_INSTALLDIR) 80 81.PHONY: uinstall 82uninstall: 83 rm -f $(DESTDIR)$(PKG_INSTALLDIR)/xentoolcore.pc 84 rm -f $(DESTDIR)$(includedir)/xentoolcore.h 85 rm -f $(DESTDIR)$(libdir)/libxentoolcore.so 86 rm -f $(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR) 87 rm -f $(DESTDIR)$(libdir)/libxentoolcore.so.$(MAJOR).$(MINOR) 88 rm -f $(DESTDIR)$(libdir)/libxentoolcore.a 89 90.PHONY: TAGS 91TAGS: 92 etags -t *.c *.h 93 94.PHONY: clean 95clean: 96 rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS) 97 rm -f libxentoolcore.so.$(MAJOR).$(MINOR) libxentoolcore.so.$(MAJOR) 98 rm -f headers.chk 99 rm -f xentoolcore.pc 100 101.PHONY: distclean 102distclean: clean 103