Add Makefile target (check-nolink) to compile all source without linking
authorIvan Maidanski <ivmai@mail.ru>
Sat, 18 Feb 2017 06:21:58 +0000 (09:21 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 18 Feb 2017 06:21:58 +0000 (09:21 +0300)
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
configure.ac
tests/Makefile.am

index a339e51..ee74821 100644 (file)
@@ -10,4 +10,6 @@ dist_pkgdata_DATA = COPYING README.md
 
 EXTRA_DIST = autogen.sh
 
+check-nolink-local: all
+
 #distclean-local:
index 9087c59..8182af3 100644 (file)
@@ -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])
index 35a89e9..94c317c 100644 (file)
@@ -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)