ia64/xen-unstable

view tools/libxc/Makefile @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 06d84bf87159
children f33f18fbf2cb
line source
2 INSTALL = install
3 INSTALL_PROG = $(INSTALL) -m0755
4 INSTALL_DATA = $(INSTALL) -m0644
5 INSTALL_DIR = $(INSTALL) -d -m0755
7 MAJOR = 3.0
8 MINOR = 0
10 CC = gcc
12 XEN_ROOT = ../..
13 include $(XEN_ROOT)/tools/Rules.mk
15 SRCS :=
16 BUILD_SRCS :=
17 SRCS += xc_bvtsched.c
18 SRCS += xc_core.c
19 SRCS += xc_domain.c
20 SRCS += xc_evtchn.c
21 SRCS += xc_gnttab.c
22 SRCS += xc_misc.c
23 SRCS += xc_physdev.c
24 SRCS += xc_private.c
25 SRCS += xc_sedf.c
26 BUILD_SRCS += xc_linux_build.c
27 BUILD_SRCS += xc_load_bin.c
28 BUILD_SRCS += xc_load_elf.c
30 ifeq ($(XEN_TARGET_ARCH),ia64)
31 BUILD_SRCS += xc_ia64_stubs.c
32 else
33 ifeq ($(XEN_TARGET_ARCH),x86_32)
34 SRCS += xc_ptrace.c
35 SRCS += xc_ptrace_core.c
36 endif
37 BUILD_SRCS += xc_load_aout9.c
38 BUILD_SRCS += xc_linux_restore.c
39 BUILD_SRCS += xc_linux_save.c
40 BUILD_SRCS += xc_vmx_build.c
41 endif
43 BUILD_SRCS += xg_private.c
45 CFLAGS += -Wall
46 CFLAGS += -Werror
47 CFLAGS += -O3
48 CFLAGS += -fno-strict-aliasing
49 CFLAGS += $(INCLUDES) -I.
50 # Get gcc to generate the dependencies for us.
51 CFLAGS += -Wp,-MD,.$(@F).d
52 LDFLAGS += -L.
53 DEPS = .*.d
55 LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
56 PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
58 LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS))
59 PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS))
61 LIB := libxenctrl.a
62 LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
64 LIB += libxenguest.a
65 LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
67 all: build
68 build: check-for-zlib mk-symlinks
69 $(MAKE) $(LIB)
71 check-for-zlib:
72 @if [ ! -e /usr/include/zlib.h ]; then \
73 echo "***********************************************************"; \
74 echo "ERROR: install zlib header files (http://www.gzip.org/zlib)"; \
75 echo "***********************************************************"; \
76 false; \
77 fi
79 LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
80 mk-symlinks:
81 [ -e xen/linux ] || mkdir -p xen/linux
82 [ -e xen/io ] || mkdir -p xen/io
83 ( cd xen >/dev/null ; \
84 ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
85 ( cd xen/io >/dev/null ; \
86 ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
87 ( cd xen/linux >/dev/null ; \
88 ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
90 install: build
91 [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
92 [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
93 $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
94 $(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
95 ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
96 ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
97 $(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include
99 $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
100 $(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
101 ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
102 ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
104 .PHONY: TAGS clean rpm install all
106 TAGS:
107 etags -t $(SRCS) *.h
109 clean:
110 rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
112 rpm: build
113 rm -rf staging
114 mkdir staging
115 mkdir staging/i386
116 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
117 --define "_rpmdir$$PWD/staging" -bb rpm.spec
118 mv staging/i386/*.rpm .
119 rm -rf staging
121 # libxenctrl
123 libxenctrl.a: $(LIB_OBJS)
124 $(AR) rc $@ $^
126 libxenctrl.so: libxenctrl.so.$(MAJOR)
127 ln -sf $< $@
128 libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
129 ln -sf $< $@
131 libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
132 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
134 # libxenguest
136 libxenguest.a: $(LIB_BUILD_OBJS)
137 $(AR) rc $@ $^
139 libxenguest.so: libxenguest.so.$(MAJOR)
140 ln -sf $< $@
141 libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
142 ln -sf $< $@
144 libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) libxenctrl.so
145 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl
147 -include $(DEPS)