mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
bitkeeper revision 1.1159.223.67 (4204a089yB7FSdCp0Isa4dMFs_V3qQ)
Building PIC .so libs is now optional. Defaults to enabled for Debian. Signed-off-by: keir.fraser@cl.cam.ac.uk
This commit is contained in:
1 parent
d8ab68ec41
commit
fc3efe0ada
2 files changed
+58
-33
No files matched your search
+28
-15
@@ -1,3 +1,12 @@
|
||||
|
||||
ifndef BUILD_PIC_LIBS
|
||||
ifeq ($(wildcard /etc/debian_version),)
|
||||
BUILD_PIC_LIBS=n
|
||||
else
|
||||
BUILD_PIC_LIBS=y
|
||||
endif
|
||||
endif
|
||||
|
||||
INSTALL = install
|
||||
INSTALL_PROG = $(INSTALL) -m0755
|
||||
INSTALL_DATA = $(INSTALL) -m0644
|
||||
@@ -5,8 +14,6 @@ INSTALL_DIR = $(INSTALL) -d -m0755
|
||||
|
||||
MAJOR = 2.0
|
||||
MINOR = 0
|
||||
LIB_NAME = libxc
|
||||
SONAME = $(LIB_NAME).so.$(MAJOR)
|
||||
|
||||
CC = gcc
|
||||
|
||||
@@ -40,10 +47,10 @@ CFLAGS += $(INCLUDES) -I.
|
||||
CFLAGS += -Wp,-MD,.$(@F).d
|
||||
DEPS = .*.d
|
||||
|
||||
OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
|
||||
|
||||
LIB := $(LIB_NAME).a $(LIB_NAME).so $(LIB_NAME).so.$(MAJOR) $(LIB_NAME).so.$(MAJOR).$(MINOR)
|
||||
LIB := libxc.a libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
|
||||
|
||||
all: check-for-zlib mk-symlinks
|
||||
$(MAKE) $(LIB)
|
||||
@@ -70,14 +77,14 @@ mk-symlinks:
|
||||
install: all
|
||||
[ -d $(DESTDIR)/usr/lib ] || $(INSTALL_DIR) $(DESTDIR)/usr/lib
|
||||
[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
|
||||
$(INSTALL_PROG) $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
|
||||
$(INSTALL_DATA) $(LIB_NAME).a $(DESTDIR)/usr/lib
|
||||
ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
|
||||
ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
|
||||
$(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
|
||||
$(INSTALL_DATA) libxc.a $(DESTDIR)/usr/lib
|
||||
ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/libxc.so.$(MAJOR)
|
||||
ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/lib/libxc.so
|
||||
$(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
|
||||
|
||||
clean:
|
||||
rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
|
||||
rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
|
||||
|
||||
rpm: all
|
||||
rm -rf staging
|
||||
@@ -90,15 +97,21 @@ rpm: all
|
||||
|
||||
$(PIC_OBJS): %.opic: %.c
|
||||
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
|
||||
|
||||
$(LIB_NAME).a: $(OBJS)
|
||||
|
||||
libxc.a: $(OBJS)
|
||||
$(AR) rc $@ $^
|
||||
|
||||
$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
|
||||
libxc.so: libxc.so.$(MAJOR)
|
||||
ln -sf $< $@
|
||||
$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
|
||||
libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
|
||||
ln -sf $< $@
|
||||
$(LIB_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
|
||||
|
||||
ifeq ($(BUILD_PIC_LIBS),y)
|
||||
libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
|
||||
else
|
||||
libxc.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
|
||||
endif
|
||||
|
||||
-include $(DEPS)
|
||||
+30
-18
@@ -1,3 +1,12 @@
|
||||
|
||||
ifndef BUILD_PIC_LIBS
|
||||
ifeq ($(wildcard /etc/debian_version),)
|
||||
BUILD_PIC_LIBS=n
|
||||
else
|
||||
BUILD_PIC_LIBS=y
|
||||
endif
|
||||
endif
|
||||
|
||||
XEN_ROOT = ../..
|
||||
INSTALL = install
|
||||
INSTALL_DATA = $(INSTALL) -m0644
|
||||
@@ -24,7 +33,7 @@ LIB_SRCS += sys_string.c
|
||||
LIB_SRCS += util.c
|
||||
|
||||
LIB_OBJS := $(LIB_SRCS:.c=.o)
|
||||
LIB_PIC_OBJS := $(LIB_SRCS:.c=.opic)
|
||||
PIC_OBJS := $(LIB_SRCS:.c=.opic)
|
||||
|
||||
CFLAGS += -Wall -Werror -O3 -fno-strict-aliasing
|
||||
|
||||
@@ -34,29 +43,32 @@ DEPS = .*.d
|
||||
|
||||
MAJOR := 2.0
|
||||
MINOR := 0
|
||||
LIB_NAME := libxutil
|
||||
SO_NAME := $(LIB_NAME).so.$(MAJOR)
|
||||
LIB := $(LIB_NAME).so
|
||||
LIB += $(LIB_NAME).so.$(MAJOR)
|
||||
LIB += $(LIB_NAME).so.$(MAJOR).$(MINOR)
|
||||
LIB += $(LIB_NAME).a
|
||||
LIB := libxutil.so
|
||||
LIB += libxutil.so.$(MAJOR)
|
||||
LIB += libxutil.so.$(MAJOR).$(MINOR)
|
||||
LIB += libxutil.a
|
||||
|
||||
all: check-for-zlib
|
||||
$(MAKE) $(LIB)
|
||||
|
||||
$(LIB_PIC_OBJS): %.opic: %.c
|
||||
$(PIC_OBJS): %.opic: %.c
|
||||
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
|
||||
|
||||
$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
|
||||
libxutil.so: libxutil.so.$(MAJOR)
|
||||
ln -sf $^ $@
|
||||
|
||||
$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
|
||||
libxutil.so.$(MAJOR): libxutil.so.$(MAJOR).$(MINOR)
|
||||
ln -sf $^ $@
|
||||
|
||||
$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_PIC_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,$(SO_NAME) -shared -o $@ $^
|
||||
ifeq ($(BUILD_PIC_LIBS),y)
|
||||
libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
|
||||
else
|
||||
libxutil.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
|
||||
$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
|
||||
endif
|
||||
|
||||
$(LIB_NAME).a: $(LIB_OBJS)
|
||||
libxutil.a: $(LIB_OBJS)
|
||||
$(AR) rc $@ $^
|
||||
|
||||
check-for-zlib:
|
||||
@@ -69,13 +81,13 @@ check-for-zlib:
|
||||
|
||||
install: all
|
||||
[ -d $(DESTDIR)/usr/lib ] || $(INSTALL_DIR) -p $(DESTDIR)/usr/lib
|
||||
$(INSTALL_PROG) $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
|
||||
$(INSTALL_DATA) $(LIB_NAME).a $(DESTDIR)/usr/lib
|
||||
ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
|
||||
ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
|
||||
$(INSTALL_PROG) libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
|
||||
$(INSTALL_DATA) libxutil.a $(DESTDIR)/usr/lib
|
||||
ln -sf libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/libxutil.so.$(MAJOR)
|
||||
ln -sf libxutil.so.$(MAJOR) $(DESTDIR)/usr/lib/libxutil.so
|
||||
|
||||
clean:
|
||||
$(RM) *.a *.so *.so.* *.o *.opic *.rpm
|
||||
$(RM) *.a *.so* *.o *.opic *.rpm
|
||||
$(RM) *~
|
||||
$(RM) $(DEPS)
|
||||
|
||||
|
||||