Prepare for SDCC 4.5.0 release.
[sdcc.git] / sdcc / device / non-free / lib / pic16 / libdev / testall.sh
blob824eebc27525c945594e5017b13b88c9852a2334
1 #!/bin/sh
3 BASE="$(pwd)";
4 BUILD_LOG="$BASE/build.log";
5 BUILD_LOG2="$BASE/build.log2";
6 BUILD_DIR="$BASE/__tests";
8 CC="sdcc";
9 CPPFLAGS="";
10 CFLAGS="--use-non-free";
11 LDFLAGS="";
12 LIBS="";
14 cleanup()
16 rm -f "$BUILD_LOG2";
17 rm -rf "$BUILD_DIR";
20 if [ -e "$BUILD_DIR" ]; then
21 echo "$BUILD_DIR already there -- exiting.";
22 exit 1;
23 fi;
24 { mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"; } || exit 1;
25 trap "cleanup" INT;
27 cat > sample.c <<EOT
28 #include <pic18fregs.h>
29 #include <stdio.h>
30 #pragma stack 0x00c0 0x40
32 void foo(char *c)
34 if (*c)
35 *c = 1;
38 void main()
40 PORTA = INTCON;
41 LATB = TRISB;
42 printf_tiny("foo"); /* printf() is too large for the smallest devices ... */
44 EOT
46 for f in ./pic1*.c; do
47 p="${f##*/pic}";
48 p="${p%.c}";
50 printf "### Compiling for $p: ";
51 OK="FAILED";
52 echo "$CC" -V $CPPFLAGS $CFLAGS $LDFLAGS -mpic16 -p$p -o test-$p sample.c $LIBS > "$BUILD_LOG2";
53 "$CC" -V $CPPFLAGS $CFLAGS $LDFLAGS -mpic16 -p$p -o test-$p sample.c $LIBS >> "$BUILD_LOG2" 2>&1 && OK="ok";
54 cat "$BUILD_LOG2" >> "$BUILD_LOG";
55 printf "$OK\n";
56 case "$OK" in
57 ok)
60 cat "$BUILD_LOG2";
61 printf "\n";
63 esac;
64 done;
66 cd "$BASE";
67 cleanup;