LC_NUMERIC locale will be set to "C" by default
[svn/Cll1h/.git] / tools / bake
CommitLineData
04a13a6f 1#!/bin/bash
25a3f430 2CONF="/etc/bake.conf"
04a13a6f 3CLL1CC=`which gcc`
25a3f430 4CFLAGS="-std=c99 -Wall"
04a13a6f 5DEBUG=n
6
7function debugecho
8{
9 if [ $DEBUG == y ]
10 then
bc44f2cc 11 echo $1
04a13a6f 12 fi
13}
14
15if [ "$1" == "" ] || [ "$EXE" == "$1" ]
16then
bc44f2cc 17 echo "Usage: bake source.c or bake target"
18 exit
04a13a6f 19else
bc44f2cc 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
04a13a6f 41
bc44f2cc 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
04a13a6f 53
bc44f2cc 54 CMD="$CLL1CC $SRC -o $EXE $CFLAGS $LIBS"
55 echo "$CMD"
56 $CMD
57 shift
58 done
04a13a6f 59fi
This page took 0.153459 seconds and 4 git commands to generate.