summaryrefslogtreecommitdiff
path: root/extras/volume_id/lib/Makefile
blob: e3c3f5dab55d243ce90ecb5c8935c96ffff7e3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# libvolume_id - read filesystem label/uuid
#
# 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

INSTALL = /usr/bin/install -c
INSTALL_DATA  = ${INSTALL} -m 644
INSTALL_LIB = ${INSTALL} -m 755

SHLIB_CUR = 0
SHLIB_REV = 62
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)

OBJS=				\
	ext.o			\
	fat.o			\
	hfs.o			\
	highpoint.o		\
	isw_raid.o		\
	lsi_raid.o		\
	via_raid.o		\
	silicon_raid.o		\
	nvidia_raid.o		\
	promise_raid.o		\
	iso9660.o		\
	jfs.o			\
	linux_raid.o		\
	linux_swap.o		\
	lvm.o			\
	ntfs.o			\
	reiserfs.o		\
	udf.o			\
	ufs.o			\
	xfs.o			\
	cramfs.o		\
	hpfs.o			\
	romfs.o			\
	sysv.o			\
	minix.o			\
	luks.o			\
	ocfs.o			\
	vxfs.o			\
	squashfs.o		\
	netware.o		\
	volume_id.o		\
	util.o

HEADERS=			\
	libvolume_id.h		\
	util.h

all: libvolume_id.a $(SHLIB) libvolume_id.pc
.PHONY: all
.DEFAULT: all

%.o: %.c
	$(E) "  CC      " $@
	$(Q) $(CC) -c $(CFLAGS) $< -o $@

.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),--version-script,exported_symbols \
		$(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 $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
	ln -sf $(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.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