ia64/xen-unstable

view tools/libxc/Makefile @ 5740:09cc6606517d

Tools build fixes.
author kaf24@firebug.cl.cam.ac.uk
date Mon Jul 11 16:04:22 2005 +0000 (2005-07-11)
parents 0b5f09002630
children a83ac0806d6b
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 SRCS += xc_sedf.c
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_load_aout9.c
23 SRCS += xc_load_bin.c
24 SRCS += xc_load_elf.c
25 SRCS += xc_linux_build.c
26 SRCS += xc_linux_restore.c
27 SRCS += xc_linux_save.c
28 SRCS += xc_misc.c
29 SRCS += xc_physdev.c
30 SRCS += xc_private.c
31 SRCS += xc_ptrace.c
32 SRCS += xc_ptrace_core.c
33 SRCS += xc_vmx_build.c
35 CFLAGS += -Wall
36 CFLAGS += -Werror
37 CFLAGS += -O3
38 CFLAGS += -fno-strict-aliasing
39 CFLAGS += $(INCLUDES) -I.
40 # Get gcc to generate the dependencies for us.
41 CFLAGS += -Wp,-MD,.$(@F).d
42 DEPS = .*.d
44 LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
45 PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
47 LIB := libxc.a libxc-pic.a
48 LIB += libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
50 all: build
51 build: check-for-zlib mk-symlinks
52 $(MAKE) $(LIB)
54 check-for-zlib:
55 @if [ ! -e /usr/include/zlib.h ]; then \
56 echo "***********************************************************"; \
57 echo "ERROR: install zlib header files (http://www.gzip.org/zlib)"; \
58 echo "***********************************************************"; \
59 false; \
60 fi
62 LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
63 mk-symlinks:
64 [ -e xen/linux ] || mkdir -p xen/linux
65 [ -e xen/io ] || mkdir -p xen/io
66 ( cd xen >/dev/null ; \
67 ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
68 ( cd xen/io >/dev/null ; \
69 ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
70 ( cd xen/linux >/dev/null ; \
71 ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
73 install: build
74 [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
75 [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
76 $(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
77 $(INSTALL_DATA) libxc.a $(DESTDIR)/usr/$(LIBDIR)
78 ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so.$(MAJOR)
79 ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so
80 $(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
82 .PHONY: TAGS clean rpm install all
84 TAGS:
85 etags -t $(SRCS) *.h
87 clean:
88 rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
90 rpm: build
91 rm -rf staging
92 mkdir staging
93 mkdir staging/i386
94 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
95 --define "_rpmdir$$PWD/staging" -bb rpm.spec
96 mv staging/i386/*.rpm .
97 rm -rf staging
99 libxc.a: $(LIB_OBJS)
100 $(AR) rc $@ $^
102 libxc-pic.a: $(PIC_OBJS)
103 $(AR) rc $@ $^
105 libxc.so: libxc.so.$(MAJOR)
106 ln -sf $< $@
107 libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
108 ln -sf $< $@
110 libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
111 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -lz
113 -include $(DEPS)