debuggers.hg

view tools/xenstat/libxenstat/Makefile @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents d3de6f484610
children
line source
1 # libxenstat: statistics-collection library for Xen
2 # Copyright (C) International Business Machines Corp., 2005
3 # Author: Josh Triplett <josh@kernel.org>
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 XEN_ROOT=../../..
16 include $(XEN_ROOT)/tools/Rules.mk
18 prefix=$(PREFIX)
19 includedir=$(prefix)/include
20 libdir=$(prefix)/lib
22 LDCONFIG=ldconfig
23 MAKE_LINK=ln -sf
25 MAJOR=0
26 MINOR=0
28 LIB=src/libxenstat.a
29 SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR)
30 SHLIB_LINKS=src/libxenstat.so.$(MAJOR) src/libxenstat.so
31 OBJECTS-y=src/xenstat.o
32 OBJECTS-$(CONFIG_Linux) += src/xenstat_linux.o
33 OBJECTS-$(CONFIG_SunOS) += src/xenstat_solaris.o
34 OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
35 SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
37 WARN_FLAGS=-Wall -Werror
39 CFLAGS+=-Isrc -I$(XEN_LIBXC) -I$(XEN_XENSTORE) -I$(XEN_INCLUDE)
40 LDFLAGS+=-Lsrc -L$(XEN_XENSTORE)/ -L$(XEN_LIBXC)/
41 LDLIBS-y = -lxenstore -lxenctrl
42 LDLIBS-$(CONFIG_SunOS) += -lkstat
43 ARLIBS-y = $(XEN_XENSTORE)/libxenstore.so $(XEN_LIBXC)/libxenctrl.so
44 ARLIBS-x86_64 = /usr/lib/amd64/libkstat.so
45 ARLIBS-x86_32 = /usr/lib/libkstat.so
46 ARLIBS-$(CONFIG_SunOS) += $(ARLIBS-$(XEN_TARGET_ARCH))
48 .PHONY: all
49 all: $(LIB)
51 $(LIB): $(OBJECTS-y)
52 $(AR) rc $@ $^ $(ARLIBS-y)
53 $(RANLIB) $@
55 $(SHLIB): $(OBJECTS-y)
56 $(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
57 $(OBJECTS-y) $(LDLIBS-y)
59 src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h
60 $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
62 src/xenstat_linux.o: src/xenstat_linux.c src/xenstat_priv.h
63 $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
65 src/xenstat_solaris.o: src/xenstat_solaris.c src/xenstat_priv.h
66 $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
68 src/libxenstat.so.$(MAJOR): $(LIB)
69 $(MAKE_LINK) $(<F) $@
71 src/libxenstat.so: src/libxenstat.so.$(MAJOR)
72 $(MAKE_LINK) $(<F) $@
74 .PHONY: install
75 install: all
76 #install: all
77 # $(INSTALL_DATA) src/xenstat.h $(DESTDIR)$(includedir)/xenstat.h
78 # $(INSTALL_PROG) $(LIB) $(DESTDIR)$(libdir)/libxenstat.a
79 # $(INSTALL_PROG) $(SHLIB) \
80 # $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR).$(MINOR)
81 # $(MAKE_LINK) libxenstat.so.$(MAJOR).$(MINOR) \
82 # $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR)
83 # $(MAKE_LINK) libxenstat.so.$(MAJOR) \
84 # $(DESTDIR)$(libdir)/libxenstat.so
85 # -$(LDCONFIG)
87 PYLIB=bindings/swig/python/_xenstat.so
88 PYMOD=bindings/swig/python/xenstat.py
89 PYSRC=bindings/swig/python/_xenstat.c
90 PERLLIB=bindings/swig/perl/xenstat.so
91 PERLMOD=bindings/swig/perl/xenstat.pm
92 PERLSRC=bindings/swig/perl/xenstat.c
93 BINDINGS=$(PYLIB) $(PYMOD) $(PERLLIB) $(PERLMOD)
94 BINDINGSRC=$(PYSRC) $(PERLSRC)
96 # The all-bindings target builds all the language bindings
97 .PHONY: all-bindings
98 all-bindings: perl-bindings python-bindings
100 # The install-bindings target installs all the language bindings
101 install-bindings: install-perl-bindings install-python-bindings
103 $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
105 SWIG_FLAGS=-module xenstat -Isrc
107 # Python bindings
108 PYTHON_VERSION=2.3
109 PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
110 $(PYMOD): $(PYSRC)
111 $(PYSRC): bindings/swig/xenstat.i
112 swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
114 $(PYLIB): $(PYSRC)
115 $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
117 python-bindings: $(PYLIB) $(PYMOD)
119 pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
120 install-python-bindings: $(PYLIB) $(PYMOD)
121 $(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
122 $(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
124 ifeq ($(XENSTAT_PYTHON_BINDINGS),y)
125 .PHONY: all
126 all: python-bindings
127 install: install-python-bindings
128 endif
130 # Perl bindings
131 PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
132 $(PERLMOD): $(PERLSRC)
133 $(PERLSRC): bindings/swig/xenstat.i
134 swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
136 $(PERLLIB): $(PERLSRC)
137 $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
139 .PHONY: perl-bindings
140 perl-bindings: $(PERLLIB) $(PERLMOD)
142 .PHONY: install-perl-bindings
143 perllibdir=$(prefix)/lib/perl5
144 perlmoddir=$(prefix)/share/perl5
145 install-perl-bindings: $(PERLLIB) $(PERLMOD)
146 $(INSTALL_PROG) $(PERLLIB) $(DESTDIR)$(perllibdir)/xenstat.so
147 $(INSTALL_PROG) $(PERLMOD) $(DESTDIR)$(perlmoddir)/xenstat.pm
149 ifeq ($(XENSTAT_PERL_BINDINGS),y)
150 .PHONY: all
151 all: perl-bindings
153 .PHONY: install
154 install: install-perl-bindings
155 endif
157 .PHONY: clean
158 clean:
159 rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
160 $(BINDINGS) $(BINDINGSRC) $(DEPS)
162 -include $(DEPS)