struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / lib / pic14 / libdev / testall.sh
blobf25d7ef90c7958542dc19357c46fe9c499eaa97f
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 <pic14regs.h>
30 void foo(char *c)
32 if (*c)
33 *c = 1;
36 void main()
38 OPTION_REG = PCLATH;
39 INTCON = 0;
41 EOT
43 sed -e 's/\s*#.*$//' ../devices.txt | grep -v '^\s*$' | while read PROC; do
44 printf "### Compiling for $PROC: ";
45 OK="FAILED";
46 echo "$CC" -V $CPPFLAGS $CFLAGS $LDFLAGS -mpic14 -p$PROC -o test-$PROC sample.c $LIBS > "$BUILD_LOG2";
47 "$CC" -V $CPPFLAGS $CFLAGS $LDFLAGS -mpic14 -p$PROC -o test-$PROC sample.c $LIBS >> "$BUILD_LOG2" 2>&1 && OK="ok";
48 cat "$BUILD_LOG2" >> "$BUILD_LOG";
49 printf "$OK\n";
50 case "$OK" in
51 ok)
54 cat "$BUILD_LOG2";
55 printf "\n";
57 esac;
58 done;
60 cd "$BASE";
61 cleanup;