aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxutil/Makefile
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2005-01-22 21:30:03 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2005-01-22 21:30:03 +0000
commit7ebea330c936f8beca2e3fa3ec47d7228b421f63 (patch)
tree79569c941e14b48f7aadcaac086397c92854b67d /tools/libxutil/Makefile
parent8895336d36bbd9b98a09628549485b22e826c71a (diff)
downloadxen-7ebea330c936f8beca2e3fa3ec47d7228b421f63.tar.gz
xen-7ebea330c936f8beca2e3fa3ec47d7228b421f63.tar.bz2
xen-7ebea330c936f8beca2e3fa3ec47d7228b421f63.zip
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
Diffstat (limited to 'tools/libxutil/Makefile')
-rw-r--r--tools/libxutil/Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/libxutil/Makefile b/tools/libxutil/Makefile
index b9034b5b8f..ae1b26ef6b 100644
--- a/tools/libxutil/Makefile
+++ b/tools/libxutil/Makefile
@@ -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)