1 # Makefile for libblkid 2 # 3 # Copyright (C) 2001 Theodore Ts'o (tytso (a] mit.edu) 4 # 5 # This file can be redistributed under the terms of the 6 # GNU Lesser General Public License 7 8 srcdir = @srcdir@ 9 top_srcdir = @top_srcdir@ 10 VPATH = @srcdir@ 11 top_builddir = ../.. 12 my_dir = lib/blkid 13 INSTALL = @INSTALL@ 14 15 @MCONFIG@ 16 17 all:: 18 19 SMANPAGES= libblkid.3 20 21 OBJS= 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 24 SRCS= $(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 29 HFILES_IN= blkid.h blkid_types.h 30 31 LIBRARY= libblkid 32 LIBDIR= blkid 33 34 ELF_VERSION = 1.0 35 ELF_SO_VERSION = 1 36 ELF_IMAGE = libblkid 37 ELF_MYDIR = blkid 38 ELF_INSTALL_DIR = $(root_libdir) 39 ELF_OTHER_LIBS = -L../.. -luuid 40 41 BSDLIB_VERSION = 2.0 42 BSDLIB_IMAGE = libblkid 43 BSDLIB_MYDIR = blkid 44 BSDLIB_INSTALL_DIR = $(root_libdir) 45 46 @MAKEFILE_LIBRARY@ 47 @MAKEFILE_ELF@ 48 @MAKEFILE_BSDLIB@ 49 @MAKEFILE_PROFILE@ 50 @MAKEFILE_CHECKER@ 51 52 LIBS_BLKID= $(STATIC_LIBBLKID) $(STATIC_LIBUUID) 53 DEPLIBS_BLKID= $(DEPSTATIC_LIBBLKID) $(DEPSTATIC_LIBUUID) 54 55 .c.o: 56 $(E) " CC $<" 57 $(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@ 58 @PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $< 59 @CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $< 60 @ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< 61 @BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $< 62 63 all:: $(SMANPAGES) blkid.pc 64 65 blkid_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 70 blkid.h: $(srcdir)/blkid.h.in 71 $(E) " CP $@" 72 $(Q) cp $(srcdir)/blkid.h.in blkid.h 73 74 libblkid.3: $(DEP_SUBSTITUTE) $(srcdir)/libblkid.3.in 75 $(E) " SUBST $@" 76 $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/libblkid.3.in libblkid.3 77 78 tst_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 82 tst_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 86 tst_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 90 tst_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 94 tst_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 98 tst_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 102 tst_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 106 tst_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 110 tst_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 114 tst_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 118 tst_types: tst_types.o blkid_types.h 119 $(E) " LD $@" 120 $(Q) $(CC) -o tst_types 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 127 blkid: ../../misc/blkid.o libblkid.a $(DEPLIBUUID) 128 $(E) " LD $@" 129 $(Q) $(CC) -o blkid ../../misc/blkid.o libblkid.a $(LIBUUID) 130 131 test_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 138 check:: all tst_cache tst_dev tst_devname tst_devno tst_getsize tst_probe \ 139 tst_read tst_resolve tst_save tst_tag test_probe tst_types 140 ./test_probe 141 ./tst_types 142 143 blkid.pc: $(srcdir)/blkid.pc.in $(top_builddir)/config.status 144 $(E) " CONFIG.STATUS $@" 145 $(Q) cd $(top_builddir); CONFIG_FILES=lib/blkid/blkid.pc ./config.status 146 147 installdirs:: 148 $(E) " MKINSTALLDIRS $(libdir) $(includedir)/blkid" 149 $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ 150 $(DESTDIR)$(includedir)/blkid $(DESTDIR)$(libdir)/pkgconfig 151 152 install:: all installdirs 153 $(E) " INSTALL_DATA $(libdir)/libblkid.a" 154 $(Q) $(INSTALL_DATA) libblkid.a $(DESTDIR)$(libdir)/libblkid.a 155 -$(Q) $(RANLIB) $(DESTDIR)$(libdir)/libblkid.a 156 $(Q) $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libblkid.a 157 $(Q) set -e; for i in $(HFILES_IN); do \ 158 echo " INSTALL_DATA $(includedir)/blkid/$$i"; \ 159 $(INSTALL_DATA) $$i $(DESTDIR)$(includedir)/blkid/$$i; \ 160 done 161 $(Q) for i in $(SMANPAGES); do \ 162 echo " INSTALL_DATA $(man3dir)/$$i"; \ 163 $(INSTALL_DATA) $$i $(DESTDIR)$(man3dir)/$$i; \ 164 done 165 $(E) " INSTALL_DATA $(libdir)/pkgconfig/blkid.pc" 166 $(Q) $(INSTALL_DATA) blkid.pc $(DESTDIR)$(libdir)/pkgconfig/blkid.pc 167 168 uninstall:: 169 $(RM) -f $(DESTDIR)$(libdir)/libblkid.a \ 170 $(DESTDIR)$(libdir)/pkgconfig/blkid.pc 171 $(RM) -rf $(DESTDIR)$(includedir)/blkid 172 for i in $(SMANPAGES); do \ 173 $(RM) -f $(DESTDIR)$(man3dir)/$$i; \ 174 done 175 176 clean:: 177 $(RM) -f \#* *.s *.o *.orig *.a *~ *.bak tst_cache tst_dev tst_devname \ 178 tst_devno tst_getsize tst_probe tst_read tst_resolve tst_save \ 179 tst_tag tst_types tests/*.out tests/*.ok \ 180 tests/*.img results test_probe core profiled/* \ 181 checker/* blkid.h blkid_types.h ../libblkid.a ../libblkid_p.a \ 182 $(SMANPAGES) blkid 183 @echo rmdir tests/tmp tests 184 @(rmdir tests/tmp tests 2> /dev/null ; exit 0) 185 186 mostlyclean:: clean 187 distclean:: clean 188 $(RM) -f .depend Makefile blkid.pc \ 189 $(srcdir)/TAGS $(srcdir)/Makefile.in.old 190 191 $(OBJS): subdirs $(HFILES_IN) 192 193 # +++ Dependency line eater +++ 194 # 195 # Makefile dependencies follow. This must be the last section in 196 # the Makefile.in file 197 # 198 cache.o: $(srcdir)/cache.c $(srcdir)/list.h 199 dev.o: $(srcdir)/dev.c $(srcdir)/list.h 200 devname.o: $(srcdir)/devname.c $(srcdir)/list.h 201 devno.o: $(srcdir)/devno.c $(srcdir)/list.h 202 getsize.o: $(srcdir)/getsize.c $(srcdir)/list.h 203 llseek.o: $(srcdir)/llseek.c $(srcdir)/list.h 204 probe.o: $(srcdir)/probe.c $(srcdir)/list.h $(srcdir)/probe.h 205 read.o: $(srcdir)/read.c $(srcdir)/list.h 206 resolve.o: $(srcdir)/resolve.c $(srcdir)/list.h 207 save.o: $(srcdir)/save.c $(srcdir)/list.h 208 tag.o: $(srcdir)/tag.c $(srcdir)/list.h 209 version.o: $(srcdir)/version.c $(top_srcdir)/version.h 210