Fix: tests: don't build dynamic lib tests if support disabled
[lttng-tools.git] / tests / regression / ust / ust-dl / Makefile.am
index 4893a97e4793b29cd10dc8a657770ec29054bea0..bcd700109a42ba7ce987bdd6a10ab151ec3fbf82 100644 (file)
@@ -1,3 +1,18 @@
+if NO_SHARED
+# Do not build this test if shared libraries support was
+# explicitly disabled.
+
+CLEANFILES = libfoo.so libfoo.so.debug prog
+
+EXTRA_DIST = test_ust-dl test_ust-dl.py libfoo.c libfoo.h \
+       prog.c
+
+else
+
+objcopy_verbose = $(objcopy_verbose_@AM_V@)
+objcopy_verbose_ = $(objcopy_verbose_@AM_DEFAULT_V@)
+objcopy_verbose_0 = @echo OBJCOPY $@;
+
 AM_CPPFLAGS = -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
@@ -9,18 +24,26 @@ libfoo_la_SOURCES = libfoo.c libfoo.h
 libfoo_la_LDFLAGS = -module -shared -avoid-version \
                -rpath $(abs_builddir)
 
+CLEANFILES = libfoo.so libfoo.so.debug
+
+# Extract debug symbols
+libfoo.so.debug: libfoo.la
+       $(objcopy_verbose)$(OBJCOPY) --only-keep-debug .libs/libfoo.so libfoo.so.debug
+
+# Strip and add debuglink
+libfoo.so: libfoo.so.debug
+       @cp -f .libs/libfoo.so libfoo.so
+       $(objcopy_verbose)$(OBJCOPY) --strip-debug --add-gnu-debuglink=libfoo.so.debug libfoo.so
+
 noinst_SCRIPTS = test_ust-dl test_ust-dl.py
 EXTRA_DIST = test_ust-dl test_ust-dl.py
 
-all-local: libfoo.la
+all-local: libfoo.so
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for script in $(EXTRA_DIST); do \
                        cp -f $(srcdir)/$$script $(builddir); \
                done; \
        fi
-       objcopy --only-keep-debug .libs/libfoo.so .libs/libfoo.so.debug
-       strip -g .libs/libfoo.so
-       objcopy --add-gnu-debuglink .libs/libfoo.so.debug .libs/libfoo.so
 
 clean-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
@@ -28,4 +51,5 @@ clean-local:
                        rm -f $(builddir)/$$script; \
                done; \
        fi
-       rm -f .libs/libfoo.so.debug
+
+endif
This page took 0.02684 seconds and 4 git commands to generate.