source: trunk/packages/xen-3.1/xen-3.1/tools/libxen/Makefile.dist @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 3.5 KB
Line 
1#
2# Copyright (c) 2006-2007, XenSource Inc.
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
17#
18
19MAJOR = 1.0
20MINOR = 0
21
22CFLAGS = -Iinclude                     \
23         $(shell xml2-config --cflags) \
24         $(shell curl-config --cflags) \
25         -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
26
27LDFLAGS = $(shell xml2-config --libs) \
28          $(shell curl-config --libs)
29
30# -h for Solaris
31SONAME_LDFLAG ?= -soname
32# -R /usr/sfw/$(LIBDIR) -shared for Solaris
33SHLIB_CFLAGS ?= -shared
34
35# ginstall for Solaris
36INSTALL      = install
37INSTALL_DIR  = $(INSTALL) -d -m0755 -p
38INSTALL_DATA = $(INSTALL) -m0644 -p
39
40LIBXENAPI_HDRS = $(wildcard include/*.h)
41LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
42
43TEST_PROGRAMS = test/test_bindings test/test_event_handling
44
45TARBALL_DEST = libxenapi-$(MAJOR).$(MINOR)
46
47.PHONY: all
48all: $(TEST_PROGRAMS)
49
50libxenapi.so: libxenapi.so.$(MAJOR)
51        ln -sf $< $@
52
53libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
54        ln -sf $< $@
55
56libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
57        $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
58
59libxenapi.a: $(LIBXENAPI_OBJS)
60        $(AR) rcs libxenapi.a $^
61
62$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
63        $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
64
65
66.PHONY: install
67install: all
68        $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/api
69        $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
70        $(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
71        ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenapi.so.$(MAJOR)
72        ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenapi.so
73        $(INSTALL_DATA) libxenapi.a $(DESTDIR)/usr/$(LIBDIR)
74        for i in $(LIBXENAPI_HDRS); do \
75            $(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \
76        done
77
78
79.PHONY: tarball
80tarball: $(TARBALL_DEST).tar.bz2
81
82$(TARBALL_DEST).tar.bz2: all
83        rm -Rf $(TARBALL_DEST)
84        mkdir -p $(TARBALL_DEST)/include/xen/api
85        mkdir -p $(TARBALL_DEST)/src
86        mkdir -p $(TARBALL_DEST)/test
87        cp COPYING $(TARBALL_DEST)
88        cp Makefile.dist $(TARBALL_DEST)/Makefile
89        cp Makefile.dist $(TARBALL_DEST)/Makefile.dist
90        cp README $(TARBALL_DEST)
91        cp include/*.h $(TARBALL_DEST)/include
92        cp include/xen/api/*.h $(TARBALL_DEST)/include/xen/api
93        cp src/*.c $(TARBALL_DEST)/src
94        cp test/*.c $(TARBALL_DEST)/test
95        fakeroot chown root:root -R $(TARBALL_DEST)
96        fakeroot tar cjf $(TARBALL_DEST).tar.bz2 $(TARBALL_DEST)
97
98
99.PHONY: clean
100clean:
101        rm -f `find -name *.o`
102        rm -f libxenapi.so*
103        rm -f libxenapi.a
104        rm -f $(TEST_PROGRAMS)
105
106
107.PHONY: uberheader
108uberheader: include/xen/api/xen_all.h
109include/xen/api/xen_all.h::
110        echo "/* This file is autogenerated */" >$@
111        echo "#ifndef XEN_API_XEN_ALL_H" >>$@
112        echo "#define XEN_API_XEN_ALL_H" >>$@
113        ls include/xen/api/*.h | grep -v xen_all.h | grep -v _decl.h | \
114          sed 's,^include/\(.*\)$$,#include <\1>,g' >>$@
115        echo "#endif" >>$@
Note: See TracBrowser for help on using the repository browser.