ia64/xen-unstable

view tools/libxc/Makefile @ 13633:a754192ffce6

libelf: add to libxc

This patch makes libelf available to the tools, by symlinking the source
files and compiling them into libxc.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
tools/libxc/Makefile | 15 +++++++++++++++
1 file changed, 15 insertions(+)
author Emmanuel Ackaouy <ack@xensource.com>
date Thu Jan 25 22:16:52 2007 +0000 (2007-01-25)
parents 9f27746eff43
children fd50500eee7c
line source
1 XEN_ROOT = ../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 MAJOR = 3.0
5 MINOR = 0
7 CTRL_SRCS-y :=
8 CTRL_SRCS-y += xc_core.c
9 CTRL_SRCS-y += xc_domain.c
10 CTRL_SRCS-y += xc_evtchn.c
11 CTRL_SRCS-y += xc_misc.c
12 CTRL_SRCS-y += xc_acm.c
13 CTRL_SRCS-y += xc_physdev.c
14 CTRL_SRCS-y += xc_private.c
15 CTRL_SRCS-y += xc_sedf.c
16 CTRL_SRCS-y += xc_csched.c
17 CTRL_SRCS-y += xc_tbuf.c
18 CTRL_SRCS-y += xc_resume.c
19 CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
20 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
21 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
22 CTRL_SRCS-$(CONFIG_X86_Linux) += xc_ptrace.c xc_ptrace_core.c
24 GUEST_SRCS-y :=
25 GUEST_SRCS-y += xc_load_bin.c
26 GUEST_SRCS-y += xc_load_elf.c
27 GUEST_SRCS-y += xg_private.c
28 GUEST_SRCS-$(CONFIG_X86) += xc_linux_build.c
29 GUEST_SRCS-$(CONFIG_IA64) += xc_linux_build.c
30 GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c
31 GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c xc_hvm_restore.c xc_hvm_save.c
33 # symlink libelf from xen/common/libelf/
34 LIBELF_SRCS := libelf-tools.c libelf-loader.c
35 LIBELF_SRCS += libelf-dominfo.c libelf-relocate.c
37 libelf-tools.o: libelf-tools.c libelf-private.h
38 libelf-loader.o: libelf-loader.c libelf-private.h
39 libelf-dominfo.o: libelf-dominfo.c libelf-private.h
40 libelf-relocate.o: libelf-relocate.c libelf-private.h
42 $(LIBELF_SRCS) libelf-private.h:
43 ln -s ../../xen/common/libelf/$@ $@
45 # add libelf bits to libxc
46 GUEST_SRCS-y += $(LIBELF_SRCS)
48 -include $(XEN_TARGET_ARCH)/Makefile
50 CFLAGS += -Werror -Wmissing-prototypes
51 CFLAGS += -fno-strict-aliasing
52 CFLAGS += $(INCLUDES) -I.
54 # Define this to make it possible to run valgrind on code linked with these
55 # libraries.
56 #CFLAGS += -DVALGRIND -O0 -ggdb3
58 # Get gcc to generate the dependencies for us.
59 CFLAGS += -Wp,-MD,.$(@F).d
60 LDFLAGS += -L.
61 DEPS = .*.d
63 CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y))
64 CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
66 GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y))
67 GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y))
69 LIB := libxenctrl.a
70 LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
72 LIB += libxenguest.a
73 LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
75 .PHONY: all
76 all: build
78 .PHONY: build
79 build: check-for-zlib mk-symlinks
80 $(MAKE) $(LIB)
82 .PHONY: check-for-zlib
83 check-for-zlib:
84 @if [ ! -e /usr/include/zlib.h ]; then \
85 echo "***********************************************************"; \
86 echo "ERROR: install zlib header files (http://www.gzip.org/zlib)"; \
87 echo "***********************************************************"; \
88 false; \
89 fi
91 .PHONY: install
92 install: build
93 [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
94 [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
95 $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
96 $(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
97 ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
98 ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
99 $(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include
101 $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
102 $(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
103 ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
104 ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
105 $(INSTALL_DATA) xenguest.h $(DESTDIR)/usr/include
107 .PHONY: TAGS
108 TAGS:
109 etags -t *.c *.h
111 .PHONY: clean
112 clean:
113 rm -rf *.rpm $(LIB) *~ $(DEPS) xen \
114 $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
115 $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS)
117 .PHONY: rpm
118 rpm: build
119 rm -rf staging
120 mkdir staging
121 mkdir staging/i386
122 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
123 --define "_rpmdir$$PWD/staging" -bb rpm.spec
124 mv staging/i386/*.rpm .
125 rm -rf staging
127 # libxenctrl
129 libxenctrl.a: $(CTRL_LIB_OBJS)
130 $(AR) rc $@ $^
132 libxenctrl.so: libxenctrl.so.$(MAJOR)
133 ln -sf $< $@
134 libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
135 ln -sf $< $@
137 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
138 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ -lpthread
140 # libxenguest
142 libxenguest.a: $(GUEST_LIB_OBJS)
143 $(AR) rc $@ $^
145 libxenguest.so: libxenguest.so.$(MAJOR)
146 ln -sf $< $@
147 libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
148 ln -sf $< $@
150 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
151 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl -lpthread
153 -include $(DEPS)