From 158a5cb30064cbf955842746356de2346c3df130 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 12 Nov 2007 12:55:00 +0000 Subject: [PATCH] Fixed shared libs dependences and added test for shlibs. darcs-hash:20071112125512-f2ef6-092be5cfc255005b7c541eac467feeaeed27e785.gz --- snippets/linux | 2 +- tests/libraries/shlibs/Makefile | 16 ++++++++++++++++ tests/libraries/shlibs/Makefile.omk | 10 ++++++++++ tests/libraries/shlibs/funca.c | 6 ++++++ tests/libraries/shlibs/funcb.c | 6 ++++++ tests/libraries/shlibs/mylib.h | 8 ++++++++ tests/libraries/shlibs/runtest | 4 ++++ tests/libraries/shlibs/test.c | 7 +++++++ 8 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/libraries/shlibs/Makefile create mode 100644 tests/libraries/shlibs/Makefile.omk create mode 100644 tests/libraries/shlibs/funca.c create mode 100644 tests/libraries/shlibs/funcb.c create mode 100644 tests/libraries/shlibs/mylib.h create mode 100755 tests/libraries/shlibs/runtest create mode 100644 tests/libraries/shlibs/test.c diff --git a/snippets/linux b/snippets/linux index 7c23ea5..24f52ba 100644 --- a/snippets/linux +++ b/snippets/linux @@ -251,7 +251,7 @@ SOLIB_SOURCES += $$($(1)_SOURCES) $(USER_LIB_DIR)/lib$(1).$(SOLIB_EXT): $$($(1)_OBJSLO) @$(QUIET_CMD_ECHO) " LINK $$@" - $(Q) $(LD) --shared --soname=lib$(1).$(SOLIB_EXT) -o $$@ $$^ $$($(1)_LIBS:%=-l%) + $(Q) $(LD) --shared --soname=lib$(1).$(SOLIB_EXT) -o $$@ $$^ $$(LOADLIBES) $$($(1)_LIBS:%=-l%) endef diff --git a/tests/libraries/shlibs/Makefile b/tests/libraries/shlibs/Makefile new file mode 100644 index 0000000..aa6b442 --- /dev/null +++ b/tests/libraries/shlibs/Makefile @@ -0,0 +1,16 @@ +# Generic directory or leaf node makefile for OCERA make framework + +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif + +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" +else +include $(MAKERULES_DIR)/Makefile.rules +endif + +print_vars: + echo $(COMPILED_DIR) \ No newline at end of file diff --git a/tests/libraries/shlibs/Makefile.omk b/tests/libraries/shlibs/Makefile.omk new file mode 100644 index 0000000..1bf770b --- /dev/null +++ b/tests/libraries/shlibs/Makefile.omk @@ -0,0 +1,10 @@ +shared_LIBRARIES = a b +a_SOURCES = funca.c +b_SOURCES = funcb.c +b_LIBS = a + +include_HEADERS = mylib.h + +bin_PROGRAMS = test +test_SOURCES = test.c +test_LIBS = a b diff --git a/tests/libraries/shlibs/funca.c b/tests/libraries/shlibs/funca.c new file mode 100644 index 0000000..e31a2bc --- /dev/null +++ b/tests/libraries/shlibs/funca.c @@ -0,0 +1,6 @@ +#include + +int funca(int a) +{ + return a+1; +} diff --git a/tests/libraries/shlibs/funcb.c b/tests/libraries/shlibs/funcb.c new file mode 100644 index 0000000..43638ef --- /dev/null +++ b/tests/libraries/shlibs/funcb.c @@ -0,0 +1,6 @@ +#include + +int funcb(int b) +{ + return funca(b*2); +} diff --git a/tests/libraries/shlibs/mylib.h b/tests/libraries/shlibs/mylib.h new file mode 100644 index 0000000..dcdae13 --- /dev/null +++ b/tests/libraries/shlibs/mylib.h @@ -0,0 +1,8 @@ +#ifndef MYLIB_H +#define MYLIB_H + +int funca(int a); +int funcb(int b); + + +#endif diff --git a/tests/libraries/shlibs/runtest b/tests/libraries/shlibs/runtest new file mode 100755 index 0000000..81dd9fc --- /dev/null +++ b/tests/libraries/shlibs/runtest @@ -0,0 +1,4 @@ +#!/bin/sh + +touch config.omk-default +make diff --git a/tests/libraries/shlibs/test.c b/tests/libraries/shlibs/test.c new file mode 100644 index 0000000..a05d199 --- /dev/null +++ b/tests/libraries/shlibs/test.c @@ -0,0 +1,7 @@ +#include +#include +int main() +{ + printf("result is %d\n", funcb(1)); + return 0; +} -- 2.39.2