diff options
Diffstat (limited to '')
-rwxr-xr-x | build.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..dd7e45b --- /dev/null +++ b/build.sh | |||
@@ -0,0 +1,68 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | BUSRC="stack.cpp fstring.cpp fbasicstring.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp" | ||
4 | BUHDR="stack.h fstring.h fbasicstring.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h osx_compatibility.h win32_compatibility.h linux_compatibility.h plugger.h singleton.h optparser.h signals.h array.h membuf.h" | ||
5 | |||
6 | function bld() | ||
7 | { | ||
8 | OUTFILE="$1" | ||
9 | if [ ! -e "$OUTFILE" ]; then | ||
10 | return 1 | ||
11 | fi | ||
12 | shift | ||
13 | for INFILE in $*; do | ||
14 | if [ "$INFILE" -nt "$OUTFILE" ]; then | ||
15 | return 1 | ||
16 | fi | ||
17 | done | ||
18 | return 0 | ||
19 | } | ||
20 | |||
21 | function cmd() | ||
22 | { | ||
23 | printf "%8s $2\n" $1 | ||
24 | shift 2 | ||
25 | $* || exit | ||
26 | } | ||
27 | |||
28 | function gpp() | ||
29 | { | ||
30 | bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -W -Wall -Iminibu -Iminibu/bu -c -o "$1" "$2" | ||
31 | } | ||
32 | |||
33 | if [ ! -z "$1" ]; then | ||
34 | if [ "$1" == "clean" -o "$1" == "-c" ]; then | ||
35 | echo "Cleaning up, deleting all object code and downloaded source code..." | ||
36 | echo | ||
37 | rm -Rf minibu src/*.o | ||
38 | exit | ||
39 | else | ||
40 | echo "The only option supported is \"clean\", otherwise run $0" | ||
41 | echo "with no parameters to compile build." | ||
42 | echo | ||
43 | exit | ||
44 | fi | ||
45 | fi | ||
46 | |||
47 | mkdir -p minibu/src minibu/bu | ||
48 | for F in $BUSRC; do | ||
49 | bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/src/$F | ||
50 | done | ||
51 | for F in $BUHDR; do | ||
52 | bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/bu/$F | ||
53 | done | ||
54 | |||
55 | bld src/build.tab.c src/build.y || cmd BISON src/build.tab.c bison -bsrc/build src/build.y | ||
56 | bld src/build.yy.c src/build.l || cmd FLEX src/build.yy.c flex src/build.l | ||
57 | |||
58 | for F in $BUSRC; do | ||
59 | OUTPUT=${F%.*}.o | ||
60 | bld minibu/src/$OUTPUT || gpp minibu/src/$OUTPUT minibu/src/$F | ||
61 | done | ||
62 | |||
63 | for F in src/*.c src/*.cpp; do | ||
64 | OUTPUT=${F%.*}.o | ||
65 | gpp "$OUTPUT" "$F" | ||
66 | done | ||
67 | bld build src/*.o minibu/src/*.o || cmd LINK build g++ -o build src/*.o minibu/src/*.o -ldl | ||
68 | bld build~ build || cmd CP build~ cp build build~ | ||