debuggers.hg

view tools/libxc/Makefile @ 3698:f9b3b23cf5ff

bitkeeper revision 1.1159.223.66 (42048ef5frMFQFFm-sKDC6PrU8yraQ)

Name: pic-lib.patch
Description: support PIC code generation
Libraries have 2 methods of being compiled; a .so must contain non-pic
objects, while the .a can contain standard objects.
Signed-off-by: Adam Heath <doogie@brainfood.com>
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Sat Feb 05 09:16:37 2005 +0000 (2005-02-05)
parents 0c8d62df84ae
children 09723a1de726 e264eb30eba0
line source
1 INSTALL = install
2 INSTALL_PROG = $(INSTALL) -m0755
3 INSTALL_DATA = $(INSTALL) -m0644
4 INSTALL_DIR = $(INSTALL) -d -m0755
6 MAJOR = 2.0
7 MINOR = 0
8 LIB_NAME = libxc
9 SONAME = $(LIB_NAME).so.$(MAJOR)
11 CC = gcc
13 XEN_ROOT = ../..
14 include $(XEN_ROOT)/tools/Rules.mk
16 vpath %c $(XEN_LIBXUTIL)
17 INCLUDES += -I $(XEN_LIBXUTIL)
19 SRCS :=
20 SRCS += xc_atropos.c
21 SRCS += xc_bvtsched.c
22 SRCS += xc_domain.c
23 SRCS += xc_evtchn.c
24 SRCS += xc_io.c
25 SRCS += xc_linux_build.c
26 SRCS += xc_plan9_build.c
27 SRCS += xc_linux_restore.c
28 SRCS += xc_linux_save.c
29 SRCS += xc_misc.c
30 SRCS += xc_physdev.c
31 SRCS += xc_private.c
32 SRCS += xc_rrobin.c
34 CFLAGS += -Wall
35 CFLAGS += -Werror
36 CFLAGS += -O3
37 CFLAGS += -fno-strict-aliasing
38 CFLAGS += $(INCLUDES) -I.
39 # Get gcc to generate the dependencies for us.
40 CFLAGS += -Wp,-MD,.$(@F).d
41 DEPS = .*.d
43 OBJS := $(patsubst %.c,%.o,$(SRCS))
44 PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
46 LIB := $(LIB_NAME).a $(LIB_NAME).so $(LIB_NAME).so.$(MAJOR) $(LIB_NAME).so.$(MAJOR).$(MINOR)
48 all: check-for-zlib mk-symlinks
49 $(MAKE) $(LIB)
51 check-for-zlib:
52 @if [ ! -e /usr/include/zlib.h ]; then \
53 echo "***********************************************************"; \
54 echo "ERROR: install zlib header files (http://www.gzip.org/zlib)"; \
55 echo "***********************************************************"; \
56 false; \
57 fi
59 LINUX_ROOT := $(wildcard $(XEN_ROOT)/linux-2.6.*-xen-sparse)
60 mk-symlinks:
61 [ -e xen/linux ] || mkdir -p xen/linux
62 [ -e xen/io ] || mkdir -p xen/io
63 ( cd xen >/dev/null ; \
64 ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
65 ( cd xen/io >/dev/null ; \
66 ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
67 ( cd xen/linux >/dev/null ; \
68 ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
70 install: all
71 [ -d $(DESTDIR)/usr/lib ] || $(INSTALL_DIR) $(DESTDIR)/usr/lib
72 [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
73 $(INSTALL_PROG) $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
74 $(INSTALL_DATA) $(LIB_NAME).a $(DESTDIR)/usr/lib
75 ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
76 ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
77 $(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
79 clean:
80 rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
82 rpm: all
83 rm -rf staging
84 mkdir staging
85 mkdir staging/i386
86 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
87 --define "_rpmdir$$PWD/staging" -bb rpm.spec
88 mv staging/i386/*.rpm .
89 rm -rf staging
91 $(PIC_OBJS): %.opic: %.c
92 $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
94 $(LIB_NAME).a: $(OBJS)
95 $(AR) rc $@ $^
97 $(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
98 ln -sf $< $@
99 $(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
100 ln -sf $< $@
101 $(LIB_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS)
102 $(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
104 -include $(DEPS)