bitkeeper revision 1.1159.223.67 (4204a089yB7FSdCp0Isa4dMFs_V3qQ)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 5 Feb 2005 10:31:37 +0000 (10:31 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sat, 5 Feb 2005 10:31:37 +0000 (10:31 +0000)
Building PIC .so libs is now optional. Defaults to enabled for Debian.
Signed-off-by: keir.fraser@cl.cam.ac.uk
tools/libxc/Makefile
tools/libxutil/Makefile

index db605acdd2c0d2a9b38c572dc51d249edb74f91a..770b40032683c200920a48fc6ac9766a7be94260 100644 (file)
@@ -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)
index d9ac3b6e32391f773901451dc956cf24dfc80b9c..595cd97e83a54e650f5c723e27723a874f15eefb 100644 (file)
@@ -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)