summaryrefslogtreecommitdiff
path: root/extras/volume_id/libvolume_id/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'extras/volume_id/libvolume_id/Makefile')
-rw-r--r--extras/volume_id/libvolume_id/Makefile69
1 files changed, 62 insertions, 7 deletions
diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile
index a5f9c1a825..5d188a23d4 100644
--- a/extras/volume_id/libvolume_id/Makefile
+++ b/extras/volume_id/libvolume_id/Makefile
@@ -1,11 +1,21 @@
-# Makefile for udev extra invoked from the udev main Makefile
+# libvolume_id - read filesystem label/uuid
#
-# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
+# Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
#
# Released under the GNU General Public License, version 2.
#
+includedir = ${prefix}/usr/include
+libdir = ${prefix}/lib
+usrlibdir = ${prefix}/usr/lib
-LIBVOLUME_ID = libvolume_id.a
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_LIB = ${INSTALL} -m 755
+
+SHLIB_CUR = 0
+SHLIB_REV = 60
+SHLIB_AGE = 0
+SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
OBJS= \
ext.o \
@@ -41,13 +51,13 @@ OBJS= \
util.o
HEADERS= \
- volume_id.h \
+ libvolume_id.h \
util.h
AR = $(CROSS)ar
RANLIB = $(CROSS)ranlib
-all: $(LIBVOLUME_ID)
+all: libvolume_id.a $(SHLIB) libvolume_id.pc
.PHONY: all
.DEFAULT: all
@@ -55,15 +65,60 @@ all: $(LIBVOLUME_ID)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
-$(LIBVOLUME_ID): $(HEADERS) $(OBJS)
+.shlib:
+ $(Q) mkdir .shlib
+
+.shlib/%.o: %.c
+ $(E) " CC " $@
+ $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@
+
+libvolume_id.a: $(HEADERS) $(OBJS)
$(Q) rm -f $@
$(E) " AR " $@
$(Q) $(AR) cq $@ $(OBJS)
$(E) " RANLIB " $@
$(Q) $(RANLIB) $@
+$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS))
+ $(E) " CC " $@
+ $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS))
+ $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR)
+ $(Q) ln -sf $@ libvolume_id.so
+
+libvolume_id.pc:
+ $(E) " GENPC " $@
+ $(Q) echo "prefix=${prefix}" > $@
+ $(Q) echo "libdir=${libdir}" >> $@
+ $(Q) echo "includedir=${includedir}" >> $@
+ $(Q) echo "" >> $@
+ $(Q) echo "Name: libvolume_id" >> $@
+ $(Q) echo "Description: Filesystem label and uuid access" >> $@
+ $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@
+ $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@
+ $(Q) echo "Cflags: -I\$${includedir}" >> $@
+
+install: all
+ $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h
+ $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a
+ $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB)
+ ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
+ ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so
+ $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc
+.PHONY: install
+
+uninstall:
+ rm -f $(DESTDIR)$(includedir)/libvolume_id.h
+ rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a
+ rm -f $(DESTDIR)$(libdir)/$(SHLIB)
+ rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
+ rm -f $(DESTDIR)$(libdir)/libvolume_id.so
+.PHONY: uninstall
+
clean:
$(E) " CLEAN "
- $(Q) rm -f $(LIBVOLUME_ID) $(OBJS)
+ $(Q) rm -f libvolume_id.a $(OBJS)
+ $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so
+ $(Q) rm -rf .shlib
+ $(Q) rm -f libvolume_id.pc
.PHONY: clean