Home | History | Annotate | Download | only in blkid
      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 = -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 	$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
     59 @PROFILE_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
     60 @CHECKER_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
     61 @ELF_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
     62 @BSDLIB_CMT@	$(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
     63 
     64 all:: $(SMANPAGES) blkid.pc
     65 
     66 blkid_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 
     71 blkid.h: $(srcdir)/blkid.h.in
     72 	$(E) "	CP $@"
     73 	$(Q) cp $(srcdir)/blkid.h.in blkid.h
     74 
     75 libblkid.3: $(DEP_SUBSTITUTE) $(srcdir)/libblkid.3.in
     76 	$(E) "	SUBST $@"
     77 	$(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/libblkid.3.in libblkid.3
     78 
     79 tst_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 
     83 tst_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 
     87 tst_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 
     91 tst_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 
     95 tst_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 
     99 tst_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 
    103 tst_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 
    107 tst_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 
    111 tst_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 
    115 tst_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 
    119 tst_types: tst_types.o blkid_types.h 
    120 	$(E) "	LD $@"
    121 	$(Q) $(CC) -o tst_types 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 
    128 blkid: ../../misc/blkid.o libblkid.a $(DEPLIBUUID)
    129 	$(E) "	LD $@"
    130 	$(Q) $(CC) -o blkid ../../misc/blkid.o libblkid.a $(LIBUUID)
    131 
    132 test_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 
    139 check:: all tst_cache tst_dev tst_devname tst_devno tst_getsize tst_probe \
    140  tst_read tst_resolve tst_save tst_tag test_probe tst_types
    141 	./test_probe
    142 	./tst_types
    143 
    144 blkid.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 
    148 installdirs::
    149 	$(E) "	MKINSTALLDIRS $(libdir) $(includedir)/blkid"
    150 	$(Q) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \
    151 		$(DESTDIR)$(includedir)/blkid $(DESTDIR)$(libdir)/pkgconfig
    152 
    153 install:: 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 $(libdir)/pkgconfig/blkid.pc"
    167 	$(Q) $(INSTALL_DATA) blkid.pc $(DESTDIR)$(libdir)/pkgconfig/blkid.pc
    168 
    169 uninstall::
    170 	$(RM) -f $(DESTDIR)$(libdir)/libblkid.a \
    171 		$(DESTDIR)$(libdir)/pkgconfig/blkid.pc
    172 	$(RM) -rf $(DESTDIR)$(includedir)/blkid
    173 	for i in $(SMANPAGES); do \
    174 		$(RM) -f $(DESTDIR)$(man3dir)/$$i; \
    175 	done
    176 
    177 clean::
    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 		checker/* blkid.h blkid_types.h ../libblkid.a ../libblkid_p.a \
    183 		$(SMANPAGES) blkid
    184 	@echo rmdir tests/tmp tests
    185 	@(rmdir tests/tmp tests 2> /dev/null ; exit 0)
    186 
    187 mostlyclean:: clean
    188 distclean:: 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 #
    199 cache.o: $(srcdir)/cache.c $(top_builddir)/lib/config.h \
    200  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    201 dev.o: $(srcdir)/dev.c $(top_builddir)/lib/config.h \
    202  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    203 devname.o: $(srcdir)/devname.c $(top_builddir)/lib/config.h \
    204  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    205 devno.o: $(srcdir)/devno.c $(top_builddir)/lib/config.h \
    206  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    207 getsize.o: $(srcdir)/getsize.c $(top_builddir)/lib/config.h \
    208  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    209 llseek.o: $(srcdir)/llseek.c $(top_builddir)/lib/config.h \
    210  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    211 probe.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
    214 read.o: $(srcdir)/read.c $(top_builddir)/lib/config.h \
    215  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    216 resolve.o: $(srcdir)/resolve.c $(top_builddir)/lib/config.h \
    217  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    218 save.o: $(srcdir)/save.c $(top_builddir)/lib/config.h \
    219  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    220 tag.o: $(srcdir)/tag.c $(top_builddir)/lib/config.h \
    221  $(top_builddir)/lib/dirpaths.h $(srcdir)/blkidP.h $(srcdir)/list.h
    222 version.o: $(srcdir)/version.c $(top_builddir)/lib/config.h \
    223  $(top_builddir)/lib/dirpaths.h $(top_srcdir)/version.h
    224