]> err.no Git - util-linux/commitdiff
blkid: compile TEST_PROGRAMs
authorKarel Zak <kzak@redhat.com>
Tue, 3 Feb 2009 15:07:46 +0000 (16:07 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Feb 2009 22:35:25 +0000 (23:35 +0100)
Well, the src/Makefile.am is not prefect. Maybe it's time to switch to
libtools ....

Signed-off-by: Karel Zak <kzak@redhat.com>
libs/blkid/.gitignore
libs/blkid/src/Makefile.am

index e886cb89c6ecf35091cb59dfea274d47558198b7..195de631ef159b600f71ec8960b238bcb2905487 100644 (file)
@@ -1,3 +1,4 @@
 *.[38]
 *.sh
 bin/blkid
+test_*
index 7821d804c83ad6dc54bf695653581b570044825a..09d6609ebdfe0e1afd21bcffa9d6e07c00991f95 100644 (file)
@@ -4,18 +4,27 @@ SUBDIRS = probers .
 
 AM_CPPFLAGS += -I$(top_builddir)/libs/blkid/src
 
+# includes
+blkidincdir = $(includedir)/blkid
+blkidinc_HEADERS = blkid.h
+
 # static library
 lib_LIBRARIES = libblkid.a
 libblkid_a_SOURCES = cache.c dev.c devname.c devno.c getsize.c llseek.c  \
                     probe.c read.c resolve.c save.c tag.c version.c verify.c \
-                    encode.c blkid.h blkidP.h list.h probers/probers.h \
+                    encode.c blkid.h list.h probers/probers.h \
                     config.c \
+                    $(blkidinc_HEADERS) \
                     $(top_srcdir)/lib/blkdev.c \
                     $(top_srcdir)/lib/linux_version.c \
                     $(top_srcdir)/lib/md5.c
+
 libblkid_a_LIBADD = probers/libprobers.a
 libblkid_a_CFLAGS = -fPIC
 
+tests = test_cache test_config test_dev test_devname test_devno test_getsize \
+       test_read test_resolve test_save test_tag test_verify
+
 # shared library (note that we don't use LIBTOOL!)
 blkid_IMAGE = libblkid.so
 blkid_LDSCRIPT = $(srcdir)/blkid.sym
@@ -29,24 +38,30 @@ blkid_OTHERLDADD += -luuid  #TODO $(UUID_LIBS)
 endif
 
 EXTRA_DIST = blkid.sym
+CLEANFILES = $(tests) $(blkid_LIB) $(blkid_LINKS)
 
 all-local: $(blkid_LIB)
 
 $(blkid_LIB): $(lib_LIBRARIES) $(blkid_LDSCRIPT)
        $(CC) --shared -o $(blkid_LIB) $(AM_LDFLAGS) \
               -Wl,-soname,$(blkid_SONAME),--version-script,$(blkid_LDSCRIPT) \
-             $(libblkid_a_OBJECTS) probers/libprobers.a $(blkid_OTHERLDADD)
+             $(libblkid_a_OBJECTS) $(libblkid_a_LIBADD) $(blkid_OTHERLDADD)
        for I in $(blkid_LINKS); do \
                ln -sf $(blkid_LIB) $$I; \
        done
 
-clean-local:
-       rm -f $(blkid_LIB) $(blkid_LINKS)
+tests: $(tests) all-local
+
+# TODO: the -md5.o requirement is odd..
+test_%: %.c all
+       $(COMPILE) -DTEST_PROGRAM $< $(lib_LIBRARIES) libblkid_a-md5.o $(libblkid_a_LIBADD) \
+               -o $@ $(blkid_OTHERLDADD)
 
 installdirs-local:
        $(MKDIR_P) $(DESTDIR)$(libdir)
 
 install-exec-hook:
+       $(mkinstalldirs) $(DESTDIR)$(blkidincdir)
        $(INSTALL_PROGRAM) $(blkid_LIB) $(DESTDIR)$(libdir)
        for I in $(blkid_LINKS); do \
                cd $(DESTDIR)$(libdir) && ln -sf $(blkid_LIB) $$I; \