ia64/xen-unstable

changeset 3664:e264eb30eba0

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
author kaf24@scramble.cl.cam.ac.uk
date Sat Feb 05 10:31:37 2005 +0000 (2005-02-05)
parents f9b3b23cf5ff
children 5039176029e8 c4a7f635b2cd 018ea84397ab
files tools/libxc/Makefile tools/libxutil/Makefile
line diff
     1.1 --- a/tools/libxc/Makefile	Sat Feb 05 09:16:37 2005 +0000
     1.2 +++ b/tools/libxc/Makefile	Sat Feb 05 10:31:37 2005 +0000
     1.3 @@ -1,3 +1,12 @@
     1.4 +
     1.5 +ifndef BUILD_PIC_LIBS
     1.6 +ifeq ($(wildcard /etc/debian_version),)
     1.7 +BUILD_PIC_LIBS=n
     1.8 +else
     1.9 +BUILD_PIC_LIBS=y
    1.10 +endif
    1.11 +endif
    1.12 +
    1.13  INSTALL		= install
    1.14  INSTALL_PROG	= $(INSTALL) -m0755
    1.15  INSTALL_DATA	= $(INSTALL) -m0644
    1.16 @@ -5,8 +14,6 @@ INSTALL_DIR	= $(INSTALL) -d -m0755
    1.17  
    1.18  MAJOR    = 2.0
    1.19  MINOR    = 0
    1.20 -LIB_NAME = libxc
    1.21 -SONAME   = $(LIB_NAME).so.$(MAJOR)
    1.22  
    1.23  CC       = gcc
    1.24  
    1.25 @@ -40,10 +47,10 @@ CFLAGS   += $(INCLUDES) -I.
    1.26  CFLAGS   += -Wp,-MD,.$(@F).d
    1.27  DEPS     = .*.d
    1.28  
    1.29 -OBJS     := $(patsubst %.c,%.o,$(SRCS))
    1.30 +LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
    1.31  PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
    1.32  
    1.33 -LIB		:= $(LIB_NAME).a $(LIB_NAME).so $(LIB_NAME).so.$(MAJOR) $(LIB_NAME).so.$(MAJOR).$(MINOR)
    1.34 +LIB      := libxc.a libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
    1.35  
    1.36  all: check-for-zlib mk-symlinks
    1.37  	$(MAKE) $(LIB)
    1.38 @@ -70,14 +77,14 @@ mk-symlinks:
    1.39  install: all
    1.40  	[ -d $(DESTDIR)/usr/lib ] || $(INSTALL_DIR) $(DESTDIR)/usr/lib
    1.41  	[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
    1.42 -	$(INSTALL_PROG) $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
    1.43 -	$(INSTALL_DATA) $(LIB_NAME).a $(DESTDIR)/usr/lib
    1.44 -	ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
    1.45 -	ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
    1.46 +	$(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
    1.47 +	$(INSTALL_DATA) libxc.a $(DESTDIR)/usr/lib
    1.48 +	ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/libxc.so.$(MAJOR)
    1.49 +	ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/lib/libxc.so
    1.50  	$(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
    1.51  
    1.52  clean:
    1.53 -	rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
    1.54 +	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
    1.55  
    1.56  rpm: all
    1.57  	rm -rf staging
    1.58 @@ -90,15 +97,21 @@ rpm: all
    1.59  
    1.60  $(PIC_OBJS): %.opic: %.c
    1.61  	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
    1.62 -	
    1.63 -$(LIB_NAME).a: $(OBJS)
    1.64 +
    1.65 +libxc.a: $(OBJS)
    1.66  	$(AR) rc $@ $^
    1.67  
    1.68 -$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
    1.69 +libxc.so: libxc.so.$(MAJOR)
    1.70 +	ln -sf $< $@
    1.71 +libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
    1.72  	ln -sf $< $@
    1.73 -$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
    1.74 -	ln -sf $< $@
    1.75 -$(LIB_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    1.76 -	$(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
    1.77 +
    1.78 +ifeq ($(BUILD_PIC_LIBS),y)
    1.79 +libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    1.80 +	$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
    1.81 +else
    1.82 +libxc.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
    1.83 +	$(CC) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -L../libxutil -lxutil -lz
    1.84 +endif
    1.85  
    1.86  -include $(DEPS)
     2.1 --- a/tools/libxutil/Makefile	Sat Feb 05 09:16:37 2005 +0000
     2.2 +++ b/tools/libxutil/Makefile	Sat Feb 05 10:31:37 2005 +0000
     2.3 @@ -1,3 +1,12 @@
     2.4 +
     2.5 +ifndef BUILD_PIC_LIBS
     2.6 +ifeq ($(wildcard /etc/debian_version),)
     2.7 +BUILD_PIC_LIBS=n
     2.8 +else
     2.9 +BUILD_PIC_LIBS=y
    2.10 +endif
    2.11 +endif
    2.12 +
    2.13  XEN_ROOT = ../..
    2.14  INSTALL		= install
    2.15  INSTALL_DATA	= $(INSTALL) -m0644
    2.16 @@ -24,7 +33,7 @@ LIB_SRCS += sys_string.c
    2.17  LIB_SRCS += util.c
    2.18  
    2.19  LIB_OBJS := $(LIB_SRCS:.c=.o)
    2.20 -LIB_PIC_OBJS := $(LIB_SRCS:.c=.opic)
    2.21 +PIC_OBJS := $(LIB_SRCS:.c=.opic)
    2.22  
    2.23  CFLAGS   += -Wall -Werror -O3 -fno-strict-aliasing
    2.24  
    2.25 @@ -34,29 +43,32 @@ DEPS     = .*.d
    2.26  
    2.27  MAJOR    := 2.0
    2.28  MINOR    := 0
    2.29 -LIB_NAME := libxutil
    2.30 -SO_NAME  := $(LIB_NAME).so.$(MAJOR)
    2.31 -LIB      := $(LIB_NAME).so 
    2.32 -LIB      += $(LIB_NAME).so.$(MAJOR)
    2.33 -LIB      += $(LIB_NAME).so.$(MAJOR).$(MINOR)
    2.34 -LIB      += $(LIB_NAME).a
    2.35 +LIB      := libxutil.so 
    2.36 +LIB      += libxutil.so.$(MAJOR)
    2.37 +LIB      += libxutil.so.$(MAJOR).$(MINOR)
    2.38 +LIB      += libxutil.a
    2.39  
    2.40  all: check-for-zlib
    2.41  	$(MAKE) $(LIB)
    2.42  
    2.43 -$(LIB_PIC_OBJS): %.opic: %.c
    2.44 +$(PIC_OBJS): %.opic: %.c
    2.45  	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
    2.46  
    2.47 -$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
    2.48 +libxutil.so: libxutil.so.$(MAJOR)
    2.49 +	ln -sf $^ $@
    2.50 +
    2.51 +libxutil.so.$(MAJOR): libxutil.so.$(MAJOR).$(MINOR)
    2.52  	ln -sf $^ $@
    2.53  
    2.54 -$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
    2.55 -	ln -sf $^ $@
    2.56 +ifeq ($(BUILD_PIC_LIBS),y)
    2.57 +libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    2.58 +	$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
    2.59 +else
    2.60 +libxutil.so.$(MAJOR).$(MINOR): $(LIB_OBJS)
    2.61 +	$(CC) -Wl,-soname -Wl,libxutil.so.$(MAJOR) -shared -o $@ $^
    2.62 +endif
    2.63  
    2.64 -$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_PIC_OBJS)
    2.65 -	$(CC) -Wl,-soname -Wl,$(SO_NAME) -shared -o $@ $^
    2.66 -
    2.67 -$(LIB_NAME).a: $(LIB_OBJS)
    2.68 +libxutil.a: $(LIB_OBJS)
    2.69  	$(AR) rc $@ $^
    2.70  
    2.71  check-for-zlib:
    2.72 @@ -69,13 +81,13 @@ check-for-zlib:
    2.73  
    2.74  install: all
    2.75  	[ -d $(DESTDIR)/usr/lib ] || $(INSTALL_DIR) -p $(DESTDIR)/usr/lib
    2.76 -	$(INSTALL_PROG) $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
    2.77 -	$(INSTALL_DATA) $(LIB_NAME).a $(DESTDIR)/usr/lib
    2.78 -	ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so.$(MAJOR)
    2.79 -	ln -sf $(LIB_NAME).so.$(MAJOR) $(DESTDIR)/usr/lib/$(LIB_NAME).so
    2.80 +	$(INSTALL_PROG) libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib
    2.81 +	$(INSTALL_DATA) libxutil.a $(DESTDIR)/usr/lib
    2.82 +	ln -sf libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/lib/libxutil.so.$(MAJOR)
    2.83 +	ln -sf libxutil.so.$(MAJOR) $(DESTDIR)/usr/lib/libxutil.so
    2.84  
    2.85  clean:
    2.86 -	$(RM) *.a *.so *.so.* *.o *.opic *.rpm 
    2.87 +	$(RM) *.a *.so* *.o *.opic *.rpm 
    2.88  	$(RM) *~
    2.89  	$(RM) $(DEPS)
    2.90