bitkeeper revision 1.1159.223.16 (41f2c5dbDRm_plztIOBiTaL3Nj5qAQ)

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.

From: Adam Heath <doogie@brainfood.com>
Signed-off-by: ian.pratt@cl.cam.ac.uk
This commit is contained in:
iap10@labyrinth.cl.cam.ac.uk committed 2005-01-22 21:30:03 +00:00
1 parent 8895336d36
commit 7ebea330c9
2 files changed
+29 -16

No files matched your search

+21 -13
View File
@@ -1,7 +1,8 @@
MAJOR = 2.0
MINOR = 0
SONAME = libxc.so.$(MAJOR)
MAJOR := 2.0
MINOR := 0
LIB_NAME := libxc
SONAME := $(LIB_NAME).so.$(MAJOR)
CC = gcc
@@ -35,9 +36,10 @@ CFLAGS += $(INCLUDES) -I.
CFLAGS += -Wp,-MD,.$(@F).d
DEPS = .*.d
OBJS = $(patsubst %.c,%.o,$(SRCS))
OBJS := $(patsubst %.c,%.o,$(SRCS))
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
LIB = libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
LIB := $(LIB_NAME).a $(LIB_NAME).so $(LIB_NAME).so.$(MAJOR) $(LIB_NAME).so.$(MAJOR).$(MINOR)
all: check-for-zlib mk-symlinks
$(MAKE) $(LIB)
@@ -65,12 +67,12 @@ install: all
mkdir -p $(prefix)/usr/lib
mkdir -p $(prefix)/usr/include
install -m0755 $(LIB) $(prefix)/usr/lib
ln -sf libxc.so.$(MAJOR).$(MINOR) $(prefix)/usr/lib/libxc.so.$(MAJOR)
ln -sf libxc.so.$(MAJOR) $(prefix)/usr/lib/libxc.so
ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR)
ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so
install -m0644 xc.h $(prefix)/usr/include
clean:
rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen
rm -rf *.a *.so *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
rpm: all
rm -rf staging
@@ -81,11 +83,17 @@ rpm: all
mv staging/i386/*.rpm .
rm -rf staging
libxc.so:
ln -sf libxc.so.$(MAJOR) $@
libxc.so.$(MAJOR):
ln -sf libxc.so.$(MAJOR).$(MINOR) $@
libxc.so.$(MAJOR).$(MINOR): $(OBJS)
$(PIC_OBJS): %.opic: %.c
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
$(LIB_NAME).a: $(OBJS)
$(AR) rc $@ $^
$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
ln -sf $< $@
$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
ln -sf $< $@
$(LIB_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS)
$(CC) -Wl,-soname -Wl,$(SONAME) -shared -o $@ $^ -L../libxutil -lxutil -lz
-include $(DEPS)
+8 -3
View File
@@ -19,6 +19,7 @@ LIB_SRCS += sys_string.c
LIB_SRCS += util.c
LIB_OBJS := $(LIB_SRCS:.c=.o)
LIB_PIC_OBJS := $(LIB_SRCS:.c=.opic)
CFLAGS += -Wall
CFLAGS += -Werror
@@ -33,6 +34,7 @@ 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)
@@ -41,14 +43,17 @@ LIB += $(LIB_NAME).a
all: check-for-zlib
$(MAKE) $(LIB)
$(LIB_PIC_OBJS): %.opic: %.c
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
$(LIB_NAME).so: $(LIB_NAME).so.$(MAJOR)
ln -sf $^ $@
$(LIB_NAME).so.$(MAJOR): $(LIB_NAME).so.$(MAJOR).$(MINOR)
ln -sf $^ $@
$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_OBJS)
$(CC) -Wl,-soname -Wl,$(LIB_NAME).so.$(MAJOR) -shared -o $@ $^
$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_PIC_OBJS)
$(CC) -Wl,-soname -Wl,$(SO_NAME) -shared -o $@ $^
$(LIB_NAME).a: $(LIB_OBJS)
$(AR) rc $@ $^
@@ -68,7 +73,7 @@ install: all
ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so
clean:
$(RM) *.a *.so *.so.* *.o *.rpm
$(RM) *.a *.so *.so.* *.o *.opic *.rpm
$(RM) *~
$(RM) $(DEPS)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.