From 3b7e732d7206076a96c15396252bad56cd0cda0f Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 18 Feb 2017 09:21:58 +0300 Subject: [PATCH] Add Makefile target (check-nolink) to compile all source without linking Note: it is assumed --enable-shared is not passed to configure. * Makefile.am (check-nolink-local): New Makefile phony target (just redirects to "all"). * configure.ac: Define check-nolink by AM_EXTRA_RECURSIVE_TARGETS. * tests/Makefile.am (TEST_OBJS): New variable (with a list of the test .o files). * tests/Makefile.am (check-nolink-local): New Makefile phony target (forces all tests to be compiled but not linked). --- Makefile.am | 2 ++ configure.ac | 1 + tests/Makefile.am | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/Makefile.am b/Makefile.am index a339e51..ee74821 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,4 +10,6 @@ dist_pkgdata_DATA = COPYING README.md EXTRA_DIST = autogen.sh +check-nolink-local: all + #distclean-local: diff --git a/configure.ac b/configure.ac index 9087c59..8182af3 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR(src/atomic_ops.c) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2 nostdinc]) +AM_EXTRA_RECURSIVE_TARGETS([check-nolink]) AM_MAINTAINER_MODE AC_CONFIG_HEADERS([src/config.h]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 35a89e9..94c317c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -13,8 +13,11 @@ AM_CPPFLAGS = \ CFLAGS += $(CFLAGS_EXTRA) TESTS = test_atomic test_atomic_generalized test_stack test_malloc +TEST_OBJS = test_atomic.o test_stack.o test_malloc.o \ + test_atomic_generalized-test_atomic.o if HAVE_PTHREAD_H TESTS += test_atomic_pthreads +TEST_OBJS += test_atomic_pthreads-test_atomic.o test_atomic_pthreads_SOURCES=$(test_atomic_SOURCES) test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) test_atomic_pthreads_LDADD=$(test_atomic_LDADD) @@ -108,3 +111,6 @@ list_atomic.i: list_atomic.c # Verify list_atomic.c syntax: list_atomic.o: list_atomic.c $(COMPILE) -c -o $@ $? + +# Just compile all tests (without linking and execution): +check-nolink-local: $(TEST_OBJS) -- 2.7.4