]> rtime.felk.cvut.cz Git - omk.git/blob - tests/shlibs
Fix failing test
[omk.git] / tests / shlibs
1 #!/bin/bash
2
3 case $OMK_RULES in
4     sdcc|rtems|sysless-keil51|sysless-keil16x)
5         exit 0;;
6 esac
7
8 . ./wvtest.sh
9
10 WVSTART "Shared library"
11
12 cat > 'funca.c' <<EOF
13 #include <mylib.h>
14 int funca(int a) {return a+1;}
15 EOF
16 cat > 'funcb.c' <<EOF
17 #include <mylib.h>
18 int funcb(int b) {return funca(b*2);}
19 EOF
20 cat > 'mylib.h' <<EOF
21 int funca(int a);
22 int funcb(int b);
23 EOF
24 cat > 'test.c' <<EOF
25 #include <stdio.h>
26 #include <mylib.h>
27 int main()
28 {
29         printf("result is %d\n", funcb(1));
30         return 0;
31 }
32 EOF
33 cat > 'Makefile.omk' <<EOF
34 shared_LIBRARIES = a b
35 a_SOURCES = funca.c
36 b_SOURCES = funcb.c
37 b_LIBS = a
38
39 include_HEADERS = mylib.h
40
41 bin_PROGRAMS = test
42 test_SOURCES = test.c
43 test_LIBS = a b
44 EOF
45 needs_valid_CC
46 WVPASS make
47
48 case $OMK_RULES in
49     sysless) # Sysless rules do not support this (yet)
50         exit 0;;
51 esac
52
53 WVSTART "Dynamic 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 shared_LIBRARIES = mylib
61 mylib_SOURCES = lib.c
62 mylib_CFLAGS = -DSYM=123
63 EOF
64 WVPASS make