]> rtime.felk.cvut.cz Git - omk.git/blobdiff - tests/libraries
Update wvtool
[omk.git] / tests / libraries
index b7e3246523db098fc91da6b75525dff1cccc331d..26ab40604305628c64af7947dba312bfd30b7d31 100755 (executable)
@@ -1,4 +1,64 @@
 #!/bin/bash
 
-touch config.omk-default
-make
+. ./wvtest.sh
+
+WVSTART "Static 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 b*2;}
+EOF
+cat > 'mylib.h' <<EOF
+int funca(int a);
+int funcb(int b);
+EOF
+cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
+lib_LIBRARIES = mylib
+mylib_SOURCES = funca.c funcb.c
+include_HEADERS = mylib.h
+EOF
+
+mkdir app
+cat > app/main.c <<EOF
+#include <mylib.h>
+int main() {
+  funca(10);
+  funcb(20);
+  return 0;
+}
+EOF
+cat > app/Makefile.omk <<EOF # OMK manual includes this file - do not modify it
+bin_PROGRAMS = libtest
+libtest_SOURCES = main.c
+libtest_LIBS = mylib
+EOF
+
+needs_valid_CC
+omkize
+WVPASS make
+case $OMK_RULES in
+    linux) WVPASS test -f _compiled/lib/libmylib.a ;;
+esac
+WVPASS make -C app
+
+
+case $OMK_RULES in
+    sysless) # Sysless rules do not support this (yet)
+       exit 0;;
+esac
+
+WVSTART "Static 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
+lib_LIBRARIES = mylib
+mylib_SOURCES = lib.c
+mylib_CFLAGS = -DSYM=123
+EOF
+WVPASS make