]> rtime.felk.cvut.cz Git - omk.git/blobdiff - tests/shlibs
Support target specific flags also for libraries
[omk.git] / tests / shlibs
index 618a7971430150038e8abd1304e7b1f2055af870..4b800f85601b806d8ea7205e79677ae029e60473 100755 (executable)
@@ -5,7 +5,55 @@ case $OMK_RULES in
        exit 0;;
 esac
 
-. ./functions.sh
+. ./wvtest.sh
 
-touch config.omk-default
+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