diff options
author | Cyril Hrubis <chrubis@suse.cz> | 2019-03-08 13:37:00 +0100 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2019-03-08 16:18:35 +0100 |
commit | 5da51ab2d2ac36800ee709953dac7f0559f7c81f (patch) | |
tree | 7372f3f4f469765f251fecec1bafe9aba7e8254e /include | |
parent | 4f5c1f01685d3751c1b8f583cc50f4976cc3e1f5 (diff) |
libs: Hook up libs into the build system
This hooks up libs/ subdirectories into the build system so that tests
needs only specify which library from libs/ directory we should link
againts. Which sets up the path to the library in LDFLAGS and also
causes the library to be rebuild even when make is executed from the
directory with testcases.
Now the test only needs to set up LTPLIBS variable with a list of
optional libraries to link against and LDLIBS, since as far as I know we
have to maintain the order of the libraries manually.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/mk/testcases.mk | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/mk/testcases.mk b/include/mk/testcases.mk index bf97384a7..131854ec7 100644 --- a/include/mk/testcases.mk +++ b/include/mk/testcases.mk @@ -41,5 +41,19 @@ INSTALL_DIR := testcases/bin LDLIBS += -lltp -$(APICMDS_DIR) $(LIBLTP_DIR): %: +ifdef LTPLIBS + +LTPLIBS_DIRS = $(addprefix $(abs_top_builddir)/libs/lib, $(LTPLIBS)) +LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach LIB,$(LTPLIBS),lib$(LIB)/lib$(LIB)))) + +MAKE_DEPS += $(LTPLIBS_FILES) + +$(LTPLIBS_FILES): $(LTPLIBS_DIRS) + $(MAKE) -C "$^" -f "$^/Makefile" all + +LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS)) + +endif + +$(LTPLIBS_DIRS) $(APICMDS_DIR) $(LIBLTP_DIR): %: mkdir -p "$@" |