From: Karel Zak Date: Tue, 3 Feb 2009 15:07:46 +0000 (+0100) Subject: blkid: compile TEST_PROGRAMs X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9906300fe8e5457af70778c1caf949669c29a325;p=util-linux blkid: compile TEST_PROGRAMs Well, the src/Makefile.am is not prefect. Maybe it's time to switch to libtools .... Signed-off-by: Karel Zak --- diff --git a/libs/blkid/.gitignore b/libs/blkid/.gitignore index e886cb89..195de631 100644 --- a/libs/blkid/.gitignore +++ b/libs/blkid/.gitignore @@ -1,3 +1,4 @@ *.[38] *.sh bin/blkid +test_* diff --git a/libs/blkid/src/Makefile.am b/libs/blkid/src/Makefile.am index 7821d804..09d6609e 100644 --- a/libs/blkid/src/Makefile.am +++ b/libs/blkid/src/Makefile.am @@ -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; \