]> rtime.felk.cvut.cz Git - omk.git/blob - tests/libraries
Update wvtool
[omk.git] / tests / libraries
1 #!/bin/bash
2
3 . ./wvtest.sh
4
5 WVSTART "Static library"
6 cat > 'funca.c' <<EOF
7 #include <mylib.h>
8 int funca(int a) {return a+1;}
9 EOF
10 cat > 'funcb.c' <<EOF
11 #include <mylib.h>
12 int funcb(int b) {return b*2;}
13 EOF
14 cat > 'mylib.h' <<EOF
15 int funca(int a);
16 int funcb(int b);
17 EOF
18 cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
19 lib_LIBRARIES = mylib
20 mylib_SOURCES = funca.c funcb.c
21 include_HEADERS = mylib.h
22 EOF
23
24 mkdir app
25 cat > app/main.c <<EOF
26 #include <mylib.h>
27 int main() {
28   funca(10);
29   funcb(20);
30   return 0;
31 }
32 EOF
33 cat > app/Makefile.omk <<EOF # OMK manual includes this file - do not modify it
34 bin_PROGRAMS = libtest
35 libtest_SOURCES = main.c
36 libtest_LIBS = mylib
37 EOF
38
39 needs_valid_CC
40 omkize
41 WVPASS make
42 case $OMK_RULES in
43     linux) WVPASS test -f _compiled/lib/libmylib.a ;;
44 esac
45 WVPASS make -C app
46
47
48 case $OMK_RULES in
49     sysless) # Sysless rules do not support this (yet)
50         exit 0;;
51 esac
52
53 WVSTART "Static library with specific CFLAGS"
54 cat > 'lib.c' <<EOF
55 #if SYM != 123
56 #error SYM value is wrong
57 #endif
58 EOF
59 cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
60 lib_LIBRARIES = mylib
61 mylib_SOURCES = lib.c
62 mylib_CFLAGS = -DSYM=123
63 EOF
64 WVPASS make