• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Makefile for libblkid
2#
3# Copyright (C) 2001 Theodore Ts'o (tytso@mit.edu)
4#
5# This file can be redistributed under the terms of the
6# GNU Lesser General Public License
7
8srcdir = @srcdir@
9top_srcdir = @top_srcdir@
10VPATH = @srcdir@
11top_builddir = ../..
12my_dir = lib/blkid
13INSTALL = @INSTALL@
14MKDIR_P = @MKDIR_P@
15
16@MCONFIG@
17
18all::
19
20SMANPAGES=	libblkid.3
21
22OBJS= cache.o dev.o devname.o devno.o getsize.o llseek.o probe.o \
23 read.o resolve.o save.o tag.o version.o
24
25SRCS= $(srcdir)/cache.c $(srcdir)/dev.c $(srcdir)/devname.c $(srcdir)/devno.c \
26 $(srcdir)/getsize.c $(srcdir)/llseek.c $(srcdir)/probe.c \
27 $(srcdir)/read.c $(srcdir)/resolve.c $(srcdir)/save.c $(srcdir)/tag.c \
28 $(srcdir)/version.c
29
30HFILES_IN=	blkid.h blkid_types.h
31
32LIBRARY= libblkid
33LIBDIR= blkid
34
35ELF_VERSION = 1.0
36ELF_SO_VERSION = 1
37ELF_IMAGE = libblkid
38ELF_MYDIR = blkid
39ELF_INSTALL_DIR = $(root_libdir)
40ELF_OTHER_LIBS = -luuid
41
42BSDLIB_VERSION = 2.0
43BSDLIB_IMAGE = libblkid
44BSDLIB_MYDIR = blkid
45BSDLIB_INSTALL_DIR = $(root_libdir)
46
47@MAKEFILE_LIBRARY@
48@MAKEFILE_ELF@
49@MAKEFILE_BSDLIB@
50@MAKEFILE_PROFILE@
51
52LIBS_BLKID=	$(STATIC_LIBBLKID) $(STATIC_LIBUUID)
53DEPLIBS_BLKID=	$(DEPSTATIC_LIBBLKID) $(DEPSTATIC_LIBUUID)
54
55.c.o:
56	$(E) "	CC $<"
57	$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< -o $@
58	$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
59	$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
60@PROFILE_CMT@	$(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
61@ELF_CMT@	$(Q) $(CC) $(ALL_CFLAGS_SHLIB) -fPIC -shared -o elfshared/$*.o -c $<
62@BSDLIB_CMT@	$(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
63
64all:: $(SMANPAGES) blkid.pc
65
66blkid_types.h: $(srcdir)/blkid_types.h.in $(top_builddir)/config.status
67	$(E) "	CONFIG.STATUS $@"
68	$(Q) cd $(top_builddir); \
69		CONFIG_FILES=$(my_dir)/blkid_types.h ./config.status
70
71blkid.h: $(srcdir)/blkid.h.in
72	$(E) "	CP $@"
73	$(Q) cp $(srcdir)/blkid.h.in blkid.h
74
75libblkid.3: $(DEP_SUBSTITUTE) $(srcdir)/libblkid.3.in
76	$(E) "	SUBST $@"
77	$(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/libblkid.3.in libblkid.3
78
79tst_cache: $(srcdir)/cache.c $(DEPLIBS_BLKID)
80	$(E) "	LD $@"
81	$(Q) $(CC) -o tst_cache -DTEST_PROGRAM $(srcdir)/cache.c $(LIBS_BLKID) $(ALL_CFLAGS)
82
83tst_dev: $(srcdir)/dev.c $(DEPLIBS_BLKID)
84	$(E) "	LD $@"
85	$(Q) $(CC) -o tst_dev -DTEST_PROGRAM $(srcdir)/dev.c $(LIBS_BLKID) $(ALL_CFLAGS)
86
87tst_devname: $(srcdir)/devname.c $(DEPLIBS_BLKID)
88	$(E) "	LD $@"
89	$(Q) $(CC) -o tst_devname -DTEST_PROGRAM $(srcdir)/devname.c $(LIBS_BLKID) $(ALL_CFLAGS)
90
91tst_devno: $(srcdir)/devno.c $(DEPLIBS_BLKID)
92	$(E) "	LD $@"
93	$(Q) $(CC) -o tst_devno -DTEST_PROGRAM $(srcdir)/devno.c $(LIBS_BLKID) $(ALL_CFLAGS)
94
95tst_getsize: $(srcdir)/getsize.c $(DEPLIBS_BLKID)
96	$(E) "	LD $@"
97	$(Q) $(CC) -o tst_getsize -DTEST_PROGRAM $(srcdir)/getsize.c $(LIBS_BLKID) $(ALL_CFLAGS)
98
99tst_probe: $(srcdir)/probe.c $(DEPLIBS_BLKID)
100	$(E) "	LD $@"
101	$(Q) $(CC) -o tst_probe -DTEST_PROGRAM $(srcdir)/probe.c $(LIBS_BLKID) $(ALL_CFLAGS)
102
103tst_read: $(srcdir)/read.c $(DEPLIBS_BLKID)
104	$(E) "	LD $@"
105	$(Q) $(CC) -o tst_read -DTEST_PROGRAM $(srcdir)/read.c $(LIBS_BLKID) $(ALL_CFLAGS)
106
107tst_resolve: $(srcdir)/resolve.c $(DEPLIBS_BLKID)
108	$(E) "	LD $@"
109	$(Q) $(CC) -o tst_resolve -DTEST_PROGRAM $(srcdir)/resolve.c $(LIBS_BLKID) $(ALL_CFLAGS)
110
111tst_save: $(srcdir)/save.c $(DEPLIBS_BLKID)
112	$(E) "	LD $@"
113	$(Q) $(CC) -o tst_save -DTEST_PROGRAM $(srcdir)/save.c $(LIBS_BLKID) $(ALL_CFLAGS)
114
115tst_tag: $(srcdir)/tag.c $(DEPLIBS_BLKID)
116	$(E) "	LD $@"
117	$(Q) $(CC) -o tst_tag -DTEST_PROGRAM $(srcdir)/tag.c $(LIBS_BLKID) $(ALL_CFLAGS)
118
119tst_types: tst_types.o blkid_types.h
120	$(E) "	LD $@"
121	$(Q) $(CC) -o tst_types $(ALL_LDFLAGS) tst_types.o
122
123../../misc/blkid.o: $(top_srcdir)/misc/blkid.c blkid.h
124	$(E) "	CC $@"
125	$(Q) $(CC) $(ALL_CFLAGS) -c $(top_srcdir)/misc/blkid.c \
126		-o ../../misc/blkid.o
127
128blkid: ../../misc/blkid.o libblkid.a $(DEPLIBUUID)
129	$(E) "	LD $@"
130	$(Q) $(CC) -o blkid ../../misc/blkid.o libblkid.a $(LIBUUID)
131
132test_probe: test_probe.in Makefile
133	$(E) "Creating test_probe..."
134	$(E) "#!/bin/sh" > test_probe
135	$(E) "SRCDIR=@srcdir@" >> test_probe
136	$(Q) cat $(srcdir)/test_probe.in >> test_probe
137	$(Q) chmod +x test_probe
138
139fullcheck check:: all tst_cache tst_dev tst_devname tst_devno \
140 tst_getsize tst_probe tst_read tst_resolve tst_save tst_tag \
141 test_probe tst_types
142	./test_probe
143	./tst_types
144
145blkid.pc: $(srcdir)/blkid.pc.in $(top_builddir)/config.status
146	$(E) "	CONFIG.STATUS $@"
147	$(Q) cd $(top_builddir); CONFIG_FILES=lib/blkid/blkid.pc ./config.status
148
149installdirs::
150	$(E) "	MKDIR_P $(libdir) $(includedir)/blkid"
151	$(Q) $(MKDIR_P) $(DESTDIR)$(libdir) \
152		$(DESTDIR)$(includedir)/blkid $(DESTDIR)$(pkgconfigdir)
153
154install:: all installdirs
155	$(E) "	INSTALL_DATA $(libdir)/libblkid.a"
156	$(Q) $(INSTALL_DATA) libblkid.a $(DESTDIR)$(libdir)/libblkid.a
157	-$(Q) $(RANLIB) $(DESTDIR)$(libdir)/libblkid.a
158	$(Q) $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libblkid.a
159	$(Q) set -e; for i in $(HFILES_IN); do \
160		echo "	INSTALL_DATA $(includedir)/blkid/$$i"; \
161		$(INSTALL_DATA) $$i $(DESTDIR)$(includedir)/blkid/$$i; \
162	done
163	$(Q) for i in $(SMANPAGES); do \
164		echo "	INSTALL_DATA $(man3dir)/$$i"; \
165		$(INSTALL_DATA) $$i $(DESTDIR)$(man3dir)/$$i; \
166	done
167	$(E) "	INSTALL_DATA $(pkgconfigdir)/blkid.pc"
168	$(Q) $(INSTALL_DATA) blkid.pc $(DESTDIR)$(pkgconfigdir)/blkid.pc
169
170uninstall::
171	$(RM) -f $(DESTDIR)$(libdir)/libblkid.a \
172		$(DESTDIR)$(pkgconfigdir)/blkid.pc
173	$(RM) -rf $(DESTDIR)$(includedir)/blkid
174	for i in $(SMANPAGES); do \
175		$(RM) -f $(DESTDIR)$(man3dir)/$$i; \
176	done
177
178clean::
179	$(RM) -f \#* *.s *.o *.orig *.a *~ *.bak tst_cache tst_dev tst_devname \
180		tst_devno tst_getsize tst_probe tst_read tst_resolve tst_save \
181		tst_tag tst_types tests/*.out tests/*.ok \
182		tests/*.img results test_probe core profiled/* \
183		blkid.h blkid_types.h ../libblkid.a ../libblkid_p.a \
184		$(SMANPAGES) blkid blkid.pc
185	@echo rmdir tests/tmp tests
186	@(rmdir tests/tmp tests 2> /dev/null ; exit 0)
187
188mostlyclean:: clean
189distclean:: clean
190	$(RM) -f .depend Makefile blkid.pc \
191		$(srcdir)/TAGS $(srcdir)/Makefile.in.old
192
193$(OBJS): subdirs $(HFILES_IN)
194
195# +++ Dependency line eater +++
196#
197# Makefile dependencies follow.  This must be the last section in
198# the Makefile.in file
199#
200cache.o: $(srcdir)/cache.c $(top_builddir)/lib/config.h \
201 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
202dev.o: $(srcdir)/dev.c $(top_builddir)/lib/config.h \
203 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
204devname.o: $(srcdir)/devname.c $(top_builddir)/lib/config.h \
205 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
206devno.o: $(srcdir)/devno.c $(top_builddir)/lib/config.h \
207 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
208getsize.o: $(srcdir)/getsize.c $(top_builddir)/lib/config.h \
209 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
210llseek.o: $(srcdir)/llseek.c $(top_builddir)/lib/config.h \
211 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
212probe.o: $(srcdir)/probe.c $(top_builddir)/lib/config.h \
213 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h \
214 $(srcdir)/probe.h
215read.o: $(srcdir)/read.c $(top_builddir)/lib/config.h \
216 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
217resolve.o: $(srcdir)/resolve.c $(top_builddir)/lib/config.h \
218 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
219save.o: $(srcdir)/save.c $(top_builddir)/lib/config.h \
220 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
221tag.o: $(srcdir)/tag.c $(top_builddir)/lib/config.h \
222 $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
223version.o: $(srcdir)/version.c $(top_builddir)/lib/config.h \
224 $(top_builddir)/lib/dirpaths.h $(top_srcdir)/version.h
225