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