]> rtime.felk.cvut.cz Git - omk.git/blobdiff - tests/shlibs
Support target specific flags also for libraries
[omk.git] / tests / shlibs
index b7e3246523db098fc91da6b75525dff1cccc331d..4b800f85601b806d8ea7205e79677ae029e60473 100755 (executable)
@@ -1,4 +1,59 @@
 #!/bin/bash
 
-touch config.omk-default
-make
+case $OMK_RULES in
+    sdcc|rtems|sysless-keil51|sysless-keil16x)
+       exit 0;;
+esac
+
+. ./wvtest.sh
+
+WVSTART "Shared library"
+
+cat > 'funca.c' <<EOF
+#include <mylib.h>
+int funca(int a) {return a+1;}
+EOF
+cat > 'funcb.c' <<EOF
+#include <mylib.h>
+int funcb(int b) {return funca(b*2);}
+EOF
+cat > 'mylib.h' <<EOF
+int funca(int a);
+int funcb(int b);
+EOF
+cat > 'test.c' <<EOF
+#include <stdio.h>
+#include <mylib.h>
+int main()
+{
+        printf("result is %d\n", funcb(1));
+        return 0;
+}
+EOF
+cat > 'Makefile.omk' <<EOF
+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
+EOF
+needs_valid_CC
+WVPASS make
+
+WVSTART "Dynamic library with specific CFLAGS"
+cat > 'lib.c' <<EOF
+#if SYM != 123
+#error SYM value is wrong
+#endif
+EOF
+cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
+shared_LIBRARIES = mylib
+mylib_SOURCES = lib.c
+mylib_CFLAGS = -DSYM=123
+EOF
+WVPASS make