forked from z88dk/z88dk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·97 lines (82 loc) · 1.75 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
#
#
# Build z88dk on unix systems
#
set -e # -e: exit on error; -u: exit on undefined variable
# -e can be overidden by -k option
do_clean=0
do_tests=0
do_build=1
do_examples=0
do_libbuild=1
for arg in "$@"; do
case "$arg" in
-k) set +e ;; # keep building ignoring errors
-c) do_clean=1 ;; # clean before building
-t) do_tests=1 ;; # Run tests as well
-e) do_examples=1 ;; # Build examples as well
-nb) do_build=0 ;; # Don't build
-nl) do_libbuild=0 ;; # Don't build libraries
*)
echo "Usage: $0 [-e][-k][-c][-t][-nb][-nl]"
echo
echo "-k\tKeep building ignoring errors"
echo "-c\tClean before building"
echo "-t\tRun tests"
echo "-e\tBuild examples"
echo "-nb\tDon't build binaries"
echo "-nl\tDon't build libraries"
echo ""
echo "Default is to build binaries and libraries"
exit 1
;;
esac
done
if [ $do_clean = 1 ]; then
make clean
# dont remove bin, as zsdcc and szdcpp must be built by hand in win32
#rm -rf bin/*
fi
mkdir -p bin
PATH=`pwd`/bin:$PATH
export PATH
ZCCCFG=`pwd`/lib/config/
export ZCCCFG
if [ -z "$CFLAGS" ]; then
CFLAGS="-g -O2"
fi
export CC
export CFLAGS
case `uname -s` in
SunOS)
MAKE="gmake"
INSTALL="ginstall"
;;
OpenBSD|NetBSD|FreeBSD)
MAKE="gmake"
INSTALL="install"
;;
*)
MAKE="make"
INSTALL="install"
;;
esac
export INSTALL
if [ $do_build = 1 ]; then
$MAKE
fi
if [ $do_libbuild = 1 ]; then
$MAKE -C libsrc clean
$MAKE -C libsrc
$MAKE -C libsrc install
$MAKE -C libsrc/_DEVELOPMENT
$MAKE -C include/_DEVELOPMENT
fi
if [ $do_tests = 1 ]; then
$MAKE -C testsuite
$MAKE -C test
fi
if [ $do_examples = 1 ]; then
$MAKE -C examples
fi