some work on objects and locales (#3 and #5 ?)
[svn/Cll1h/.git] / tools / bake
1 #!/bin/bash
2 CONF="/etc/bake.conf"
3 CLL1CC=`which gcc`
4 CFLAGS="-std=c99 -Wall"
5 DEBUG=n
6
7 function debugecho
8 {
9 if [ $DEBUG == y ]
10 then
11 echo $1
12 fi
13 }
14
15 if [ "$1" == "" ] || [ "$EXE" == "$1" ]
16 then
17 echo "Usage: bake source.c or bake target"
18 exit
19 else
20 while [ "$1" != "" ]
21 do
22 EXE=`basename $1 .c`
23 if [ $1 == $EXE ]
24 then
25 SRC=$EXE.c
26 else
27 SRC=$1
28 fi
29 debugecho "Filename: $SRC"
30
31 LIBNAMES=`grep "^#define" $SRC|grep USE_LIBRARY_|cut -f 2 -d " "`
32 if ! [ -z "$LIBNAMES" ]
33 then
34 debugecho "Libraries: $LIBNAMES"
35 LIBS=""
36 for F in $LIBNAMES
37 do
38 LIBS="$LIBS `grep $F $CONF|cut -f 2 -d \ `"
39 done
40 fi
41
42 PRENAMES=`grep "^#define" $SRC|grep USE_PREPROCESSOR_|cut -f 2 -d " "`
43 if ! [ -z "$PRENAMES" ]
44 then
45 debugecho "Precompilers: $PRENAMES"
46 for F in $PRENAMES
47 do
48 CMD=`grep $F $CONF|cut -f 2 -d " "`
49 gecho "$CMD"
50 $CMD
51 done
52 fi
53
54 CMD="$CLL1CC $SRC -o $EXE $CFLAGS $LIBS"
55 echo "$CMD"
56 $CMD
57 shift
58 done
59 fi
This page took 1.290626 seconds and 4 git commands to generate.