summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Danjean <Vincent.Danjean@ens-lyon.org>2012-06-21 09:50:48 (GMT)
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-10 22:16:24 (GMT)
commit00b2fa4f77b5ecbe7d46a23e45d218565587c3f0 (patch)
tree142ff556b0e52dad1cf131a5cd3151c197ba9bac
parent90e33b9a7242f260a690b27ef4f136651186a3bc (diff)
downloadpatchelf-00b2fa4f77b5ecbe7d46a23e45d218565587c3f0.zip
patchelf-00b2fa4f77b5ecbe7d46a23e45d218565587c3f0.tar.gz
patchelf-00b2fa4f77b5ecbe7d46a23e45d218565587c3f0.tar.bz2
Rewrite tests in automake
- add options in AM_INIT_AUTOMAKE to be more strict and to enable more advanced features (color-tests and parallel-tests) - rewrite tests/Makefile.am to use automake rules for building program and libraries => we can now do: ./bootstrap.sh && mkdir build && cd build && ../configure && make -j distcheck
-rw-r--r--configure.ac2
-rw-r--r--tests/Makefile.am82
2 files changed, 46 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index 30ba4f9..63bf76a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_INIT([patchelf], m4_esyscmd([echo -n $(cat ./version)$VERSION_SUFFIX]))
AC_CONFIG_SRCDIR([src/patchelf.cc])
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([dist-bzip2 foreign])
+AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 foreign color-tests parallel-tests])
AC_PROG_CC
AC_PROG_CXX
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aa9e22b..9a38df6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,56 +1,64 @@
-check_PROGRAMS = main main-scoped simple big-dynstr
+check_PROGRAMS = simple main main-scoped big-dynstr
TESTS = plain-fail.sh plain-run.sh shrink-rpath.sh set-interpreter-short.sh \
set-interpreter-long.sh set-rpath.sh no-rpath.sh big-dynstr.sh \
set-rpath-library.sh
+EXTRA_DIST = no-rpath $(TESTS)
TESTS_ENVIRONMENT = PATCHELF_DEBUG=1
+CLEANFILES = big-dynstr.c
+clean-local:
+ $(RM) -r scratch
-simple_SOURCES = simple.c
-main_scoped_SOURCES =
-
-
-main: main.o libfoo.so
- LD_LIBRARY_PATH=. gcc -Wl,--disable-new-dtags -o main main.o -L . -lfoo
-
-main-scoped: main.o libfoo-scoped.so
- LD_LIBRARY_PATH=. gcc -Wl,--enable-new-dtags -o main-scoped main.o -L . -lfoo-scoped
-
-main.o: main.c
- $(CC) -fpic -o $@ -c $<
-
-libfoo.so: foo.o libbar.so
- NIX_DONT_SET_RPATH=1 $(CC) -Wl,--disable-new-dtags -shared -o libfoo.so foo.o -L . -lbar
-
-libfoo-scoped.so: foo.o libbar-scoped.so
- NIX_DONT_SET_RPATH=1 $(CC) -Wl,--enable-new-dtags -shared -o libfoo-scoped.so foo.o -L . -lbar-scoped
-
-foo.o: foo.c
- $(CC) -fpic -o $@ -c $<
-
-libbar.so: bar.o
- NIX_DONT_SET_RPATH=1 $(CC) -Wl,--disable-new-dtags -shared -o libbar.so bar.o -L . -Wl,-rpath,`pwd`/no-such-path
-
-libbar-scoped.so: bar.o
- NIX_DONT_SET_RPATH=1 $(CC) -Wl,--enable-new-dtags -shared -o libbar-scoped.so bar.o
-
-bar.o: bar.c
- $(CC) -fpic -o $@ -c $<
+# by default, use -fpic to compile
+AM_CFLAGS = -fpic
+LDFLAGS_local = -Wl,--disable-new-dtags -Wl,-rpath-link=. -L. $(AM_LDFLAGS)
+LDFLAGS_sharedlib = -Wl,--disable-new-dtags -shared -L. $(AM_LDFLAGS)
+export NIX_DONT_SET_RPATH=1
+simple_SOURCES = simple.c
+# no -fpic for simple.o
+simple_CFLAGS =
-big_dynstr_SOURCES = big-dynstr.c
+main_SOURCES = main.c
+main_LDADD = -lfoo $(AM_LDADD)
+main_DEPENDENCIES = libfoo.so
+main_LDFLAGS = $(LDFLAGS_local)
-big-dynstr: big-dynstr.o libfoo.so
- LD_LIBRARY_PATH=. gcc -Wl,--disable-new-dtags -o big-dynstr big-dynstr.o -L . -lfoo
+main_scoped_SOURCES = main.c
+main_scoped_LDADD = -lfoo-scoped $(AM_LDADD)
+main_scoped_DEPENDENCIES = libfoo-scoped.so
+main_scoped_LDFLAGS = $(LDFLAGS_local)
big-dynstr.c: main.c
cat $< > big-dynstr.c
for i in $$(seq 1 2000); do echo "void f$$i(void) { };" >> big-dynstr.c; done
+nodist_big_dynstr_SOURCES = big-dynstr.c
+big_dynstr_LDADD = -lfoo $(AM_LDADD)
+big_dynstr_DEPENDENCIES = libfoo.so
+big_dynstr_LDFLAGS = $(LDFLAGS_local)
-clean-local:
- $(RM) *.o libfoo.so libbar.so main big-dynstr big-dynstr.c
+# declare local shared libraries as programs as:
+# - without libtool, only archives (static libraries) can be built by automake
+# - with libtool, it is difficult to control options
+# - with libtool, it is not possible to compile convenience *dynamic* libraries :-(
+check_PROGRAMS += libfoo.so libfoo-scoped.so libbar.so libbar-scoped.so
+
+libfoo_so_SOURCES = foo.c
+libfoo_so_LDADD = -lbar $(AM_LDADD)
+libfoo_so_DEPENDENCIES = libbar.so
+libfoo_so_LDFLAGS = $(LDFLAGS_sharedlib)
+
+libfoo_scoped_so_SOURCES = foo.c
+libfoo_scoped_so_LDADD = -lbar-scoped $(AM_LDADD)
+libfoo_scoped_so_DEPENDENCIES = libbar-scoped.so
+libfoo_scoped_so_LDFLAGS = $(LDFLAGS_sharedlib)
+
+libbar_so_SOURCES = bar.c
+libbar_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,-rpath,`pwd`/no-such-path
+libbar_scoped_so_SOURCES = bar.c
+libbar_scoped_so_LDFLAGS = $(LDFLAGS_sharedlib)
-EXTRA_DIST = main.c foo.c bar.c no-rpath $(TESTS)