chiark / gitweb /
e93f8b5af5936878471168e1d7b1aa1575f331cf
[elogind.git] / extras / volume_id / lib / Makefile
1 # libvolume_id - read filesystem label/uuid
2 #
3 # Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
4 #
5 # Released under the GNU General Public License, version 2.
6 #
7 includedir =    ${prefix}/usr/include
8 libdir =        ${prefix}/lib
9 usrlibdir =     ${prefix}/usr/lib
10
11 INSTALL = /usr/bin/install -c
12 INSTALL_DATA  = ${INSTALL} -m 644
13 INSTALL_LIB = ${INSTALL} -m 755
14
15 SHLIB_CUR = 0
16 SHLIB_REV = 70
17 SHLIB_AGE = 0
18 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
19
20 OBJS=                           \
21         ext.o                   \
22         fat.o                   \
23         hfs.o                   \
24         highpoint.o             \
25         isw_raid.o              \
26         lsi_raid.o              \
27         via_raid.o              \
28         silicon_raid.o          \
29         nvidia_raid.o           \
30         promise_raid.o          \
31         adaptec_raid.o          \
32         jmicron_raid.o          \
33         iso9660.o               \
34         jfs.o                   \
35         linux_raid.o            \
36         linux_swap.o            \
37         lvm.o                   \
38         ntfs.o                  \
39         reiserfs.o              \
40         udf.o                   \
41         ufs.o                   \
42         xfs.o                   \
43         cramfs.o                \
44         hpfs.o                  \
45         romfs.o                 \
46         sysv.o                  \
47         minix.o                 \
48         gfs.o                   \
49         luks.o                  \
50         ocfs.o                  \
51         vxfs.o                  \
52         squashfs.o              \
53         netware.o               \
54         volume_id.o             \
55         util.o
56
57 HEADERS=                        \
58         libvolume_id.h          \
59         util.h
60
61 all: libvolume_id.a $(SHLIB) libvolume_id.pc
62 .PHONY: all
63 .DEFAULT: all
64
65 %.o: %.c
66         $(E) "  CC      " $@
67         $(Q) $(CC) -c $(CFLAGS) $< -o $@
68
69 .shlib:
70         $(Q) mkdir .shlib
71
72 .shlib/%.o: %.c
73         $(E) "  CC      " $@
74         $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@
75
76 libvolume_id.a: $(HEADERS) $(OBJS)
77         $(Q) rm -f $@
78         $(E) "  AR      " $@
79         $(Q) $(AR) cq $@ $(OBJS)
80         $(E) "  RANLIB  " $@
81         $(Q) $(RANLIB) $@
82
83 $(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS))
84         $(E) "  CC      " $@
85         $(Q) $(CC) -shared $(CFLAGS) -o $@ \
86                 -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \
87                 $(addprefix .shlib/,$(OBJS))
88         $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR)
89         $(Q) ln -sf $@ libvolume_id.so
90
91 libvolume_id.pc:
92         $(E) "  GENPC   " $@
93         $(Q) echo "prefix=${prefix}" > $@
94         $(Q) echo "libdir=${libdir}" >> $@
95         $(Q) echo "includedir=${includedir}" >> $@
96         $(Q) echo "" >> $@
97         $(Q) echo "Name: libvolume_id" >> $@
98         $(Q) echo "Description: Filesystem label and uuid access" >> $@
99         $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@
100         $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@
101         $(Q) echo "Cflags: -I\$${includedir}" >> $@
102
103 install: all
104         $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h
105         $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a
106         $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB)
107         ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
108         ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so
109         $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc
110 .PHONY: install
111
112 uninstall:
113         rm -f $(DESTDIR)$(includedir)/libvolume_id.h
114         rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a
115         rm -f $(DESTDIR)$(libdir)/$(SHLIB)
116         rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
117         rm -f $(DESTDIR)$(libdir)/libvolume_id.so
118 .PHONY: uninstall
119
120 clean:
121         $(E) "  CLEAN   "
122         $(Q) rm -f libvolume_id.a $(OBJS)
123         $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so
124         $(Q) rm -rf .shlib
125         $(Q) rm -f libvolume_id.pc
126 .PHONY: clean
127