]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Fixed shared libs dependences and added test for shlibs.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 12 Nov 2007 12:55:00 +0000 (12:55 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 12 Nov 2007 12:55:00 +0000 (12:55 +0000)
darcs-hash:20071112125512-f2ef6-092be5cfc255005b7c541eac467feeaeed27e785.gz

snippets/linux
tests/libraries/shlibs/Makefile [new file with mode: 0644]
tests/libraries/shlibs/Makefile.omk [new file with mode: 0644]
tests/libraries/shlibs/funca.c [new file with mode: 0644]
tests/libraries/shlibs/funcb.c [new file with mode: 0644]
tests/libraries/shlibs/mylib.h [new file with mode: 0644]
tests/libraries/shlibs/runtest [new file with mode: 0755]
tests/libraries/shlibs/test.c [new file with mode: 0644]

index 7c23ea5c249a548179057476c278200f3fff96bb..24f52bae530e7d1d200548dab0fc1589986d4e2f 100644 (file)
@@ -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 (file)
index 0000000..aa6b442
--- /dev/null
@@ -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 (file)
index 0000000..1bf770b
--- /dev/null
@@ -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 (file)
index 0000000..e31a2bc
--- /dev/null
@@ -0,0 +1,6 @@
+#include <mylib.h>
+
+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 (file)
index 0000000..43638ef
--- /dev/null
@@ -0,0 +1,6 @@
+#include <mylib.h>
+
+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 (file)
index 0000000..dcdae13
--- /dev/null
@@ -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 (executable)
index 0000000..81dd9fc
--- /dev/null
@@ -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 (file)
index 0000000..a05d199
--- /dev/null
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include <mylib.h>
+int main()
+{
+        printf("result is %d\n", funcb(1));
+        return 0;
+}