04a13a6f |
1 | #!/bin/bash |
25a3f430 |
2 | CONF="/etc/bake.conf" |
04a13a6f |
3 | CLL1CC=`which gcc` |
25a3f430 |
4 | CFLAGS="-std=c99 -Wall" |
04a13a6f |
5 | EXE=`basename $1 .c` |
6 | DEBUG=n |
7 | |
8 | function debugecho |
9 | { |
10 | if [ $DEBUG == y ] |
11 | then |
12 | echo $1 |
13 | fi |
14 | } |
15 | |
16 | if [ "$1" == "" ] || [ "$EXE" == "$1" ] |
17 | then |
18 | echo "Usage: bake filename.c" |
19 | exit |
20 | else |
21 | debugecho "Filename: $1" |
22 | fi |
23 | |
24 | LIBNAMES=`grep "^#define" $1|grep USE_LIBRARY_|cut -f 2 -d " "` |
25 | if ! [ -z "$LIBNAMES" ] |
26 | then |
27 | debugecho "Libraries: $LIBNAMES" |
28 | LIBS="" |
29 | for F in $LIBNAMES |
30 | do |
31 | LIBS="$LIBS `grep $F $CONF|cut -f 2 -d \ `" |
32 | done |
33 | fi |
34 | |
35 | PRENAMES=`grep "^#define" $1|grep USE_PREPROCESSOR_|cut -f 2 -d " "` |
36 | if ! [ -z "$PRENAMES" ] |
37 | then |
38 | debugecho "Precompilers: $PRENAMES" |
39 | for F in $PRENAMES |
40 | do |
41 | CMD=`grep $F $CONF|cut -f 2 -d " "` |
42 | gecho "$CMD" |
43 | $CMD |
44 | done |
45 | fi |
46 | |
25a3f430 |
47 | CMD="$CLL1CC $1 -o $EXE $CFLAGS $LIBS" |
04a13a6f |
48 | echo "$CMD" |
49 | $CMD |